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
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/rails3-template.rb', line 75 def add_gemfile file "Gemfile", <<-RUBY source 'http://gemcutter.org' gem 'rails', '3.0.0' #{GEMS.map{ |gem| gem_def(gem) }.join("\n")} # persistence gem 'sqlite3-ruby', :require => 'sqlite3' group :development, :test do #{TEST_GEMS.map{ |gem| gem_def(gem) }.join("\n ")} # gem 'ruby-debug' # gem 'awesome_print', :require => 'ap' # gem 'wirble' # gem 'hirb' end RUBY end |
#add_landing_page ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rails3-template.rb', line 55 def add_landing_page file "public/index.html", <<-HAML <h1>Welcome to Nozomi</h1> <p>Your app is now ready to customise</p> <p>Here's exactly what Nozomi did to create this project:</p> <pre> #{`git log`} </pre> HAML 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", <<-MARKDOWN README ====== TODO fill out your application documentation MARKDOWN 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: #{}'" 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
66 67 68 69 70 71 72 73 |
# File 'lib/rails3-template.rb', line 66 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
96 97 98 |
# File 'lib/rails3-template.rb', line 96 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 |