suspenders 1.53.0 → 1.54.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +4 -3
  4. data/CONTRIBUTING.md +15 -15
  5. data/GOALS.md +65 -0
  6. data/NEWS.md +29 -0
  7. data/README.md +2 -4
  8. data/docs/heroku_deploy.md +2 -5
  9. data/lib/suspenders.rb +6 -0
  10. data/lib/suspenders/actions.rb +2 -2
  11. data/lib/suspenders/adapters/heroku.rb +14 -1
  12. data/lib/suspenders/app_builder.rb +3 -71
  13. data/lib/suspenders/generators/advisories_generator.rb +19 -0
  14. data/lib/suspenders/generators/app_generator.rb +7 -33
  15. data/lib/suspenders/generators/base.rb +39 -0
  16. data/lib/suspenders/generators/ci_generator.rb +19 -9
  17. data/lib/suspenders/generators/db_optimizations_generator.rb +3 -15
  18. data/lib/suspenders/generators/js_driver_generator.rb +1 -2
  19. data/lib/suspenders/generators/preloader_generator.rb +122 -0
  20. data/lib/suspenders/generators/production/compression_generator.rb +14 -0
  21. data/lib/suspenders/generators/production/deployment_generator.rb +1 -12
  22. data/lib/suspenders/generators/production/email_generator.rb +5 -8
  23. data/lib/suspenders/generators/production/manifest_generator.rb +1 -0
  24. data/lib/suspenders/generators/production/single_redirect.rb +15 -0
  25. data/lib/suspenders/generators/production/timeout_generator.rb +1 -0
  26. data/lib/suspenders/generators/profiler_generator.rb +35 -0
  27. data/lib/suspenders/generators/runner_generator.rb +48 -0
  28. data/lib/suspenders/generators/staging/pull_requests_generator.rb +2 -10
  29. data/lib/suspenders/generators/static_generator.rb +4 -0
  30. data/lib/suspenders/generators/stylesheet_base_generator.rb +5 -6
  31. data/lib/suspenders/generators/testing_generator.rb +0 -11
  32. data/lib/suspenders/version.rb +1 -1
  33. data/spec/adapters/heroku_spec.rb +28 -2
  34. data/spec/expand_json_spec.rb +89 -0
  35. data/spec/features/advisories_spec.rb +24 -0
  36. data/spec/features/ci_spec.rb +31 -0
  37. data/spec/features/db_optimizations_spec.rb +19 -0
  38. data/spec/features/heroku_spec.rb +6 -13
  39. data/spec/features/new_project_spec.rb +5 -27
  40. data/spec/features/preloader_spec.rb +25 -0
  41. data/spec/features/production/compression_spec.rb +23 -0
  42. data/spec/features/production/manifest_spec.rb +2 -0
  43. data/spec/features/production/single_redirect_spec.rb +25 -0
  44. data/spec/features/profiler_spec.rb +20 -0
  45. data/spec/features/runner_spec.rb +30 -0
  46. data/spec/features/static_spec.rb +17 -0
  47. data/spec/support/contain_json_matcher.rb +16 -10
  48. data/spec/support/project_files.rb +12 -0
  49. data/spec/support/rails_template.rb +1 -0
  50. data/spec/support/suspenders.rb +16 -13
  51. data/suspenders.gemspec +1 -2
  52. data/templates/Gemfile.erb +1 -6
  53. data/templates/application.scss +0 -1
  54. data/templates/bin_auto_migrate +5 -0
  55. data/templates/bin_deploy +0 -2
  56. data/templates/bin_setup +2 -2
  57. data/templates/bin_setup_review_app.erb +0 -1
  58. data/templates/chromedriver.rb +10 -0
  59. data/templates/descriptions/advisories.md +5 -0
  60. data/templates/descriptions/analytics.md +4 -0
  61. data/templates/descriptions/ci.md +4 -0
  62. data/templates/descriptions/compression.md +4 -0
  63. data/templates/descriptions/db_optimizations.md +2 -0
  64. data/templates/descriptions/deployment.md +5 -0
  65. data/templates/descriptions/email.md +9 -0
  66. data/templates/descriptions/factories.md +12 -0
  67. data/templates/descriptions/force_tls.md +1 -0
  68. data/templates/descriptions/forms.md +1 -0
  69. data/templates/descriptions/inline_svg.md +2 -0
  70. data/templates/descriptions/jobs.md +3 -0
  71. data/templates/descriptions/js_driver.md +4 -0
  72. data/templates/descriptions/json.md +1 -0
  73. data/templates/descriptions/lint.md +3 -0
  74. data/templates/descriptions/manifest.md +2 -0
  75. data/templates/descriptions/preloader.md +3 -0
  76. data/templates/descriptions/profiler.md +7 -0
  77. data/templates/descriptions/pull_requests.md +4 -0
  78. data/templates/descriptions/runner.md +10 -0
  79. data/templates/descriptions/single_redirect.md +1 -0
  80. data/templates/descriptions/static.md +5 -0
  81. data/templates/descriptions/stylelint.md +3 -0
  82. data/templates/descriptions/stylesheet_base.md +4 -0
  83. data/templates/descriptions/testing.md +9 -0
  84. data/templates/descriptions/timeout.md +4 -0
  85. data/templates/descriptions/views.md +8 -0
  86. data/templates/partials/ci_simplecov.rb +16 -0
  87. data/templates/partials/db_optimizations_configuration.rb +7 -0
  88. data/templates/partials/deployment_readme.md +8 -0
  89. data/templates/partials/email_smtp.rb +3 -0
  90. data/templates/partials/profiler_readme.md +8 -0
  91. data/templates/partials/pull_requests_config.rb +5 -0
  92. data/templates/partials/runner_readme.md +31 -0
  93. data/templates/partials/runner_setup.rb +3 -0
  94. data/templates/rack_mini_profiler.rb +2 -0
  95. data/templates/rails_helper.rb +4 -1
  96. data/templates/{dotfiles/.env → sample_env} +0 -1
  97. data/templates/spec_helper.rb +4 -7
  98. data/templates/spring.rb +6 -0
  99. data/templates/suspenders_gitignore +1 -1
  100. metadata +75 -25
  101. data/templates/dotfiles/.ctags +0 -2
  102. data/templates/puma.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8aa31ed704361dcb4c7c5dae040f6000a65e958f436038df81a74fa719ccdd47
4
- data.tar.gz: ceb17403f61961694b1b08298c4100188c26d1d64abc6b5db0f97216f7a9093e
3
+ metadata.gz: 2389cebef8ac193b9632f09376e8dd6d736a523335da8bf23a26e746fc0c208a
4
+ data.tar.gz: d2f55bd0ed92869ab361f6316c7a4da22f4dc09ace0d08a8116b8cde9cfe10fd
5
5
  SHA512:
6
- metadata.gz: 54d43d08ed81085648996f38127d960bffa732ae61735e40bfd19de93f5593b7e71a9bdc5c42e69f20410eaa0f8d79fcface14285158494510d9f231c422b45d
7
- data.tar.gz: '083ab7ad3e0a0a473d78f01e5d542ac15462a2965d0179b56dcd98b7ab32ff62d504251e359e907a5ac0e333eb3eb1127e4f0dfc2bbe265422f9ddd6aeb674c0'
6
+ metadata.gz: 41478b2123c847c22ce82024138a86d699985d5cb749c59caac67f5777919d05ad97f8eaca0d5054dd48afd69b3325946138102475113ec5a38c6bb7d1385220
7
+ data.tar.gz: f0f6c6f77792d2857cd47e6a004f7815a994cac4015819bc14297978e2d33992c4bd68b0a20f12f83c1fb8204038da3f13ac5abfe5cbc1f5be94b24a39729499
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.6.6
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
- rvm: 2.6.3
2
+ rvm: 2.6.6
3
3
  cache: bundler
4
- sudo: false
5
4
  before_install:
5
+ - nvm install 13.12.0
6
6
  - git config --global user.name 'Travis CI'
7
7
  - git config --global user.email 'travis-ci@example.com'
8
8
  - gem update --system
9
- - gem install bundler -v '< 2'
9
+ - gem install bundler
10
+ - bundler config --global disable_platform_warnings true
10
11
  install: bundle install
11
12
  notifications:
12
13
  email: false
@@ -1,7 +1,7 @@
1
1
  # Contributing
2
2
 
3
- We love pull requests from everyone. By participating in this project, you agree
4
- to abide by the thoughtbot [code of conduct].
3
+ We love pull requests from everyone. By participating in this project, you
4
+ agree to abide by the thoughtbot [code of conduct].
5
5
 
6
6
  [code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
7
7
 
@@ -17,17 +17,15 @@ Make sure the tests pass:
17
17
 
18
18
  rake
19
19
 
20
- Make your change.
21
- Write tests.
22
- Follow our [style guide][style].
23
- Make the tests pass:
20
+ Make your change. Write tests. Follow our [style guide][style]. Make the tests
21
+ pass:
24
22
 
25
23
  [style]: https://github.com/thoughtbot/guides/tree/master/style
26
24
 
27
25
  rake
28
26
 
29
- Mention how your changes affect the project to other developers and users in the
30
- `NEWS.md` file.
27
+ Mention how your changes affect the project to other developers and users in
28
+ the `NEWS.md` file.
31
29
 
32
30
  Write a [good commit message][commit].
33
31
  Push to your fork.
@@ -36,19 +34,21 @@ Push to your fork.
36
34
  [commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
37
35
  [pr]: https://github.com/thoughtbot/suspenders/compare/
38
36
 
39
- If [Hound] catches style violations,
40
- fix them.
37
+ If [Hound] catches style violations, fix them.
41
38
 
42
39
  [hound]: https://houndci.com
43
40
 
44
- Wait for us.
45
- We try to at least comment on pull requests within one business day.
46
- We may suggest changes.
41
+ Wait for us. We try to at least comment on pull requests within one business
42
+ day. We may suggest changes.
43
+
44
+ ## Generators
45
+
46
+ All new contributions must be within the generator framework, as described in
47
+ [our goals](GOALS.md).
47
48
 
48
49
  ## Versions
49
50
 
50
- To update the Ruby version,
51
- change `.ruby-version` and `.travis.yml`.
51
+ To update the Ruby version, change `.ruby-version` and `.travis.yml`.
52
52
 
53
53
  If you see this error while running tests:
54
54
 
@@ -0,0 +1,65 @@
1
+ # Goals
2
+
3
+ Suspenders is an opinionated platform for adding functionality to a Rails app.
4
+ It encodes thoughtbot's opinions and decisions in tooling and best practices.
5
+
6
+ We are transitioning to a library of generators. All new functionality must be
7
+ in the form of a well-tested, self-contained generator that fits within the
8
+ Suspenders framework.
9
+
10
+ ## History and transitions
11
+
12
+ In the beginning suspenders was a git repo that we would clone then use as a
13
+ template for starting a new Rails app.
14
+
15
+ It then became a command-line tool that would generate a Rails app then modify
16
+ the files in place. Over time, and with intention, most of the modifications
17
+ were focused on modifying the Gemfile.
18
+
19
+ This was identified as unscalable and we have been slowing been moving in a new
20
+ direction: a library of generators.
21
+
22
+ ## The future
23
+
24
+ The problem with a script that adds a bunch of gem requirements to the Gemfile
25
+ is: what if you don't want all those gems? Suspenders adds gem requirements and
26
+ then configures each one. On a typical project we would run Suspenders then
27
+ spend the rest of the day un-doing the parts we don't want.
28
+
29
+ In 2015, [PR #511], we discussed what we want: a gem that is a library of
30
+ generators that we can run on demand. The ideal future workflow goes like this:
31
+
32
+ [PR #511]: https://github.com/thoughtbot/suspenders/pull/511
33
+
34
+ 1. `rails new my-cool-project && cd my-cool-project`
35
+ 2. `echo "gem 'suspenders', group: :development" >> Gemfile && bundle`
36
+ 3. `rails g suspenders:ci`
37
+ 4. Repeat with other generators as needed.
38
+
39
+ In this future you would use `rails new` as normal and instead add Suspenders
40
+ as a development gem. This gives you access to opinionated generators for
41
+ adding (and removing!) whole functionality, but on demand and with your
42
+ knowledge.
43
+
44
+ The generators are all named to generically describe what functionality they
45
+ add. In this way we can change our opinions on the implementation without
46
+ needing to know new generator names. For example, `suspenders:ci` could
47
+ configure the app for CircleCI now, but down the road we may decide to switch
48
+ everything to Jenkins; we could update the implementation of the generator
49
+ without changing its name.
50
+
51
+ ## From here to there
52
+
53
+ The transition looks like this:
54
+
55
+ 1. Introduce a `suspenders:all` generator that runs Suspenders against an
56
+ existing Rails app.
57
+ 2. Change the Suspenders program to create a Rails app, add Suspenders to the
58
+ Gemfile, and run `suspenders:all` inside of it.
59
+ 3. Slowly split functionality out from the "all" generator and into smaller,
60
+ well-tested, self-contained generators. The "all" generator invokes these
61
+ generators.
62
+ 4. Once that is completed -- once "all" _only_ calls other generators -- then
63
+ remove the Suspenders program and only distribute the gem.
64
+
65
+ We are on step (3), and it's a big one. Come help out!
data/NEWS.md CHANGED
@@ -1,3 +1,32 @@
1
+ Unreleased
2
+
3
+ 1.54.0 (June 24, 2020)
4
+
5
+ * New generator: `suspenders:single_redirect` for setting up `Rack::CanonicalHost`
6
+ * New generator: `suspenders:production:compression` for setting up `Rack::Deflater`
7
+ * New generator: `suspenders:preloader` for managing spring
8
+ * New generator: `suspenders:advisories` for installing bundler-audit
9
+ * New generator: `suspenders:profiler` for setting up rack\_mini\_profiler
10
+ * New generator: `suspenders:runner` for making an app runnable locally
11
+ * Added: generator descriptions
12
+ * Added: Heroku release phase for running database migrations
13
+ * Added: automatic buildpack configuration for Heroku
14
+ * Added: system test configuration to opt into JavaScript as needed
15
+ * Added: spring-watcher-listen gem
16
+ * Changed: from `chromedriver-helper` to `webdrivers`
17
+ * Changed: replace `heroku join` calls with `heroku apps:info` in `bin/setup`
18
+ * Changed: check environment instead of `DATABASE\_URL` in test helper
19
+ * Fixed: `ExpandJson` merging
20
+ * Fixed: spacing in the generated config file
21
+ * Upgraded: bitters to version 2.x
22
+ * Upgraded: bourbon to version 6.x
23
+ * Upgraded: Ruby to version 2.6.6
24
+ * Removed: neat gem
25
+ * Removed: ctags configuration
26
+ * Removed: custom placeholder directories
27
+ * Removed: customization for error pages
28
+ * Removed: custom Puma config
29
+
1
30
  1.53.0 (August 23, 2019)
2
31
  * Upgraded: Rails 6.0.
3
32
  * New generator: `suspenders:inline_svg` for setting up the inline_svg gem.
data/README.md CHANGED
@@ -37,8 +37,7 @@ It includes application gems like:
37
37
  * [Delayed Job](https://github.com/collectiveidea/delayed_job) for background
38
38
  processing
39
39
  * [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
40
- * [Honeybadger](https://honeybadger.io) for exception notification
41
- * [Neat](https://github.com/thoughtbot/neat) for semantic grids
40
+ * [Honeybadger](https://www.honeybadger.io/?affiliate=A43uwl) for exception notification
42
41
  * [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
43
42
  * [Oj](http://www.ohler.com/oj/)
44
43
  * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
@@ -53,7 +52,6 @@ It includes application gems like:
53
52
  * [Skylight](https://www.skylight.io/) for monitoring performance
54
53
  * [Title](https://github.com/calebthompson/title) for storing titles in
55
54
  translations
56
- * [Puma](https://github.com/puma/puma) to serve HTTP requests
57
55
 
58
56
  And development gems like:
59
57
 
@@ -225,6 +223,6 @@ See [our other projects][community].
225
223
  We are [available for hire][hire].
226
224
 
227
225
  [thoughtbot]: https://thoughtbot.com?utm_source=github
228
- [thoughtbot-logo]: http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg
226
+ [thoughtbot-logo]: https://thoughtbot.com/brand_assets/93:44.svg
229
227
  [community]: https://thoughtbot.com/community?utm_source=github
230
228
  [hire]: https://thoughtbot.com?utm_source=github
@@ -4,11 +4,7 @@
4
4
 
5
5
  Deploying to Heroku requires two additional steps:
6
6
 
7
- 1. Manually add buildpacks `node.js` and `ruby` (in that order) to your Heroku
8
- app. This is necessary because build order is important and Heroku's
9
- auto-detection will add them in the wrong order.
10
-
11
- 2. Set the following environment variables:
7
+ 1. Set the following environment variables:
12
8
 
13
9
  - `ASSET_HOST`: `siteURL.herokuapp.com`
14
10
  - `APPLICATION_HOST`: `siteURL.herokuapp.com`
@@ -16,6 +12,7 @@ Deploying to Heroku requires two additional steps:
16
12
  - `SMTP_DOMAIN`: `example.com`
17
13
  - `SMTP_USERNAME`: `username`
18
14
  - `SMTP_PASSWORD`: `password`
15
+ - `AUTO_MIGRATE_DB`: `true`
19
16
 
20
17
  ## Execution
21
18
 
@@ -1,4 +1,5 @@
1
1
  require "suspenders/version"
2
+ require "suspenders/generators/advisories_generator"
2
3
  require "suspenders/generators/app_generator"
3
4
  require "suspenders/generators/static_generator"
4
5
  require "suspenders/generators/stylesheet_base_generator"
@@ -15,11 +16,16 @@ require "suspenders/generators/js_driver_generator"
15
16
  require "suspenders/generators/json_generator"
16
17
  require "suspenders/generators/testing_generator"
17
18
  require "suspenders/generators/inline_svg_generator"
19
+ require "suspenders/generators/preloader_generator"
20
+ require "suspenders/generators/profiler_generator"
21
+ require "suspenders/generators/runner_generator"
18
22
  require "suspenders/generators/production/force_tls_generator"
23
+ require "suspenders/generators/production/compression_generator"
19
24
  require "suspenders/generators/production/email_generator"
20
25
  require "suspenders/generators/production/timeout_generator"
21
26
  require "suspenders/generators/production/deployment_generator"
22
27
  require "suspenders/generators/production/manifest_generator"
28
+ require "suspenders/generators/production/single_redirect"
23
29
  require "suspenders/generators/staging/pull_requests_generator"
24
30
  require "suspenders/actions"
25
31
  require "suspenders/adapters/heroku"
@@ -39,7 +39,7 @@ module Suspenders
39
39
  end
40
40
 
41
41
  def invoke!
42
- write_out { |existing_json| existing_json.merge(data) }
42
+ write_out { |existing_json| existing_json.deep_merge(data) }
43
43
  end
44
44
 
45
45
  def revoke!
@@ -60,7 +60,7 @@ module Suspenders
60
60
  end
61
61
 
62
62
  def existing_json
63
- JSON.parse(IO.read(destination_file))
63
+ JSON.parse(IO.read(destination_file), symbolize_names: true)
64
64
  rescue Errno::ENOENT
65
65
  {}
66
66
  end
@@ -84,6 +84,19 @@ module Suspenders
84
84
  end
85
85
  end
86
86
 
87
+ def set_heroku_buildpacks
88
+ %w(staging production).each do |environment|
89
+ run_toolbelt_command(
90
+ "buildpacks:add --index 1 heroku/nodejs",
91
+ environment,
92
+ )
93
+ run_toolbelt_command(
94
+ "buildpacks:add --index 2 heroku/ruby",
95
+ environment,
96
+ )
97
+ end
98
+ end
99
+
87
100
  private
88
101
 
89
102
  attr_reader :app_builder
@@ -92,7 +105,7 @@ module Suspenders
92
105
  heroku_app_name = heroku_app_name_for(environment)
93
106
  <<~SHELL
94
107
 
95
- if heroku join --app #{heroku_app_name} > /dev/null 2>&1; then
108
+ if heroku apps:info --app #{heroku_app_name} > /dev/null 2>&1; then
96
109
  git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
97
110
  printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
98
111
  else
@@ -15,6 +15,7 @@ module Suspenders
15
15
  :set_heroku_honeybadger_env,
16
16
  :set_heroku_rails_secrets,
17
17
  :set_heroku_remotes,
18
+ :set_heroku_buildpacks,
18
19
  )
19
20
 
20
21
  def readme
@@ -96,18 +97,6 @@ module Suspenders
96
97
  copy_file "email.rb", "config/initializers/email.rb"
97
98
  end
98
99
 
99
- def enable_rack_canonical_host
100
- config = <<-RUBY
101
- config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
102
- RUBY
103
-
104
- configure_environment "production", config
105
- end
106
-
107
- def enable_rack_deflater
108
- configure_environment "production", "config.middleware.use Rack::Deflater"
109
- end
110
-
111
100
  def setup_asset_host
112
101
  replace_in_file 'config/environments/production.rb',
113
102
  "# config.action_controller.asset_host = 'http://assets.example.com'",
@@ -185,82 +174,25 @@ config.public_file_server.headers = {
185
174
  )
186
175
  end
187
176
 
188
- def replace_default_puma_configuration
189
- copy_file "puma.rb", "config/puma.rb", force: true
190
- end
191
-
192
- def set_up_forego
193
- copy_file "Procfile", "Procfile"
194
- end
195
-
196
- def setup_default_directories
197
- [
198
- 'app/views/pages',
199
- 'spec/lib',
200
- 'spec/controllers',
201
- 'spec/helpers',
202
- 'spec/support/matchers',
203
- 'spec/support/mixins',
204
- 'spec/support/shared_examples'
205
- ].each do |dir|
206
- empty_directory_with_keep_file dir
207
- end
208
- end
209
-
210
- def copy_dotfiles
211
- directory("dotfiles", ".")
212
- end
213
-
214
177
  def create_heroku_apps(flags)
215
178
  create_staging_heroku_app(flags)
216
179
  create_production_heroku_app(flags)
217
180
  end
218
181
 
219
182
  def configure_automatic_deployment
220
- deploy_command = <<-YML.strip_heredoc
221
- deployment:
222
- staging:
223
- branch: master
224
- commands:
225
- - bin/deploy staging
226
- YML
227
-
228
- append_file "circle.yml", deploy_command
183
+ append_file "Procfile", "release: bin/auto_migrate\n"
184
+ copy_file "bin_auto_migrate", "bin/auto_migrate"
229
185
  end
230
186
 
231
187
  def create_github_repo(repo_name)
232
188
  run "hub create #{repo_name}"
233
189
  end
234
190
 
235
- def setup_bundler_audit
236
- copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
237
- append_file "Rakefile", %{\ntask default: "bundle:audit"\n}
238
- end
239
-
240
- def setup_spring
241
- bundle_command "exec spring binstub --all"
242
- end
243
-
244
191
  def copy_miscellaneous_files
245
192
  copy_file "errors.rb", "config/initializers/errors.rb"
246
193
  copy_file "json_encoding.rb", "config/initializers/json_encoding.rb"
247
194
  end
248
195
 
249
- def customize_error_pages
250
- meta_tags =<<-EOS
251
- <meta charset="utf-8" />
252
- <meta name="viewport" content="initial-scale=1" />
253
- EOS
254
-
255
- %w(500 404 422).each do |page|
256
- path = "public/#{page}.html"
257
- if File.exist?(path)
258
- inject_into_file path, meta_tags, after: "<head>\n"
259
- replace_in_file path, /<!--.+-->\n/, ''
260
- end
261
- end
262
- end
263
-
264
196
  def remove_config_comment_lines
265
197
  config_files = [
266
198
  "application.rb",
@@ -0,0 +1,19 @@
1
+ require_relative "base"
2
+
3
+ module Suspenders
4
+ class AdvisoriesGenerator < Generators::Base
5
+ def bundler_audit_gem
6
+ gem "bundler-audit",
7
+ require: false,
8
+ group: %i[development test],
9
+ git: "https://github.com/rubysec/bundler-audit.git",
10
+ branch: "0.7.0"
11
+ Bundler.with_clean_env { run "bundle install" }
12
+ end
13
+
14
+ def rake_task
15
+ copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
16
+ append_file "Rakefile", %{\ntask default: "bundle:audit"\n}
17
+ end
18
+ end
19
+ end
@@ -47,14 +47,9 @@ module Suspenders
47
47
  invoke :setup_secret_token
48
48
  invoke :configure_app
49
49
  invoke :copy_miscellaneous_files
50
- invoke :customize_error_pages
51
- invoke :setup_dotfiles
52
50
  invoke :setup_database
53
51
  invoke :create_github_repo
54
- invoke :setup_bundler_audit
55
- invoke :setup_spring
56
52
  invoke :generate_default
57
- invoke :setup_default_directories
58
53
  invoke :create_heroku_apps
59
54
  invoke :generate_deployment_default
60
55
  invoke :remove_config_comment_lines
@@ -92,8 +87,6 @@ module Suspenders
92
87
 
93
88
  def setup_production_environment
94
89
  say 'Setting up the production environment'
95
- build :enable_rack_canonical_host
96
- build :enable_rack_deflater
97
90
  build :setup_asset_host
98
91
  end
99
92
 
@@ -107,9 +100,6 @@ module Suspenders
107
100
  build :configure_action_mailer
108
101
  build :configure_time_formats
109
102
  build :setup_default_rake_task
110
- build :replace_default_puma_configuration
111
- build :set_up_forego
112
- build :setup_rack_mini_profiler
113
103
  end
114
104
 
115
105
  def create_heroku_apps
@@ -121,6 +111,7 @@ module Suspenders
121
111
  build :set_heroku_application_host
122
112
  build :set_heroku_honeybadger_env
123
113
  build :set_heroku_backup_schedule
114
+ build :set_heroku_buildpacks
124
115
  build :create_heroku_pipeline
125
116
  build :configure_automatic_deployment
126
117
  end
@@ -133,34 +124,11 @@ module Suspenders
133
124
  end
134
125
  end
135
126
 
136
- def setup_dotfiles
137
- build :copy_dotfiles
138
- end
139
-
140
- def setup_default_directories
141
- build :setup_default_directories
142
- end
143
-
144
- def setup_bundler_audit
145
- say "Setting up bundler-audit"
146
- build :setup_bundler_audit
147
- end
148
-
149
- def setup_spring
150
- say "Springifying binstubs"
151
- build :setup_spring
152
- end
153
-
154
127
  def copy_miscellaneous_files
155
128
  say 'Copying miscellaneous support files'
156
129
  build :copy_miscellaneous_files
157
130
  end
158
131
 
159
- def customize_error_pages
160
- say 'Customizing the 500/404/422 pages'
161
- build :customize_error_pages
162
- end
163
-
164
132
  def remove_config_comment_lines
165
133
  build :remove_config_comment_lines
166
134
  end
@@ -171,6 +139,7 @@ module Suspenders
171
139
 
172
140
  def generate_default
173
141
  run("spring stop")
142
+ generate("suspenders:profiler")
174
143
  generate("suspenders:json")
175
144
  generate("suspenders:static")
176
145
  generate("suspenders:stylesheet_base")
@@ -186,10 +155,15 @@ module Suspenders
186
155
  generate("suspenders:jobs")
187
156
  generate("suspenders:analytics")
188
157
  generate("suspenders:inline_svg")
158
+ generate("suspenders:advisories")
159
+ generate("suspenders:runner")
160
+ generate("suspenders:preloader")
189
161
  end
190
162
 
191
163
  def generate_deployment_default
192
164
  generate("suspenders:staging:pull_requests")
165
+ generate("suspenders:production:single_redirect")
166
+ generate("suspenders:production:compression")
193
167
  generate("suspenders:production:force_tls")
194
168
  generate("suspenders:production:email")
195
169
  generate("suspenders:production:timeout")