Top Level Namespace
Constant Summary collapse
- GEMS =
%w(haml compass formtastic decent_exposure)
- TEST_GEMS =
%w(rspec rspec-rails capybara)
Instance Method Summary collapse
- #add_gemfile ⇒ Object
- #add_landing_page ⇒ Object
- #add_readme ⇒ Object
- #copy_db_yml ⇒ Object
- #gem_def(gem_name) ⇒ Object
- #git_commit(message, &block) ⇒ Object
-
#initial_git_commit(message) ⇒ Object
init the repo and commit the rails generated files to git.
- #install_jquery ⇒ Object
- #install_rspec ⇒ Object
- #remove_public_files ⇒ Object
Instance Method Details
#add_gemfile ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rails3-template.rb', line 71 def add_gemfile file "Gemfile", "source 'http://gemcutter.org'\n\ngem 'rails', '3.0.0'\n\#{GEMS.map{ |gem| gem_def(gem) }.join(\"\\n\")}\n\n# persistence\ngem 'sqlite3-ruby', :require => 'sqlite3'\n\ngroup :development, :test do\n\#{TEST_GEMS.map{ |gem| gem_def(gem) }.join(\"\\n \")}\n\n# gem 'ruby-debug'\n# gem 'awesome_print', :require => 'ap'\n# gem 'wirble'\n# gem 'hirb'\nend\n" end |
#add_landing_page ⇒ Object
55 56 57 58 59 60 |
# File 'lib/rails3-template.rb', line 55 def add_landing_page file "public/index.html", "<h1>Welcome to Nozomi</h1>\n<p>Your app is now ready to customise</p>\n" end |
#add_readme ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/rails3-template.rb', line 45 def add_readme git :rm => "README" file "README.markdown", "README\n======\n\nTODO fill out your application documentation\n" end |
#copy_db_yml ⇒ Object
35 36 37 |
# File 'lib/rails3-template.rb', line 35 def copy_db_yml run 'cp config/database.yml config/database.example.yml' end |
#gem_def(gem_name) ⇒ Object
19 20 21 |
# File 'lib/rails3-template.rb', line 19 def gem_def(gem_name) "gem '#{gem_name}'" end |
#git_commit(message, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/rails3-template.rb', line 23 def git_commit(, &block) yield if block git :add => '.' git :commit => "-m'Nozomi: #{message}'" end |
#initial_git_commit(message) ⇒ Object
init the repo and commit the rails generated files to git
30 31 32 33 |
# File 'lib/rails3-template.rb', line 30 def initial_git_commit() git :init git_commit end |
#install_jquery ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/rails3-template.rb', line 62 def install_jquery filename = "jquery-1.4.2.min.js" url = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" run 'mkdir -p public/javascripts/vendor' inside('public/javascripts/vendor') do run "wget --output-document=#{filename} #{url}" end end |
#install_rspec ⇒ Object
92 93 94 |
# File 'lib/rails3-template.rb', line 92 def install_rspec generate 'rspec:install' end |
#remove_public_files ⇒ Object
39 40 41 42 43 |
# File 'lib/rails3-template.rb', line 39 def remove_public_files %w{index.html favicon.ico}.each do |f| git :rm => "public/#{f}" end end |