Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zachpendleton/snfn
Sinatra template generator
https://github.com/zachpendleton/snfn
Last synced: 27 days ago
JSON representation
Sinatra template generator
- Host: GitHub
- URL: https://github.com/zachpendleton/snfn
- Owner: zachpendleton
- License: mit
- Created: 2011-08-12T22:13:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-24T14:08:04.000Z (over 13 years ago)
- Last Synced: 2024-05-15T17:50:13.742Z (7 months ago)
- Language: JavaScript
- Homepage: http://github.com/zachpendleton/snfn
- Size: 393 KB
- Stars: 22
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.mdown
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-sinatra - Snfn - A Sinatra application generator. (Generators)
README
# Snfn - A Sinatra application generator
Snfn is an opinionated generator for Sinatra projects. It
can be configured using the following options:* `-d` Database. Options are "postgres," "mysql," "sqlite",
and "mongo." Default is "sqlite."
* `--redis` Include Redis configuration options.
* `--no-database` Don't include any database config options.
* `--no-heroku` Don't include Heroku config options.## Installation
gem install snfn
## Example
Standard Heroku app, using sqlite for local development and
PostgreSQL for production.snfn my_app
App without Heroku options and mysql config.
snfn my_app -d mysql --no-heroku
## Architecture
The template autoloads files in config/initializers and
/lib. Database configuration options are stored in `config/db.yml`
and are loaded via `config/initializers/database.rb`.Right now Snfn only comes out of the box with support for Unicorn, (the
config file is stored at config/unicorn.rb), but changing it out for
thin or mongrel is pretty trivial.## DB Setup
[Sequel](http://sequel.rubyforge.org) is used as an ORM for
relational databases, and migrations are stored in db/migrate.
Migrations can be run using the rake command `rake rb:migrate`.MongoMapper is used for Mongo apps, with the config options
stored in the same files as relational databases (`config/db.yml`
and `config/initializers/database.rb`).### More information
* [Sequel Migrations](http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html)
* [Sequel Models](http://sequel.rubyforge.org/rdoc/classes/Sequel/Model.html)
* [MongoMapper](http://mongomapper.com)If there is any interest in supporting other ORMs like DataMapper or
ActiveRecord, either please let me know or implement it yourself and
send a pull request.## Set up on Heroku
By default, Snfn creates an app with the proper options for deployment
on Heroku. To get Snfn up and running on Heroku:1. Install your gems with `bundle install`
2. Create a new git repository: `git init .`
3. Make your first commit: `git add .; git commit -m "initial commit"`
4. Create a new heroku app: `bundle exec heroku create --stack cedar`
5. Deploy the app: `git push heroku master`### Heroku Add-Ons
To use PostgreSQL, MongoDB, or Redis on Heroku, you'll need to add
the proper Heroku add-ons. The commands to do this are, respectively:heroku addons:add shared-database # PostgreSQL
heroku addons:add mongolab:starter # MongoDB
heroku addons:add redistogo:nano # Redis## Contributing to snfn
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.## Copyright
Copyright (c) 2011 Zach Pendleton. See LICENSE.txt for
further details.