Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 149 lines (120 sloc) 2.962 kB
004f0a9 @joshuaclayton Initial
joshuaclayton authored
1 files_to_remove = %w(
2 README
3 Gemfile
4 public/index.html
5 app/assets/images/rails.png
6 config/database.yml
7 )
8 run "rm #{files_to_remove.join(' ')}"
9
10 file "README", "Pixtr"
11
12 file "Gemfile", <<-EOF
13 source :rubygems
14
15 gem 'rails', '~> 3.1.1'
16 gem 'pg'
17
18 gem 'clearance'
19 gem 'jquery-rails'
20 gem 'flutie'
21 gem 'formtastic'
22 gem 'haml'
23 gem 'high_voltage'
24 gem 'hoptoad_notifier'
25 gem 'paperclip'
26
27 group :development, :test do
28 gem 'rspec-rails'
29 end
30
31 group :assets do
32 gem "uglifier"
33 end
34
35 group :test do
36 gem 'cucumber-rails'
37 gem 'cucumber-rails-training-wheels'
38 gem 'factory_girl_rails'
39 gem 'bourne'
40 gem 'capybara'
41 gem 'database_cleaner'
42 gem 'timecop'
43 gem 'launchy'
44 gem 'shoulda'
45 end
46 EOF
47
48 file "config/database.yml", <<-EOF
49 development:
50 adapter: postgresql
51 encoding: unicode
52 database: pixtr_development
53 pool: 5
54 min_messages: warning
55
56 test:
57 adapter: postgresql
58 encoding: unicode
59 database: pixtr_test
60 pool: 5
61 min_messages: warning
62
63 production:
64 adapter: postgresql
65 encoding: unicode
66 database: pixtr_production
67 pool: 5
68 EOF
69
70 run "bundle"
71
72 file ".rspec", "--colour"
73 inside "spec" do
74 file "spec_helper.rb", <<-EOF
75 ENV["RAILS_ENV"] ||= 'test'
76 require File.expand_path("../../config/environment", __FILE__)
77 require 'rspec/rails'
78 require 'shoulda'
79 require 'paperclip/matchers'
80
81 Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
82
83 RSpec.configure do |config|
84 config.mock_with :mocha
85 config.use_transactional_fixtures = true
86 config.include Paperclip::Shoulda::Matchers
87 end
88 EOF
89 end
90
91 generate("cucumber:install", "--rspec --capybara")
92 generate("cucumber_rails_training_wheels:install")
93
94 rake "db:create"
95 rake "db:migrate"
96
97 generate("clearance:install")
98 generate("clearance:features")
99
100 rake "db:migrate"
101 rake "db:test:prepare"
102
103 rake "flutie:install"
104
105 inside "app/views/pages" do
106 file "home.html.erb", "<h1>Pixtr</h1>"
107 end
108 route "root :to => 'high_voltage/pages#show', :id => 'home'"
109
110 inside "features/support" do
111 file "capybara.rb", "Capybara.save_and_open_page_path = 'tmp'"
112 end
113
114 def insert(at, file, text)
115 lines = File.readlines(file)
116 lines.insert at, "#{text}\n"
117 File.open(file, "w") { |f| f.write lines.join }
118 end
119
120 insert -6, "app/views/layouts/application.html.erb", <<-EOF
121 <% flash.each do |key, value| -%>
122 <div class="flash <%= key %>"><%= value %></div>
123 <% end -%>
124
125 <% if signed_in? %>
126 <%= link_to "Sign out", sign_out_path, :method => :delete %>
127 <% else %>
128 <%= link_to "Sign in", sign_in_path %>
129 <%= link_to "Sign up", sign_up_path %>
130 <% end %>
131 EOF
132
133 insert -2, "config/environments/development.rb", <<-EOF
134 config.action_mailer.default_url_options = { :host => "localhost:3000" }
135 EOF
136
137 insert -2, "config/environments/test.rb", <<-EOF
138 config.action_mailer.default_url_options = { :host => "example.com" }
139 EOF
140
141 insert -1, "Rakefile", <<-EOF
142 task(:default).clear
143 task :default => [:spec, :cucumber]
144 EOF
145
146 git :init
147 git :add => '.'
148 git :commit => "-m 'Initial commit'"
Something went wrong with that request. Please try again.