Bootstrapping Project Code
                          László Bácsi
                           @icanscale
                       github.com/lackac




2009. szeptember 28.
In the old days
          $ rails myapp
                create
                create    app/controllers
                create    app/helpers
                create    app/models
                create    app/views/layouts
                create    config/environments
                create    config/initializers
                create    config/locales
                create    db
                create    doc
                create    lib



                                           and later...
          $   script/plugin install stuff
          $   script/generate stuff MyStuff
          $   cp -r ../other_stuff my_other_stuff
          $   # and much much more other stuff




2009. szeptember 28.
Takes a lot of time and
                   effort but it’s “modular”



2009. szeptember 28.
Then came app skeletons
                       Bort

                       and many others




2009. szeptember 28.
Lightning fast but no
                            modularity



2009. szeptember 28.
Then came Rails templates
          # template.rb
          run "rm public/index.html"
          generate(:scaffold, "person name:string")
          route "map.root :controller => 'people'"
          rake("db:migrate")

          git :init
          git :add => "."
          git :commit => "-a -m 'Initial commit'"



          $ rails myapp -m template.rb




2009. szeptember 28.
Lightning fast, easier
                       customization but still
                            no modularity


2009. szeptember 28.
Then came App LEGO

                       Using Rails templates

                       Modular

                         each feature has its own template

                         you can decide which modules you want



2009. szeptember 28.
Then came App LEGO
          $ rails -m http://github.com/lackac/app_lego/raw/master/app_lego.rb my_app
          ...
                 create log/test.log
               applying template: http://github.com/lackac/app_lego/raw/master/app_lego.rb
                        Use braid for vendor management?
          y
                        Do you want to play LEGO?
          y
                        Install everything without question?
          n
                        Do basic setup? (only exclude this if you already have a Rails app skeleton with Rails 2.3+ frozen,
          or as a gem)
          y
               applying template: http://github.com/lackac/app_lego/raw/master/basic.rb
              executing rmdir tmp/{pids,sessions,sockets,cache} from /private/tmp/my_app
              executing rm README log/*.log public/index.html public/images/rails.png from /private/tmp/my_app
              executing find . ( -type d -empty ) -and ( -not -regex ./.git.* ) -exec touch {}/.gitignore ; from /
          private/tmp/my_app
                running git init
                   file .gitignore
              executing cp config/database.yml config/database.yml.sample from /private/tmp/my_app
                running git add .
                running git commit -a -m 'Setting up a new rails app. Copy config/database.yml.sample to config/
          database.yml and customize.'
              executing braid add git://github.com/rails/rails.git vendor/rails from /private/tmp/my_app
            initialized application structure
                applied http://github.com/lackac/app_lego/raw/master/basic.rb
                        Use RSpec instead of test/unit?
          y
               applying template: http://github.com/lackac/app_lego/raw/master/rspec.rb
          ...




2009. szeptember 28.
Modules are plain templates
          gem 'haml', :version => '>= 2.1'
          gem 'chriseppstein-compass', :lib => 'compass', :version => '>= 0.3.4'

          run "haml --rails ."
          run "echo -e 'ynnn' | compass --rails -f blueprint"

          git :add => "."
          git :commit => "-a -m 'Added haml for views and compass for css'"




                       braid                                             auth
                       basic                                             couchdb
                       rspec                                             locale
                       haml                                              misc
                       jquery                                            and others...


2009. szeptember 28.
And others...




2009. szeptember 28.
Still fast, modular and
                             customizable



2009. szeptember 28.
Downsides


                       really long command line to remember

                       a lot of questions

                       options in ENV vars




2009. szeptember 28.
Future
                       create wrapper script

                       use dependencies instead of ordering

                       use regular and meaningful command line
                       options

                       simple sinatra application as a user
                       interface

                       merge interesting modules

2009. szeptember 28.
Thank you!
                            László Bácsi, @icanscale
                       http://github.com/lackac/app_lego




2009. szeptember 28.

App Lego

  • 1.
    Bootstrapping Project Code László Bácsi @icanscale github.com/lackac 2009. szeptember 28.
  • 2.
    In the olddays $ rails myapp create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create config/locales create db create doc create lib and later... $ script/plugin install stuff $ script/generate stuff MyStuff $ cp -r ../other_stuff my_other_stuff $ # and much much more other stuff 2009. szeptember 28.
  • 3.
    Takes a lotof time and effort but it’s “modular” 2009. szeptember 28.
  • 4.
    Then came appskeletons Bort and many others 2009. szeptember 28.
  • 5.
    Lightning fast butno modularity 2009. szeptember 28.
  • 6.
    Then came Railstemplates # template.rb run "rm public/index.html" generate(:scaffold, "person name:string") route "map.root :controller => 'people'" rake("db:migrate") git :init git :add => "." git :commit => "-a -m 'Initial commit'" $ rails myapp -m template.rb 2009. szeptember 28.
  • 7.
    Lightning fast, easier customization but still no modularity 2009. szeptember 28.
  • 8.
    Then came AppLEGO Using Rails templates Modular each feature has its own template you can decide which modules you want 2009. szeptember 28.
  • 9.
    Then came AppLEGO $ rails -m http://github.com/lackac/app_lego/raw/master/app_lego.rb my_app ... create log/test.log applying template: http://github.com/lackac/app_lego/raw/master/app_lego.rb Use braid for vendor management? y Do you want to play LEGO? y Install everything without question? n Do basic setup? (only exclude this if you already have a Rails app skeleton with Rails 2.3+ frozen, or as a gem) y applying template: http://github.com/lackac/app_lego/raw/master/basic.rb executing rmdir tmp/{pids,sessions,sockets,cache} from /private/tmp/my_app executing rm README log/*.log public/index.html public/images/rails.png from /private/tmp/my_app executing find . ( -type d -empty ) -and ( -not -regex ./.git.* ) -exec touch {}/.gitignore ; from / private/tmp/my_app running git init file .gitignore executing cp config/database.yml config/database.yml.sample from /private/tmp/my_app running git add . running git commit -a -m 'Setting up a new rails app. Copy config/database.yml.sample to config/ database.yml and customize.' executing braid add git://github.com/rails/rails.git vendor/rails from /private/tmp/my_app initialized application structure applied http://github.com/lackac/app_lego/raw/master/basic.rb Use RSpec instead of test/unit? y applying template: http://github.com/lackac/app_lego/raw/master/rspec.rb ... 2009. szeptember 28.
  • 10.
    Modules are plaintemplates gem 'haml', :version => '>= 2.1' gem 'chriseppstein-compass', :lib => 'compass', :version => '>= 0.3.4' run "haml --rails ." run "echo -e 'ynnn' | compass --rails -f blueprint" git :add => "." git :commit => "-a -m 'Added haml for views and compass for css'" braid auth basic couchdb rspec locale haml misc jquery and others... 2009. szeptember 28.
  • 11.
  • 12.
    Still fast, modularand customizable 2009. szeptember 28.
  • 13.
    Downsides really long command line to remember a lot of questions options in ENV vars 2009. szeptember 28.
  • 14.
    Future create wrapper script use dependencies instead of ordering use regular and meaningful command line options simple sinatra application as a user interface merge interesting modules 2009. szeptember 28.
  • 15.
    Thank you! László Bácsi, @icanscale http://github.com/lackac/app_lego 2009. szeptember 28.