suspenders 1.55.1 → 1.56.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CONTRIBUTING.md +1 -1
  4. data/NEWS.md +28 -1
  5. data/README.md +4 -11
  6. data/bin/suspenders +29 -2
  7. data/lib/suspenders/actions/strip_comments_action.rb +254 -0
  8. data/lib/suspenders/actions.rb +1 -1
  9. data/lib/suspenders/app_builder.rb +13 -11
  10. data/lib/suspenders/exit_on_failure.rb +19 -0
  11. data/lib/suspenders/generators/app_generator.rb +21 -14
  12. data/lib/suspenders/generators/base.rb +1 -0
  13. data/lib/suspenders/generators/json_generator.rb +4 -0
  14. data/lib/suspenders/generators/production/email_generator.rb +2 -2
  15. data/lib/suspenders/generators/testing_generator.rb +1 -2
  16. data/lib/suspenders/version.rb +1 -1
  17. data/lib/suspenders.rb +2 -1
  18. data/templates/descriptions/testing.md +1 -1
  19. data/templates/errors.rb +1 -0
  20. data/templates/oj.rb +3 -0
  21. data/templates/partials/email_smtp.rb +2 -2
  22. data/templates/partials/pull_requests_config.rb +5 -4
  23. data/templates/postgresql_database.yml.erb +1 -0
  24. metadata +53 -95
  25. data/.gitignore +0 -5
  26. data/.standard.yml +0 -2
  27. data/.travis.yml +0 -15
  28. data/Gemfile +0 -3
  29. data/Rakefile +0 -9
  30. data/USAGE +0 -13
  31. data/bin/rake +0 -16
  32. data/bin/rspec +0 -16
  33. data/bin/setup +0 -13
  34. data/lib/suspenders/generators/preloader_generator.rb +0 -122
  35. data/spec/adapters/heroku_spec.rb +0 -98
  36. data/spec/expand_json_spec.rb +0 -89
  37. data/spec/fakes/bin/heroku +0 -5
  38. data/spec/fakes/bin/hub +0 -5
  39. data/spec/features/advisories_spec.rb +0 -24
  40. data/spec/features/api_spec.rb +0 -18
  41. data/spec/features/ci_spec.rb +0 -31
  42. data/spec/features/cli_help_spec.rb +0 -36
  43. data/spec/features/db_optimizations_spec.rb +0 -19
  44. data/spec/features/github_spec.rb +0 -16
  45. data/spec/features/heroku_spec.rb +0 -64
  46. data/spec/features/inline_svg_spec.rb +0 -10
  47. data/spec/features/json_spec.rb +0 -15
  48. data/spec/features/lint_spec.rb +0 -26
  49. data/spec/features/new_project_spec.rb +0 -321
  50. data/spec/features/preloader_spec.rb +0 -25
  51. data/spec/features/production/compression_spec.rb +0 -23
  52. data/spec/features/production/deployment_spec.rb +0 -22
  53. data/spec/features/production/email_spec.rb +0 -47
  54. data/spec/features/production/manifest_spec.rb +0 -37
  55. data/spec/features/production/single_redirect_spec.rb +0 -25
  56. data/spec/features/profiler_spec.rb +0 -20
  57. data/spec/features/runner_spec.rb +0 -30
  58. data/spec/features/staging/pull_requests_spec.rb +0 -22
  59. data/spec/features/static_spec.rb +0 -17
  60. data/spec/features/stylelint_spec.rb +0 -60
  61. data/spec/spec_helper.rb +0 -21
  62. data/spec/support/be_executable_matcher.rb +0 -7
  63. data/spec/support/contain_json_matcher.rb +0 -30
  64. data/spec/support/exist_as_a_file_matcher.rb +0 -7
  65. data/spec/support/fake_github.rb +0 -21
  66. data/spec/support/fake_heroku.rb +0 -53
  67. data/spec/support/generators.rb +0 -5
  68. data/spec/support/match_contents_matcher.rb +0 -6
  69. data/spec/support/project_files.rb +0 -25
  70. data/spec/support/rails_template.rb +0 -1
  71. data/spec/support/suspenders.rb +0 -184
  72. data/suspenders.gemspec +0 -35
  73. data/templates/descriptions/preloader.md +0 -3
  74. data/templates/spring.rb +0 -6
data/spec/fakes/bin/hub DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(File.join("..", "..", "support", "fake_github"), File.dirname(__FILE__))
4
-
5
- FakeGithub.new(ARGV).run!
@@ -1,24 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:advisories", type: :generator do
4
- it "configures bundler-audit" do
5
- with_app { generate("suspenders:advisories") }
6
-
7
- run_in_project do
8
- expect(`rake -T`).to include("rake bundle:audit")
9
- end
10
- expect("lib/tasks/bundler_audit.rake").to \
11
- match_contents(/Bundler::Audit::Task.new/)
12
- expect("Gemfile").to match_contents(/bundler-audit/)
13
- end
14
-
15
- it "removes bundler-audit" do
16
- with_app { destroy("suspenders:advisories") }
17
-
18
- expect("Gemfile").not_to match_contents(/bundler-audit/)
19
- expect("lib/tasks/bundler_audit.rake").not_to exist_as_a_file
20
- run_in_project do
21
- expect(`rake -T`).not_to include("rake bundle:audit")
22
- end
23
- end
24
- end
@@ -1,18 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "Suspend a new project with --api flag" do
4
- before(:all) do
5
- drop_dummy_database
6
- remove_project_directory
7
- end
8
-
9
- it "ensures project specs pass" do
10
- run_suspenders("--api")
11
-
12
- Dir.chdir(project_path) do
13
- Bundler.with_unbundled_env do
14
- expect(`rake`).to include("0 failures")
15
- end
16
- end
17
- end
18
- end
@@ -1,31 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:ci", type: :generator do
4
- it "configures Circle with SimpleCov" do
5
- with_app { generate("suspenders:ci") }
6
-
7
- expect("Gemfile").to match_contents(/simplecov/)
8
- expect("test/test_helper.rb").to match_contents(/SimpleCov.coverage_dir/)
9
- expect("test/test_helper.rb").to match_contents(/SimpleCov.start/)
10
- expect("circle.yml").to exist_as_a_file
11
- end
12
-
13
- it "removes Circle and SimpleCov" do
14
- with_app { destroy("suspenders:ci") }
15
-
16
- expect("circle.yml").not_to exist_as_a_file
17
- expect("test/test_helper.rb").not_to match_contents(/SimpleCov/)
18
- expect("Gemfile").not_to match_contents(/simplecov/)
19
- end
20
-
21
- it "configures RSpec" do
22
- with_app do
23
- copy_file "spec_helper.rb", "spec/spec_helper.rb"
24
-
25
- generate("suspenders:ci")
26
- end
27
-
28
- expect("spec/spec_helper.rb").to match_contents(/SimpleCov.coverage_dir/)
29
- expect("spec/spec_helper.rb").to match_contents(/SimpleCov.start/)
30
- end
31
- end
@@ -1,36 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "Command line help output" do
4
- let(:help_text) { suspenders_help_command }
5
-
6
- it "does not contain the default rails usage statement" do
7
- expect(help_text).not_to include("rails new APP_PATH [options]")
8
- end
9
-
10
- it "provides the correct usage statement for suspenders" do
11
- expect(help_text).to include <<~EOH
12
- Usage:
13
- suspenders APP_PATH [options]
14
- EOH
15
- end
16
-
17
- it "does not contain the default rails group" do
18
- expect(help_text).not_to include("Rails options:")
19
- end
20
-
21
- it "provides help and version usage within the suspenders group" do
22
- expect(help_text).to include <<~EOH
23
- Suspenders options:
24
- -h, [--help], [--no-help] # Show this help message and quit
25
- -v, [--version], [--no-version] # Show Suspenders version number and quit
26
- EOH
27
- end
28
-
29
- it "does not show the default extended rails help section" do
30
- expect(help_text).not_to include("Create suspenders files for app generator.")
31
- end
32
-
33
- it "contains the usage statement from the suspenders gem" do
34
- expect(help_text).to include IO.read(usage_file)
35
- end
36
- end
@@ -1,19 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:db_optimizations", type: :generator do
4
- it "configures bullet" do
5
- with_app { generate("suspenders:db_optimizations") }
6
-
7
- expect("Gemfile").to match_contents(/bullet/)
8
- expect("config/environments/development.rb").to \
9
- match_contents(/Bullet.enable/)
10
- end
11
-
12
- it "removes bullet" do
13
- with_app { destroy("suspenders:db_optimizations") }
14
-
15
- expect("Gemfile").not_to match_contents(/bullet/)
16
- expect("config/environments/development.rb").not_to \
17
- match_contents(/Bullet.enable/)
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "GitHub" do
4
- before do
5
- drop_dummy_database
6
- remove_project_directory
7
- end
8
-
9
- it "suspends a project with --github option" do
10
- repo_name = "test"
11
- run_suspenders("--github=#{repo_name}")
12
- setup_app_dependencies
13
-
14
- expect(FakeGithub).to have_created_repo(repo_name)
15
- end
16
- end
@@ -1,64 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "Heroku" do
4
- context "--heroku" do
5
- before(:all) do
6
- clean_up
7
- run_suspenders("--heroku=true")
8
- setup_app_dependencies
9
- end
10
-
11
- it "suspends a project for Heroku" do
12
- app_name = SuspendersTestHelpers::APP_NAME.dasherize
13
-
14
- expect(FakeHeroku).to have_created_app_for("staging")
15
- expect(FakeHeroku).to have_created_app_for("production")
16
- expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
17
- expect(FakeHeroku).to have_configured_vars(
18
- "production",
19
- "SECRET_KEY_BASE"
20
- )
21
- %w[staging production].each do |env|
22
- expect(FakeHeroku).to have_configured_vars(env, "APPLICATION_HOST")
23
- expect(FakeHeroku).to have_configured_vars(env, "HONEYBADGER_ENV")
24
- end
25
- expect(FakeHeroku).to have_setup_pipeline_for(app_name)
26
-
27
- bin_setup_path = "#{project_path}/bin/setup"
28
- bin_setup = IO.read(bin_setup_path)
29
-
30
- expect(bin_setup).to assert_access_to_heroku_app("#{app_name}-production")
31
- expect(bin_setup).to assert_access_to_heroku_app("#{app_name}-staging")
32
- expect(bin_setup).to match(/^git config heroku.remote staging/)
33
- expect("bin/setup").to be_executable
34
-
35
- readme = IO.read("#{project_path}/README.md")
36
-
37
- expect(readme).to include("./bin/deploy staging")
38
- expect(readme).to include("./bin/deploy production")
39
- end
40
- end
41
-
42
- context "--heroku with region flag" do
43
- before(:all) do
44
- clean_up
45
- run_suspenders(%(--heroku=true --heroku-flags="--region eu"))
46
- setup_app_dependencies
47
- end
48
-
49
- it "suspends a project with extra Heroku flags" do
50
- expect(FakeHeroku).to have_created_app_for("staging", "--region eu")
51
- expect(FakeHeroku).to have_created_app_for("production", "--region eu")
52
- end
53
- end
54
-
55
- def assert_access_to_heroku_app(app_name)
56
- match(/^if heroku apps:info --app #{app_name}/)
57
- end
58
-
59
- def clean_up
60
- drop_dummy_database
61
- remove_project_directory
62
- FakeHeroku.clear!
63
- end
64
- end
@@ -1,10 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:inline_svg", type: :generator do
4
- it "generates the configuration for inline_svg" do
5
- with_app { generate("suspenders:inline_svg") }
6
-
7
- expect("config/initializers/inline_svg.rb").to match_contents(/InlineSvg/)
8
- expect("Gemfile").to match_contents(/inline_svg/)
9
- end
10
- end
@@ -1,15 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:json", type: :generator do
4
- it "generates the Gemfile for JSON parsing" do
5
- with_app { generate("suspenders:json") }
6
-
7
- expect("Gemfile").to match_contents(%r{gem .oj.})
8
- end
9
-
10
- it "cleans up the Gemfile from JSON parsing" do
11
- with_app { destroy("suspenders:json") }
12
-
13
- expect("Gemfile").not_to match_contents(%r{gem .oj.})
14
- end
15
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:lint", type: :generator do
4
- it "sets up standard" do
5
- with_app { generate("suspenders:lint") }
6
-
7
- expect("Gemfile").to match_contents(/standard/)
8
-
9
- run_in_project do
10
- expect(`rake -T`).to include("rake standard")
11
- end
12
- end
13
-
14
- it "removes standard" do
15
- with_app do
16
- generate("suspenders:lint")
17
- destroy("suspenders:lint")
18
- end
19
-
20
- expect("Gemfile").not_to match_contents(/standard/)
21
-
22
- run_in_project do
23
- expect(`rake -T`).not_to include("rake standard")
24
- end
25
- end
26
- end
@@ -1,321 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "Suspend a new project with default configuration" do
4
- before(:all) do
5
- drop_dummy_database
6
- remove_project_directory
7
- run_suspenders
8
- setup_app_dependencies
9
- end
10
-
11
- it "uses custom Gemfile" do
12
- gemfile_file = IO.read("#{project_path}/Gemfile")
13
- expect(gemfile_file).to match(
14
- /^ruby "#{Suspenders::RUBY_VERSION}"$/
15
- )
16
- expect(gemfile_file).to match(
17
- /^gem "autoprefixer-rails"$/
18
- )
19
- expect(gemfile_file).to match(
20
- /^gem "rails", "#{Suspenders::RAILS_VERSION}"$/
21
- )
22
- end
23
-
24
- it "ensures project specs pass" do
25
- Dir.chdir(project_path) do
26
- Bundler.with_unbundled_env do
27
- expect(`rake`).to include("0 failures")
28
- end
29
- end
30
- end
31
-
32
- it "includes the bundle:audit task" do
33
- Dir.chdir(project_path) do
34
- Bundler.with_unbundled_env do
35
- expect(`rails -T`).to include("rails bundle:audit")
36
- end
37
- end
38
- end
39
-
40
- it "creates .ruby-version from Suspenders .ruby-version" do
41
- ruby_version_file = IO.read("#{project_path}/.ruby-version")
42
-
43
- expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
44
- end
45
-
46
- it "copies dotfiles" do
47
- expect(File).to exist("#{project_path}/.sample.env")
48
- end
49
-
50
- it "doesn't generate test directory" do
51
- expect(File).not_to exist("#{project_path}/test")
52
- end
53
-
54
- it "loads secret_key_base from env" do
55
- secrets_file = IO.read("#{project_path}/config/secrets.yml")
56
-
57
- expect(secrets_file)
58
- .to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
59
- end
60
-
61
- it "adds bin/setup file" do
62
- expect(File).to exist("#{project_path}/bin/setup")
63
- end
64
-
65
- it "makes bin/setup executable" do
66
- expect("bin/setup").to be_executable
67
- end
68
-
69
- it "adds support file for action mailer" do
70
- expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
71
- end
72
-
73
- it "configures capybara-chromedriver" do
74
- expect(File).to exist("#{project_path}/spec/support/chromedriver.rb")
75
- end
76
-
77
- it "adds support file for i18n" do
78
- expect(File).to exist("#{project_path}/spec/support/i18n.rb")
79
- end
80
-
81
- it "creates good default .hound.yml" do
82
- hound_config_file = IO.read("#{project_path}/.hound.yml")
83
-
84
- expect(hound_config_file).to include "enabled: true"
85
- end
86
-
87
- it "initializes ActiveJob to avoid memory bloat" do
88
- expect(File)
89
- .to exist("#{project_path}/config/initializers/active_job.rb")
90
- end
91
-
92
- it "records pageviews through Segment if ENV variable set" do
93
- expect(analytics_partial)
94
- .to include(%(<% if ENV["SEGMENT_KEY"] %>))
95
- expect(analytics_partial)
96
- .to include(%{analytics.load("<%= ENV["SEGMENT_KEY"] %>");})
97
- end
98
-
99
- it "raises on unpermitted parameters in all environments" do
100
- result = IO.read("#{project_path}/config/application.rb")
101
-
102
- expect(result).to match(
103
- /^ +config.action_controller.action_on_unpermitted_parameters = :raise$/
104
- )
105
- end
106
-
107
- it "adds explicit quiet_assets configuration" do
108
- result = IO.read("#{project_path}/config/application.rb")
109
-
110
- expect(result).to match(/^ +config.assets.quiet = true$/)
111
- end
112
-
113
- it "configures public_file_server.headers in production" do
114
- expect(production_config).to match(
115
- /^ +config.public_file_server.headers = {\n +"Cache-Control" => "public,/
116
- )
117
- end
118
-
119
- it "configures production environment to enforce SSL" do
120
- expect(production_config).to match(
121
- /^ +config.force_ssl = true/
122
- )
123
- end
124
-
125
- it "raises on missing translations in development and test" do
126
- [development_config, test_config].each do |environment_file|
127
- expect(environment_file).to match(
128
- /^ +config.action_view.raise_on_missing_translations = true$/
129
- )
130
- end
131
- end
132
-
133
- it "evaluates en.yml.erb" do
134
- locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
135
-
136
- expect(locales_en_file).to match(/application: #{app_name.humanize}/)
137
- end
138
-
139
- it "configs simple_form" do
140
- expect(File).to exist("#{project_path}/config/initializers/simple_form.rb")
141
- end
142
-
143
- it "configs :test email delivery method for development" do
144
- expect(development_config)
145
- .to match(/^ +config.action_mailer.delivery_method = :file$/)
146
- end
147
-
148
- it "sets action mailer default host and asset host" do
149
- config_key = 'config\.action_mailer\.asset_host'
150
- config_value =
151
- %q{ENV\.fetch\("ASSET_HOST", ENV\.fetch\("APPLICATION_HOST"\)\)}
152
- expect(production_config).to match(/#{config_key} = #{config_value}/)
153
- end
154
-
155
- it "uses APPLICATION_HOST, not HOST in the production config" do
156
- expect(production_config).to match(/"APPLICATION_HOST"/)
157
- expect(production_config).not_to match(/"HOST"/)
158
- end
159
-
160
- it "configures email interceptor" do
161
- email_file = File.join(project_path, "config", "initializers", "email.rb")
162
- email_config = IO.read(email_file)
163
-
164
- expect(email_config)
165
- .to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])})
166
- end
167
-
168
- it "configures language in html element" do
169
- layout_path = "/app/views/layouts/application.html.erb"
170
- layout_file = IO.read("#{project_path}#{layout_path}")
171
- expect(layout_file).to match(/<html lang="en">/)
172
- end
173
-
174
- it "configs active job queue adapter" do
175
- application_config = IO.read("#{project_path}/config/application.rb")
176
-
177
- expect(application_config).to match(
178
- /^ +config.active_job.queue_adapter = :delayed_job$/
179
- )
180
- expect(test_config).to match(
181
- /^ +config.active_job.queue_adapter = :inline$/
182
- )
183
- end
184
-
185
- it "configs background jobs for rspec" do
186
- delayed_job = IO.read("#{project_path}/bin/delayed_job")
187
-
188
- expect(delayed_job).to match(
189
- /^require 'delayed\/command'$/
190
- )
191
- end
192
-
193
- it "configs bullet gem in development" do
194
- expect(development_config).to match(/^ +Bullet.enable = true$/)
195
- expect(development_config).to match(/^ +Bullet.bullet_logger = true$/)
196
- expect(development_config).to match(/^ +Bullet.rails_logger = true$/)
197
- # prevent broken result of standard removing whitespaces
198
- expect(development_config).to_not match(/trueconfig/)
199
- end
200
-
201
- it "configs missing assets to raise in test" do
202
- expect(test_config).to match(
203
- /^ +config.assets.raise_runtime_errors = true$/
204
- )
205
- end
206
-
207
- it "adds spring to binstubs" do
208
- expect(File).to exist("#{project_path}/bin/spring")
209
-
210
- bin_stubs = %w[rake rails rspec]
211
- bin_stubs.each do |bin_stub|
212
- expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(/spring/)
213
- end
214
- end
215
-
216
- it "removes comments and extra newlines from config files" do
217
- config_files = [
218
- IO.read("#{project_path}/config/application.rb"),
219
- IO.read("#{project_path}/config/environment.rb"),
220
- development_config,
221
- test_config,
222
- production_config
223
- ]
224
-
225
- config_files.each do |file|
226
- expect(file).not_to match(%r{.*#.*})
227
- expect(file).not_to eq(file.strip)
228
- expect(file).not_to match(%r{^$\n\n})
229
- end
230
- end
231
-
232
- it "copies factories.rb" do
233
- expect(File).to exist("#{project_path}/spec/factories.rb")
234
- end
235
-
236
- it "creates review apps setup script" do
237
- bin_setup_path = "#{project_path}/bin/setup_review_app"
238
- bin_setup = IO.read(bin_setup_path)
239
-
240
- expect(bin_setup).to include("PARENT_APP_NAME=#{app_name.dasherize}-staging")
241
- expect(bin_setup).to include("APP_NAME=#{app_name.dasherize}-staging-pr-$1")
242
- expect(bin_setup).to include("heroku ps:scale worker=1 --app $APP_NAME")
243
- expect(bin_setup).to include("heroku restart --app $APP_NAME")
244
-
245
- expect("bin/setup_review_app").to be_executable
246
- end
247
-
248
- it "creates deploy script" do
249
- bin_deploy_path = "#{project_path}/bin/deploy"
250
- bin_deploy = IO.read(bin_deploy_path)
251
-
252
- expect(bin_deploy).to include("git push")
253
- expect("bin/deploy").to be_executable
254
- end
255
-
256
- it "creates heroku application manifest file with application name in it" do
257
- app_json_file = IO.read("#{project_path}/app.json")
258
-
259
- expect(app_json_file).to match(/"name":\s*"#{app_name.dasherize}"/)
260
- end
261
-
262
- def app_name
263
- SuspendersTestHelpers::APP_NAME
264
- end
265
-
266
- it "adds high_voltage" do
267
- gemfile = IO.read("#{project_path}/Gemfile")
268
- expect(gemfile).to match(/high_voltage/)
269
- end
270
-
271
- it "adds sassc-rails" do
272
- gemfile = read_project_file("Gemfile")
273
-
274
- expect(gemfile).to match(/sassc-rails/)
275
- end
276
-
277
- it "adds and configures bourbon" do
278
- gemfile = read_project_file("Gemfile")
279
-
280
- expect(gemfile).to match(/bourbon/)
281
- end
282
-
283
- it "configures bourbon, and bitters" do
284
- app_css = read_project_file(%w[app assets stylesheets application.scss])
285
- expect(app_css).to match(
286
- /normalize\.css\/normalize.*bourbon.*base/m
287
- )
288
- end
289
-
290
- it "doesn't use turbolinks" do
291
- app_js = read_project_file(%w[app javascript packs application.js])
292
- expect(app_js).not_to match(/turbolinks/)
293
- end
294
-
295
- it "configures Timecop safe mode" do
296
- spec_helper = read_project_file(%w[spec spec_helper.rb])
297
- expect(spec_helper).to match(/Timecop.safe_mode = true/)
298
- end
299
-
300
- def development_config
301
- @_development_config ||=
302
- read_project_file %w[config environments development.rb]
303
- end
304
-
305
- def test_config
306
- @_test_config ||= read_project_file %w[config environments test.rb]
307
- end
308
-
309
- def production_config
310
- @_production_config ||=
311
- read_project_file %w[config environments production.rb]
312
- end
313
-
314
- def analytics_partial
315
- IO.read("#{project_path}/app/views/application/_analytics.html.erb")
316
- end
317
-
318
- def read_project_file(path)
319
- IO.read(File.join(project_path, *path))
320
- end
321
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:preloader", type: :generator do
4
- it "adds binstubs for Spring" do
5
- with_app { generate("suspenders:preloader") }
6
-
7
- expect("bin/rails").to match_contents(/spring/)
8
- expect("config/spring.rb").to exist_as_a_file
9
- expect("config/environments/test.rb").to \
10
- match_contents(/config.cache_classes = false/)
11
- expect("Gemfile").to match_contents(/spring/)
12
- expect("Gemfile").to match_contents(/spring-watcher-listen/)
13
- end
14
-
15
- it "removes Spring binstubs" do
16
- with_app { destroy("suspenders:preloader") }
17
-
18
- expect("config/environments/test.rb").to \
19
- match_contents(/config.cache_classes = true/)
20
- expect("config/spring.rb").not_to exist_as_a_file
21
- expect("bin/rails").not_to match_contents(/spring/)
22
- expect("Gemfile").not_to match_contents(/spring-watcher-listen/)
23
- expect("Gemfile").not_to match_contents(/spring/)
24
- end
25
- end
@@ -1,23 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:compression", type: :generator do
4
- context "generate" do
5
- it "adds Rack::Deflater to the middleware" do
6
- with_app { generate("suspenders:production:compression") }
7
-
8
- expect("config/environments/production.rb").to match_contents(
9
- %r{config.middleware.use Rack::Deflater}
10
- )
11
- end
12
- end
13
-
14
- context "destroy" do
15
- it "removes Rack::Deflater to the middleware" do
16
- with_app { destroy("suspenders:production:compression") }
17
-
18
- expect("config/environments/production.rb").not_to match_contents(
19
- %r{Rack::Deflater}
20
- )
21
- end
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:deployment", type: :generator do
4
- it "generates the configuration for a production deployment" do
5
- rm "bin/deploy"
6
-
7
- with_app { generate("suspenders:production:deployment") }
8
-
9
- expect("bin/deploy").to exist_as_a_file
10
- expect("bin/deploy").to be_executable
11
- expect("README.md").to match_contents(%r{bin/deploy})
12
- end
13
-
14
- it "destroys the configuration for a production deployment" do
15
- touch "bin/deploy"
16
-
17
- with_app { destroy("suspenders:production:deployment") }
18
-
19
- expect("bin/deploy").not_to exist_as_a_file
20
- expect("README.md").not_to match_contents(%r{bin/deploy})
21
- end
22
- end