rails_apps_composer 2.6.13 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/recipes/prelaunch.rb DELETED
@@ -1,118 +0,0 @@
1
- # Application template recipe for the rails_apps_composer. Change the recipe here:
2
- # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb
3
-
4
- if prefer :railsapps, 'rails-prelaunch-signup'
5
-
6
- after_everything do
7
- say_wizard "recipe running after 'bundle install'"
8
- repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'
9
-
10
- # >-------------------------------[ Clean up starter app ]--------------------------------<
11
-
12
- %w{
13
- public/index.html
14
- app/assets/images/rails.png
15
- }.each { |file| remove_file file }
16
- # remove commented lines and multiple blank lines from Gemfile
17
- # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
18
- gsub_file 'Gemfile', /#.*\n/, "\n"
19
- gsub_file 'Gemfile', /\n^\s*\n/, "\n"
20
- # remove commented lines and multiple blank lines from config/routes.rb
21
- gsub_file 'config/routes.rb', / #.*\n/, "\n"
22
- gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
23
- # GIT
24
- git :add => '-A' if prefer :git, true
25
- git :commit => '-qm "rails_apps_composer: clean up starter app"' if prefer :git, true
26
-
27
- # >-------------------------------[ Create a git branch ]--------------------------------<
28
- if prefer :git, true
29
- if prefer :prelaunch_branch, 'master'
30
- unless prefer :main_branch, 'none'
31
- say_wizard "renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app"
32
- git :branch => "-m master #{prefs[:main_branch]}"
33
- git :checkout => "-b master"
34
- else
35
- say_wizard "creating prelaunch app on git branch 'master'"
36
- end
37
- else
38
- say_wizard "creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app"
39
- git :checkout => "-b #{prefs[:prelaunch_branch]}"
40
- end
41
- end
42
-
43
- # >-------------------------------[ Models ]--------------------------------<
44
-
45
- copy_from_repo 'app/models/user.rb', :repo => repo
46
-
47
- # >-------------------------------[ Init ]--------------------------------<
48
- copy_from_repo 'config/application.yml', :repo => repo
49
- remove_file 'config/application.example.yml'
50
- copy_file destination_root + '/config/application.yml', destination_root + '/config/application.example.yml'
51
- copy_from_repo 'db/seeds.rb', :repo => repo
52
- run 'bundle exec rake db:seed'
53
-
54
- # >-------------------------------[ Controllers ]--------------------------------<
55
-
56
- copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo
57
- copy_from_repo 'app/controllers/home_controller.rb', :repo => repo
58
- copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo
59
- copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
60
-
61
- # >-------------------------------[ Mailers ]--------------------------------<
62
-
63
- generate 'mailer UserMailer'
64
- copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
65
- copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
66
-
67
- # >-------------------------------[ Views ]--------------------------------<
68
-
69
- copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo
70
- copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo
71
- copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo
72
- copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo
73
- copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo
74
- copy_from_repo 'app/views/home/index.html.erb', :repo => repo
75
- copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo
76
- copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo
77
- copy_from_repo 'app/views/users/index.html.erb', :repo => repo
78
- copy_from_repo 'public/thankyou.html', :repo => repo
79
-
80
- # >-------------------------------[ Routes ]--------------------------------<
81
-
82
- copy_from_repo 'config/routes.rb', :repo => repo
83
- ### CORRECT APPLICATION NAME ###
84
- gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
85
-
86
- # >-------------------------------[ Assets ]--------------------------------<
87
-
88
- copy_from_repo 'app/assets/javascripts/application.js', :repo => repo
89
- copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo
90
-
91
- # >-------------------------------[ Cucumber ]--------------------------------<
92
- say_wizard "copying Cucumber scenarios from the rails-prelaunch-signup examples"
93
- copy_from_repo 'features/admin/send_invitations.feature', :repo => repo
94
- copy_from_repo 'features/admin/view_progress.feature', :repo => repo
95
- copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo
96
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
97
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
98
- copy_from_repo 'features/users/user_show.feature', :repo => repo
99
- copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo
100
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
101
- copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo
102
- copy_from_repo 'config/locales/devise.en.yml', :repo => repo
103
-
104
- ### GIT ###
105
- git :add => '-A' if prefer :git, true
106
- git :commit => '-qm "rails_apps_composer: prelaunch app"' if prefer :git, true
107
- end # after_bundler
108
- end # rails-prelaunch-signup
109
-
110
- __END__
111
-
112
- name: prelaunch
113
- description: "Install a prelaunch-signup example application."
114
- author: RailsApps
115
-
116
- requires: [core]
117
- run_after: [setup, gems, models, controllers, views, frontend, init]
118
- category: apps
data/recipes/routes.rb DELETED
@@ -1,53 +0,0 @@
1
- # Application template recipe for the rails_apps_composer. Change the recipe here:
2
- # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb
3
-
4
- after_bundler do
5
- say_wizard "recipe running after 'bundle install'"
6
- ### HOME ###
7
- if prefer :starter_app, 'home_app'
8
- remove_file 'public/index.html'
9
- gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
10
- end
11
- ### USER_ACCOUNTS ###
12
- if ['users_app','admin_app'].include? prefs[:starter_app]
13
- ## DEVISE
14
- if (prefer :authentication, 'devise') and (not prefer :apps4, 'rails-devise')
15
- copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
16
- ## Rails 4.0 doesn't allow two 'root' routes
17
- gsub_file 'config/routes.rb', /authenticated :user do\n.*\n.*\n /, '' if rails_4?
18
- ## accommodate strong parameters in Rails 4
19
- gsub_file 'config/routes.rb', /devise_for :users/, 'devise_for :users, :controllers => {:registrations => "registrations"}' if rails_4?
20
- end
21
- ## OMNIAUTH
22
- if prefer :authentication, 'omniauth'
23
- if rails_4?
24
- copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
25
- else
26
- copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
27
- end
28
- end
29
- end
30
- ### SUBDOMAINS ###
31
- copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
32
- copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
33
- if rails_4_1?
34
- # replaces application name copied from rails3-devise-rspec-cucumber repo
35
- gsub_file 'config/routes.rb', /^.*.routes.draw do/, "Rails.application.routes.draw do"
36
- else
37
- # correct application name
38
- gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
39
- end
40
- ### GIT ###
41
- git :add => '-A' if prefer :git, true
42
- git :commit => '-qm "rails_apps_composer: routes"' if prefer :git, true
43
- end # after_bundler
44
-
45
- __END__
46
-
47
- name: routes
48
- description: "Add routes needed for starter apps."
49
- author: RailsApps
50
-
51
- requires: [setup, gems, models, controllers, views]
52
- run_after: [setup, gems, models, controllers, views]
53
- category: mvc
data/recipes/saas.rb DELETED
@@ -1,216 +0,0 @@
1
- # Application template recipe for the rails_apps_composer. Change the recipe here:
2
- # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/saas.rb
3
-
4
- if prefer :railsapps, 'rails-stripe-membership-saas'
5
-
6
- after_everything do
7
- say_wizard "recipe running after 'bundle install'"
8
- repo = 'https://raw.github.com/RailsApps/rails-stripe-membership-saas/master/'
9
-
10
- # >-------------------------------[ Clean up starter app ]--------------------------------<
11
-
12
- %w{
13
- public/index.html
14
- app/assets/images/rails.png
15
- }.each { |file| remove_file file }
16
- # remove commented lines and multiple blank lines from Gemfile
17
- # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
18
- gsub_file 'Gemfile', /#.*\n/, "\n"
19
- gsub_file 'Gemfile', /\n^\s*\n/, "\n"
20
- # remove commented lines and multiple blank lines from config/routes.rb
21
- gsub_file 'config/routes.rb', / #.*\n/, "\n"
22
- gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
23
- # GIT
24
- git :add => '-A' if prefer :git, true
25
- git :commit => '-qm "rails_apps_composer: clean up starter app"' if prefer :git, true
26
-
27
- # >-------------------------------[ Migrations ]--------------------------------<
28
- generate 'migration AddStripeToUsers customer_id:string last_4_digits:string'
29
- run 'bundle exec rake db:drop'
30
- run 'bundle exec rake db:migrate'
31
-
32
- # >-------------------------------[ Models ]--------------------------------<
33
- copy_from_repo 'app/models/ability.rb', :repo => repo
34
- copy_from_repo 'app/models/user.rb', :repo => repo
35
-
36
- # >-------------------------------[ Init ]--------------------------------<
37
- copy_from_repo 'config/application.yml', :repo => repo
38
- remove_file 'config/application.example.yml'
39
- copy_file destination_root + '/config/application.yml', destination_root + '/config/application.example.yml'
40
- copy_from_repo 'db/seeds.rb', :repo => repo
41
- copy_from_repo 'config/initializers/stripe.rb', :repo => repo
42
- run 'bundle exec rake db:seed'
43
-
44
- # >-------------------------------[ Controllers ]--------------------------------<
45
- copy_from_repo 'app/controllers/home_controller.rb', :repo => repo
46
- generate 'controller content silver gold platinum --skip-assets --skip-helper'
47
- copy_from_repo 'app/controllers/content_controller.rb', :repo => repo
48
- copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo
49
- copy_from_repo 'app/controllers/application_controller.rb', :repo => repo
50
- copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
51
-
52
- # >-------------------------------[ Mailers ]--------------------------------<
53
- generate 'mailer UserMailer'
54
- copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
55
-
56
- # >-------------------------------[ Views ]--------------------------------<
57
- copy_from_repo 'app/views/home/index.html.erb', :repo => repo
58
- copy_from_repo 'app/views/layouts/_navigation.html.erb', :repo => repo
59
- copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo
60
- copy_from_repo 'app/views/devise/registrations/edit.html.erb', :repo => repo
61
- copy_from_repo 'app/views/user_mailer/expire_email.html.erb', :repo => repo
62
- copy_from_repo 'app/views/user_mailer/expire_email.text.erb', :repo => repo
63
-
64
- # >-------------------------------[ Routes ]--------------------------------<
65
- copy_from_repo 'config/routes.rb', :repo => repo
66
- ### CORRECT APPLICATION NAME ###
67
- gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
68
-
69
- # >-------------------------------[ Assets ]--------------------------------<
70
- copy_from_repo 'app/assets/javascripts/application.js', :repo => repo
71
- copy_from_repo 'app/assets/javascripts/jquery.readyselector.js', :repo => repo
72
- copy_from_repo 'app/assets/javascripts/jquery.externalscript.js', :repo => repo
73
- copy_from_repo 'app/assets/javascripts/registrations.js', :repo => repo
74
- copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo
75
- copy_from_repo 'app/assets/stylesheets/pricing.css.scss', :repo => repo
76
-
77
- # >-------------------------------[ RSpec ]--------------------------------<
78
- say_wizard "copying RSpec tests from the rails-stripe-membership-saas examples"
79
- copy_from_repo 'spec/factories/roles.rb', :repo => repo
80
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
81
- copy_from_repo 'spec/controllers/content_controller_spec.rb', :repo => repo
82
- copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
83
- copy_from_repo 'spec/stripe/stripe_config_spec.rb', :repo => repo
84
- copy_from_repo 'spec/support/stripe_helper.rb', :repo => repo
85
- copy_from_repo 'spec/support/fixtures/success.json', :repo => repo
86
-
87
- # >-------------------------------[ Cucumber ]--------------------------------<
88
- say_wizard "copying Cucumber scenarios from the rails-stripe-membership-saas examples"
89
- remove_file 'features/users/user_show.feature'
90
- copy_from_repo 'features/support/paths.rb', :repo => repo
91
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
92
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
93
- copy_from_repo 'features/users/sign_up_with_stripe.feature', :repo => repo
94
- copy_from_repo 'features/users/user_edit.feature', :repo => repo
95
- copy_from_repo 'features/users/user_delete.feature', :repo => repo
96
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
97
- copy_from_repo 'features/step_definitions/form_helper_steps.rb', :repo => repo
98
- copy_from_repo 'config/locales/devise.en.yml', :repo => repo
99
-
100
- ### GIT ###
101
- git :add => '-A' if prefer :git, true
102
- git :commit => '-qm "rails_apps_composer: membership app"' if prefer :git, true
103
- end # after_bundler
104
- end # rails-stripe-membership-saas
105
-
106
- if prefer :railsapps, 'rails-recurly-subscription-saas'
107
-
108
- after_everything do
109
- say_wizard "recipe running after 'bundle install'"
110
- repo = 'https://raw.github.com/RailsApps/rails-recurly-subscription-saas/master/'
111
-
112
- # >-------------------------------[ Clean up starter app ]--------------------------------<
113
-
114
- %w{
115
- public/index.html
116
- app/assets/images/rails.png
117
- }.each { |file| remove_file file }
118
- # remove commented lines and multiple blank lines from Gemfile
119
- # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
120
- gsub_file 'Gemfile', /#.*\n/, "\n"
121
- gsub_file 'Gemfile', /\n^\s*\n/, "\n"
122
- # remove commented lines and multiple blank lines from config/routes.rb
123
- gsub_file 'config/routes.rb', / #.*\n/, "\n"
124
- gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
125
- # GIT
126
- git :add => '-A' if prefer :git, true
127
- git :commit => '-qm "rails_apps_composer: clean up starter app"' if prefer :git, true
128
-
129
- # >-------------------------------[ Migrations ]--------------------------------<
130
- generate 'migration AddRecurlyToUsers first_name:string last_name:string customer_id:string'
131
- run 'bundle exec rake db:drop'
132
- run 'bundle exec rake db:migrate'
133
-
134
- # >-------------------------------[ Models ]--------------------------------<
135
- copy_from_repo 'app/models/ability.rb', :repo => repo
136
- copy_from_repo 'app/models/user.rb', :repo => repo
137
-
138
- # >-------------------------------[ Init ]--------------------------------<
139
- copy_from_repo 'config/application.yml', :repo => repo
140
- remove_file 'config/application.example.yml'
141
- copy_file destination_root + '/config/application.yml', destination_root + '/config/application.example.yml'
142
- copy_from_repo 'db/seeds.rb', :repo => repo
143
- copy_from_repo 'config/initializers/recurly.rb', :repo => repo
144
- run 'bundle exec rake db:seed'
145
-
146
- # >-------------------------------[ Controllers ]--------------------------------<
147
- copy_from_repo 'app/controllers/home_controller.rb', :repo => repo
148
- generate 'controller content silver gold platinum --skip-assets --skip-helper'
149
- copy_from_repo 'app/controllers/content_controller.rb', :repo => repo
150
- copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo
151
- copy_from_repo 'app/controllers/application_controller.rb', :repo => repo
152
- copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
153
- copy_from_repo 'app/controllers/recurly_controller.rb', :repo => repo
154
-
155
- # >-------------------------------[ Mailers ]--------------------------------<
156
- generate 'mailer UserMailer'
157
- copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
158
-
159
- # >-------------------------------[ Views ]--------------------------------<
160
- copy_from_repo 'app/views/home/index.html.erb', :repo => repo
161
- copy_from_repo 'app/views/layouts/_navigation.html.erb', :repo => repo
162
- copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo
163
- copy_from_repo 'app/views/devise/registrations/edit.html.erb', :repo => repo
164
- copy_from_repo 'app/views/user_mailer/expire_email.html.erb', :repo => repo
165
- copy_from_repo 'app/views/user_mailer/expire_email.text.erb', :repo => repo
166
-
167
- # >-------------------------------[ Routes ]--------------------------------<
168
- copy_from_repo 'config/routes.rb', :repo => repo
169
- ### CORRECT APPLICATION NAME ###
170
- gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
171
-
172
- # >-------------------------------[ Assets ]--------------------------------<
173
- copy_from_repo 'app/assets/javascripts/application.js', :repo => repo
174
- copy_from_repo 'app/assets/javascripts/jquery.readyselector.js', :repo => repo
175
- copy_from_repo 'app/assets/javascripts/recurly.js', :repo => repo
176
- copy_from_repo 'app/assets/javascripts/registrations.js', :repo => repo
177
- copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo
178
- copy_from_repo 'app/assets/stylesheets/pricing.css.scss', :repo => repo
179
-
180
- # >-------------------------------[ RSpec ]--------------------------------<
181
- say_wizard "copying RSpec tests from the rails-recurly-subscription-saas examples"
182
- copy_from_repo 'spec/factories/roles.rb', :repo => repo
183
- copy_from_repo 'spec/factories/users.rb', :repo => repo
184
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
185
- copy_from_repo 'spec/controllers/content_controller_spec.rb', :repo => repo
186
- copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
187
- copy_from_repo 'spec/recurly/recurly_config_spec.rb', :repo => repo
188
-
189
- # >-------------------------------[ Cucumber ]--------------------------------<
190
- say_wizard "copying Cucumber scenarios from the rails-recurly-subscription-saas examples"
191
- remove_file 'features/users/user_show.feature'
192
- copy_from_repo 'features/support/paths.rb', :repo => repo
193
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
194
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
195
- copy_from_repo 'features/users/sign_up_with_recurly.feature', :repo => repo
196
- copy_from_repo 'features/users/user_edit.feature', :repo => repo
197
- copy_from_repo 'features/users/user_delete.feature', :repo => repo
198
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
199
- copy_from_repo 'features/step_definitions/form_helper_steps.rb', :repo => repo
200
- copy_from_repo 'config/locales/devise.en.yml', :repo => repo
201
-
202
- ### GIT ###
203
- git :add => '-A' if prefer :git, true
204
- git :commit => '-qm "rails_apps_composer: membership app"' if prefer :git, true
205
- end # after_bundler
206
- end # rails-recurly-subscription-saas
207
-
208
- __END__
209
-
210
- name: prelaunch
211
- description: "Install an example application for a membership site."
212
- author: RailsApps
213
-
214
- requires: [core]
215
- run_after: [setup, gems, models, controllers, views, frontend, init]
216
- category: apps
data/recipes/testing.rb DELETED
@@ -1,276 +0,0 @@
1
- # Application template recipe for the rails_apps_composer. Change the recipe here:
2
- # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb
3
-
4
- after_bundler do
5
- say_wizard "recipe running after 'bundle install'"
6
- ### TEST/UNIT ###
7
- if prefer :unit_test, 'test_unit'
8
- inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
9
-
10
- config.generators do |g|
11
- #{"g.test_framework :test_unit, fixture_replacement: :fabrication" if prefer :fixtures, 'fabrication'}
12
- #{"g.fixture_replacement :fabrication, dir: 'test/fabricators'" if prefer :fixtures, 'fabrication'}
13
- end
14
-
15
- RUBY
16
- end
17
- end
18
- ### RSPEC ###
19
- if prefer :unit_test, 'rspec'
20
- say_wizard "recipe installing RSpec"
21
- generate 'rspec:install'
22
- copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
23
- generate 'email_spec:steps' if prefer :integration, 'cucumber'
24
- inject_into_file 'spec/spec_helper.rb', "require 'email_spec'\n", :after => "require 'rspec/rails'\n"
25
- inject_into_file 'spec/spec_helper.rb', :after => "RSpec.configure do |config|\n" do <<-RUBY
26
- config.include(EmailSpec::Helpers)
27
- config.include(EmailSpec::Matchers)
28
- RUBY
29
- end
30
- run 'rm -rf test/' # Removing test folder (not needed for RSpec)
31
- inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
32
-
33
- # don't generate RSpec tests for views and helpers
34
- config.generators do |g|
35
- #{"g.test_framework :rspec" if prefer :fixtures, 'none'}
36
- #{"g.test_framework :rspec, fixture: true" unless prefer :fixtures, 'none'}
37
- #{"g.fixture_replacement :factory_girl, dir: 'spec/factories'" if prefer :fixtures, 'factory_girl'}
38
- #{"g.fixture_replacement :machinist" if prefer :fixtures, 'machinist'}
39
- #{"g.fixture_replacement :fabrication" if prefer :fixtures, 'fabrication'}
40
- g.view_specs false
41
- g.helper_specs false
42
- end
43
-
44
- RUBY
45
- end
46
- ## RSPEC AND MONGOID
47
- if prefer :orm, 'mongoid'
48
- # remove ActiveRecord artifacts
49
- gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
50
- gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
51
- # remove either possible occurrence of "require rails/test_unit/railtie"
52
- gsub_file 'config/application.rb', /require 'rails\/test_unit\/railtie'/, '# require "rails/test_unit/railtie"'
53
- gsub_file 'config/application.rb', /require "rails\/test_unit\/railtie"/, '# require "rails/test_unit/railtie"'
54
- # configure RSpec to use matchers from the mongoid-rspec gem
55
- create_file 'spec/support/mongoid.rb' do
56
- <<-RUBY
57
- RSpec.configure do |config|
58
- config.include Mongoid::Matchers
59
- end
60
- RUBY
61
- end
62
- end
63
- ## RSPEC AND DEVISE
64
- if prefer :authentication, 'devise'
65
- # add Devise test helpers
66
- create_file 'spec/support/devise.rb' do
67
- <<-RUBY
68
- RSpec.configure do |config|
69
- config.include Devise::TestHelpers, :type => :controller
70
- end
71
- RUBY
72
- end
73
- end
74
- end
75
- ### CUCUMBER ###
76
- if prefer :integration, 'cucumber'
77
- say_wizard "recipe installing Cucumber"
78
- generate "cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}"
79
- # make it easy to run Cucumber for single features without adding "--require features" to the command line
80
- gsub_file 'config/cucumber.yml', /std_opts = "/, 'std_opts = "-r features/support/ -r features/step_definitions '
81
- create_file 'features/support/email_spec.rb' do <<-RUBY
82
- require 'email_spec/cucumber'
83
- RUBY
84
- end
85
- ## CUCUMBER AND MONGOID
86
- if prefer :orm, 'mongoid'
87
- gsub_file 'features/support/env.rb', /transaction/, "truncation"
88
- inject_into_file 'features/support/env.rb', :after => 'begin' do
89
- "\n DatabaseCleaner.orm = 'mongoid'"
90
- end
91
- end
92
- generate 'fabrication:cucumber_steps' if prefer :fixtures, 'fabrication'
93
- end
94
- ## TURNIP
95
- if prefer :integration, 'turnip'
96
- append_file '.rspec', '-r turnip/rspec'
97
- inject_into_file 'spec/spec_helper.rb', "require 'turnip/capybara'\n", :after => "require 'rspec/rails'\n"
98
- create_file 'spec/acceptance/steps/.gitkeep'
99
- end
100
- ## FIXTURE REPLACEMENTS
101
- if prefer :fixtures, 'machinist'
102
- say_wizard "generating blueprints file for 'machinist'"
103
- generate 'machinist:install'
104
- end
105
- ### GUARD
106
- if prefer :continuous_testing, 'guard'
107
- say_wizard "recipe initializing Guard"
108
- run 'bundle exec guard init'
109
- end
110
- ### GIT ###
111
- git :add => '-A' if prefer :git, true
112
- git :commit => '-qm "rails_apps_composer: testing framework"' if prefer :git, true
113
- end # after_bundler
114
-
115
- after_everything do
116
- say_wizard "recipe running after everything"
117
- ### RSPEC ###
118
- if prefer :unit_test, 'rspec'
119
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')
120
- say_wizard "copying RSpec files from the rails3-devise-rspec-cucumber examples"
121
- repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
122
- copy_from_repo 'spec/factories/users.rb', :repo => repo
123
- gsub_file 'spec/factories/users.rb', /# confirmed_at/, "confirmed_at" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
124
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
125
- copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
126
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
127
- remove_file 'spec/views/home/index.html.erb_spec.rb'
128
- remove_file 'spec/views/home/index.html.haml_spec.rb'
129
- remove_file 'spec/views/users/show.html.erb_spec.rb'
130
- remove_file 'spec/views/users/show.html.haml_spec.rb'
131
- remove_file 'spec/helpers/home_helper_spec.rb'
132
- remove_file 'spec/helpers/users_helper_spec.rb'
133
- end
134
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')
135
- say_wizard "copying RSpec files from the rails3-bootstrap-devise-cancan examples"
136
- repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
137
- copy_from_repo 'spec/factories/users.rb', :repo => repo
138
- gsub_file 'spec/factories/users.rb', /# confirmed_at/, "confirmed_at" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
139
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
140
- copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
141
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
142
- remove_file 'spec/views/home/index.html.erb_spec.rb'
143
- remove_file 'spec/views/home/index.html.haml_spec.rb'
144
- remove_file 'spec/views/users/show.html.erb_spec.rb'
145
- remove_file 'spec/views/users/show.html.haml_spec.rb'
146
- remove_file 'spec/helpers/home_helper_spec.rb'
147
- remove_file 'spec/helpers/users_helper_spec.rb'
148
- end
149
- ## RSPEC AND OMNIAUTH
150
- if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')
151
- say_wizard "copying RSpec files from the rails3-mongoid-omniauth examples"
152
- repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
153
- copy_from_repo 'spec/factories/users.rb', :repo => repo
154
- copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo
155
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
156
- copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
157
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
158
- end
159
- ## SUBDOMAINS
160
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')
161
- say_wizard "copying RSpec files from the rails3-subdomains examples"
162
- repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
163
- copy_from_repo 'spec/factories/users.rb', :repo => repo
164
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
165
- copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
166
- copy_from_repo 'spec/models/user_spec.rb', :repo => repo
167
- end
168
- ## GIT
169
- git :add => '-A' if prefer :git, true
170
- git :commit => '-qm "rails_apps_composer: rspec files"' if prefer :git, true
171
- end
172
- ### CUCUMBER ###
173
- if prefer :integration, 'cucumber'
174
- ## CUCUMBER AND DEVISE (USERS APP)
175
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')
176
- say_wizard "copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples"
177
- repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
178
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
179
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
180
- copy_from_repo 'features/users/sign_out.feature', :repo => repo
181
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
182
- copy_from_repo 'features/users/user_edit.feature', :repo => repo
183
- copy_from_repo 'features/users/user_show.feature', :repo => repo
184
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
185
- copy_from_repo 'features/support/paths.rb', :repo => repo
186
- if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
187
- gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, "A message with a confirmation link has been sent to your email address."
188
- inject_into_file 'features/users/sign_in.feature', :before => ' Scenario: User signs in successfully' do
189
- <<-RUBY
190
- Scenario: User has not confirmed account
191
- Given I exist as an unconfirmed user
192
- And I am not logged in
193
- When I sign in with valid credentials
194
- Then I see an unconfirmed account message
195
- And I should be signed out
196
- RUBY
197
- end
198
- end
199
- end
200
- ## CUCUMBER AND DEVISE (ADMIN APP)
201
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')
202
- say_wizard "copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples"
203
- repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
204
- copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
205
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
206
- copy_from_repo 'features/users/sign_out.feature', :repo => repo
207
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
208
- copy_from_repo 'features/users/user_edit.feature', :repo => repo
209
- copy_from_repo 'features/users/user_show.feature', :repo => repo
210
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
211
- copy_from_repo 'features/support/paths.rb', :repo => repo
212
- if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
213
- gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, "A message with a confirmation link has been sent to your email address."
214
- inject_into_file 'features/users/sign_in.feature', :before => ' Scenario: User signs in successfully' do
215
- <<-RUBY
216
- Scenario: User has not confirmed account
217
- Given I exist as an unconfirmed user
218
- And I am not logged in
219
- When I sign in with valid credentials
220
- Then I see an unconfirmed account message
221
- And I should be signed out
222
- RUBY
223
- end
224
- end
225
- end
226
- ## CUCUMBER AND DEVISE (SUBDOMAINS APP)
227
- if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')
228
- say_wizard "copying RSpec files from the rails3-subdomains examples"
229
- repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
230
- copy_from_repo 'features/users/sign_in.feature', :repo => repo
231
- copy_from_repo 'features/users/sign_out.feature', :repo => repo
232
- copy_from_repo 'features/users/sign_up.feature', :repo => repo
233
- copy_from_repo 'features/users/user_edit.feature', :repo => repo
234
- copy_from_repo 'features/users/user_show.feature', :repo => repo
235
- copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
236
- copy_from_repo 'features/support/paths.rb', :repo => repo
237
- end
238
- ## GIT
239
- git :add => '-A' if prefer :git, true
240
- git :commit => '-qm "rails_apps_composer: cucumber files"' if prefer :git, true
241
- end
242
- ### FABRICATION ###
243
- if prefer :fixtures, 'fabrication'
244
- say_wizard "replacing FactoryGirl fixtures with Fabrication"
245
- remove_file 'spec/factories/users.rb'
246
- remove_file 'spec/fabricators/user_fabricator.rb'
247
- create_file 'spec/fabricators/user_fabricator.rb' do
248
- <<-RUBY
249
- Fabricator(:user) do
250
- name 'Test User'
251
- email 'example@example.com'
252
- password 'changeme'
253
- password_confirmation 'changeme'
254
- # required if the Devise Confirmable module is used
255
- # confirmed_at Time.now
256
- end
257
- RUBY
258
- end
259
- if prefer :integration, 'cucumber'
260
- gsub_file 'features/step_definitions/user_steps.rb', /@user = FactoryGirl.create\(:user, email: @visitor\[:email\]\)/, '@user = Fabricate(:user, email: @visitor[:email])'
261
- end
262
- if File.exist?('spec/controllers/users_controller_spec.rb')
263
- gsub_file 'spec/controllers/users_controller_spec.rb', /@user = FactoryGirl.create\(:user\)/, '@user = Fabricate(:user)'
264
- end
265
- end
266
- end # after_everything
267
-
268
- __END__
269
-
270
- name: testing
271
- description: "Add testing framework."
272
- author: RailsApps
273
-
274
- requires: [setup, gems]
275
- run_after: [setup, gems]
276
- category: testing