Skip to content

Instantly share code, notes, and snippets.

[rails2] > ./script/generate migration AddNameToPerson
exists db/migrate
create db/migrate/20100210021747_add_name_to_person.rb
[rails3] > rails generate migration AddNameToPerson
invoke active_record
create db/migrate/20100210021747_add_name_to_person.rb
[rails2] > ./script/generate resource Person name:string
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/people
exists test/functional/
exists test/unit/
exists test/unit/helpers/
dependency model
exists app/models/
[rails2] > ./script/generate model Person name:string
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/person.rb
create test/unit/person_test.rb
create test/fixtures/people.yml
exists db/migrate
create db/migrate/20100210021556_create_people.rb
[rails2] > ./script/generate controller People index show
exists app/controllers/
exists app/helpers/
create app/views/people
exists test/functional/
exists test/unit/helpers/
create app/controllers/people_controller.rb
create test/functional/people_controller_test.rb
create app/helpers/people_helper.rb
create test/unit/helpers/people_helper_test.rb
apply "http://gist.github.com/187990.txt"
apply "http://gist.github.com/187993.txt"
# require gems
gem 'cucumber'
gem 'webrat'
# generate Cucumber infrastructure
run './script/generate cucumber'
# remove Prototype defaults
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
# add XHTML 1.0 Strict layout, with jQuery from Google
file 'app/views/layouts/application.html.erb', <<-ERB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
/* GitHub Commits, version 0.0.1
* (c) 2009 Jeff Rafter
*
* Based on GitHub Badge by Dr Nic Williams (but with the good code removed)
*
* You need: jquery.js, md5.js
*
* See http://pajhome.org.uk/crypt/md5 for more info.
*
*--------------------------------------------------------------------------*/