At the beginning I thought, great my process described in my post how to setup activescaffold with rails 3 is quite easy and only consists of a view steps. Unfortunetly, I had to realize that even these few steps are too many if you have to do that frequently.

Therefore I ve tried to further reduce steps it takes to install my little howto application. I ve managed to get it down to one step (if you do not count downloading a ruby script :-))

That s a real time safer for me and will be for you if you are following my posts and try these things out. In addition it can be used to install any new activescaffold enabled rails 3 app.

You may find that install script at the following location: One Step Activescaffold

If you want to try it out just download the following file: https://github.com/vhochstein/one_step_active_scaffold/raw/master/one_step_activescaffold.rb and run it on your computer without any options.

At the end you are a proud creator of my little how-to application. you just have to call ‘rails s’ to start the application.

If you like it you can use it even for your own apps. This little script takes several arguments, these empower you to set application name, js_library, your preferred database system and db user and password.
If you would like to create your own models instead of my player and team ones… Sure no problem. You just have to create a special file in the same directory which includes the required commands to create these models.

Let’s take a look at some examples:

ruby one_step_activescaffold_app.rb

That s the default, which creates my little how-to.

ruby one_step_activescaffold_app.rb my_new_app jquery mysql

Creates my little how-to with the name ‘my_new_app’ using mysql and jquery.

ruby one_step_activescaffold_app.rb my_new_app jquery postgres john top_secret

Same as before, but using postgres and db_user is ‘john’ and password is ‘top_secret’

model_setup.rb:
puts %x[rails g active_scaffold coach name:string]

ruby one_step_activescaffold_app.rb

Creates my little how-to, but instead of creating team and player model, we create a coach model.

About these ads