Top Level Namespace

Constant Summary collapse

GEMS =
%w(haml compass formtastic decent_exposure)
TEST_GEMS =
%w(rspec rspec-rails capybara)

Instance Method Summary collapse

Instance Method Details

#add_gemfileObject



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_pageObject



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_readmeObject



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_ymlObject



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(message, &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(message)
  git :init
  git_commit message
end

#install_jqueryObject



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_rspecObject



96
97
98
# File 'lib/rails3-template.rb', line 96

def install_rspec
  generate 'rspec:install'
end

#remove_public_filesObject



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