TinyRails
Scaffold for tiny Rails apps based on José Valim's Rails Lightweight Stack code.
DEPRECATED
I'm no longer maintaing this and if you are looking into a "lightweight Rails stack" these days you probably want to use rails-api
Installation
Install it using:
$ gem install tiny-rails
WTF?! Why would I use this?
Although the generated application code could be used on a production server, the idea is to try to give you a really basic application to try out new Rails gems, create spikes and to provide an isolated small Rails environment for reproducing bugs to support bug reports and / or to demo your Rails engine.
You could also use this to create a single page application with Rails features like code reloading and the asset pipeline without having to set up a Sinatra application from the ground app.
Usage
$ tiny-rails new tiny-app
create
create .gitignore
create Gemfile
create boot.rb
create tiny_rails_controller.rb
create index.html.erb
create server
create config.ru
chmod server
This will give you a pretty basic application that you can run with rackup
or you preferred server. It even supports code reloading for the generated
controller, models and mailers!
You can also fire up a console to play around with the generated app running
tiny-rails console
. If you want to use Pry, you can just add the pry-rails
gem to your Gemfile.
Addons
You can provide the -a
parameter when creating new apllications to enable a
list of "addons" on the generated app. For example:
$ tiny-rails new tiny-app -a activerecord
...
apply /path/to/tiny-rails/gem/addons/activerecord.rb
gemfile activerecord (~> 3.2)
gemfile sqlite3
create models.rb
insert tiny_rails_controller.rb
insert boot.rb
create migrate
chmod migrate
append .gitignore
Or you can run tiny-rails add [list of addons]
from a generated application
folder.
Here's a list of the addons bundled with the gem:
Building your own addon
The API for writing addon scripts are based on Rails'
application templates
(with a smaller API), please have a look at the bundled addons,
TinyRails::Actions
and Thor::Actions
modules to find out whats supported.
As with Rails' application templates, you can use remote addon scripts, just pass
in the URL as an argument to tiny-rails new
or tiny-rails add
.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request