Top Level Namespace

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#add_gemfileObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/rails3-template.rb', line 59

def add_gemfile
  file "Gemfile", <<-RUBY
# TODO shouldn't this be gemcutter?
source 'http://rubygems.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_readmeObject



39
40
41
42
43
44
45
46
47
# File 'lib/rails3-template.rb', line 39

def add_readme
  run "rm README"
  file "README.markdown", <<-MARKDOWN
README
======

TODO fill out your application documentation
  MARKDOWN
end

#copy_db_ymlObject



29
30
31
# File 'lib/rails3-template.rb', line 29

def copy_db_yml
  run 'cp config/database.yml config/database.example.yml'
end

#gem_def(gem_name) ⇒ Object



13
14
15
# File 'lib/rails3-template.rb', line 13

def gem_def(gem_name)
  "gem '#{gem_name}'"
end

#git_commit(message, &block) ⇒ Object



17
18
19
20
21
# File 'lib/rails3-template.rb', line 17

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



24
25
26
27
# File 'lib/rails3-template.rb', line 24

def initial_git_commit(message)
  git :init
  git_commit message
end

#install_jqueryObject



49
50
51
52
53
54
55
56
57
# File 'lib/rails3-template.rb', line 49

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
    result = run "wget --output-document=#{filename} #{url}"
    raise "Cannot download jquery. Please check your internet connection..." unless result == 0
  end
end

#remove_public_filesObject



33
34
35
36
37
# File 'lib/rails3-template.rb', line 33

def remove_public_files
  %w{index.html favicon.ico}.each do |f|
    run "rm public/#{f}"
  end
end