#148 Custom App Generators (revised)
Feb 03, 2013 | 10 minutes |
Tools
Learn how to customize the Rails app generator to fit your preference. This episode shows how to do this using .railsrc file, app templates, app builders, RailsWizard, and AppScrolls.
- Download:
- source codeProject Files in Zip (1.26 KB)
- mp4Full Size H.264 Video (29.9 MB)
- m4vSmaller H.264 Video (12.9 MB)
- webmFull Size VP8 Video (13.1 MB)
- ogvFull Size Theora Video (29.2 MB)
Good information, but most of these steps are almost hard coded into my brain already. However, I do see where it can be useful for creating templates for certain configurations with twitter-bootstrap, cancan, sorcery/devise, user model, etc. with the most commonly used gems.
Though, usually it only takes a few minutes to do this stuff now.
Didn't know about the appscrolls. Does seem useful.
I take back what I said. It is more of a time saver than I had originally thought. I've posted the below generator.
https://github.com/kobaltz/app_template_generator
It creates
- Twitter Bootstrap
- Sorcery :remember_me and :reset_password
- CanCan 2.0
- Simple_Form
Ran a few successful tests. Definitely cuts out the BS in the setting up of base app and gets into the fun part. Almost reminds me of the yii demo app or asp.net mvc template app.
Huge time saver and less running around to find the old scripts for the authentication reset password stuff!
You can work around the issue with running
bundle install
multiple times with the--skip-bundle
-option for therails
-command and callingbundle_command('install')
from theleftovers
-method:It isn't the most elegant solution, but it saves a little time by calling bundler only once. It would be nice if you could modify the
options
-variable in theAppBase
-classErwin's solution is a nice one and scales better than mine. However mine is a little bit easier on the fingers as it does not require the
--skip-bundle
option.I've looked into the
at_exit
callback, and thought of this:This way, you have a single method for postprocessing which is called after bundler.
@Ryan I hope we are not abusing the comment space with this.
@Erwin it would surely be nice to have a postprocess method, but my real issue with
at_exit
was that I need to know when thecallbacks are registered.
Thus it might be a good idea to have the
postprocess
insideRails::AppBuilder
and letRails::AppBuilder
expose someregister_*
methods likeregister_first
,register_last
etc.Another possibility would be, that a
register
method returns the registered block, which later can be used to specify dependencies. Voilà an example:There's http://drone.bz and Rails Composer as well, which are nice to use.
Thanks, this is very useful site.
Really well thought the system
Not easy to start with but then a real holiday
Great Railscast, though I felt Rails Composer was sorely missing; seems like it's becoming the de-facto solution for this kind of thing.
Thunderbolt Labs article Why we don't use a Rails template
;-)
I agree Richard, I only use Rails Composer when starting a new Rails app.
Rails 4.0.0.beta1 seems to have dropped the 'new -b' option for using app builders. Does anyone know if this will be the case in production, or is it just a case of 'work in progress' ?
I am finding this to be the case as well. Have you found any work arounds?
This is one of my favorite topic which I always want to learn more and more. Good to see this much interesting article and i delighted so much to know more facts about this.
Here you mentioned few great info and thanks for sharing with us.
Thanks for providing useful info for generating custom apps.Delta emulator app is very popular to play all types of games on your ios device without jailbreaking. Install Delta emulator on your ios device to get your favorite games with single multi-emulator. This delta emulator ios app is very useful to get unlimited entertainment with trending games
Perfect for my preference. I love being super emotional and over dramatic and in this situation, I sprung to my keyboard and started to type in and got right to adding to my property.
Thanks for this