suspenders 1.50.0 → 1.54.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +6 -4
  4. data/CONTRIBUTING.md +15 -15
  5. data/GOALS.md +65 -0
  6. data/NEWS.md +55 -0
  7. data/README.md +7 -4
  8. data/docs/heroku_deploy.md +19 -0
  9. data/lib/suspenders.rb +10 -0
  10. data/lib/suspenders/actions.rb +2 -2
  11. data/lib/suspenders/adapters/heroku.rb +14 -5
  12. data/lib/suspenders/app_builder.rb +3 -91
  13. data/lib/suspenders/generators/advisories_generator.rb +15 -0
  14. data/lib/suspenders/generators/analytics_generator.rb +2 -7
  15. data/lib/suspenders/generators/app_generator.rb +14 -41
  16. data/lib/suspenders/generators/base.rb +59 -0
  17. data/lib/suspenders/generators/ci_generator.rb +20 -14
  18. data/lib/suspenders/generators/db_optimizations_generator.rb +6 -18
  19. data/lib/suspenders/generators/factories_generator.rb +3 -8
  20. data/lib/suspenders/generators/forms_generator.rb +3 -3
  21. data/lib/suspenders/generators/inline_svg_generator.rb +14 -0
  22. data/lib/suspenders/generators/jobs_generator.rb +3 -13
  23. data/lib/suspenders/generators/js_driver_generator.rb +9 -11
  24. data/lib/suspenders/generators/json_generator.rb +3 -3
  25. data/lib/suspenders/generators/lint_generator.rb +2 -7
  26. data/lib/suspenders/generators/preloader_generator.rb +122 -0
  27. data/lib/suspenders/generators/production/compression_generator.rb +14 -0
  28. data/lib/suspenders/generators/production/deployment_generator.rb +16 -0
  29. data/lib/suspenders/generators/production/email_generator.rb +7 -18
  30. data/lib/suspenders/generators/production/force_tls_generator.rb +2 -5
  31. data/lib/suspenders/generators/production/manifest_generator.rb +25 -0
  32. data/lib/suspenders/generators/production/single_redirect.rb +15 -0
  33. data/lib/suspenders/generators/production/timeout_generator.rb +3 -2
  34. data/lib/suspenders/generators/profiler_generator.rb +35 -0
  35. data/lib/suspenders/generators/runner_generator.rb +48 -0
  36. data/lib/suspenders/generators/staging/pull_requests_generator.rb +4 -26
  37. data/lib/suspenders/generators/static_generator.rb +7 -3
  38. data/lib/suspenders/generators/stylelint_generator.rb +70 -0
  39. data/lib/suspenders/generators/stylesheet_base_generator.rb +8 -13
  40. data/lib/suspenders/generators/testing_generator.rb +6 -22
  41. data/lib/suspenders/generators/views_generator.rb +2 -7
  42. data/lib/suspenders/version.rb +2 -2
  43. data/spec/adapters/heroku_spec.rb +28 -2
  44. data/spec/expand_json_spec.rb +89 -0
  45. data/spec/features/advisories_spec.rb +24 -0
  46. data/spec/features/api_spec.rb +1 -1
  47. data/spec/features/ci_spec.rb +31 -0
  48. data/spec/features/db_optimizations_spec.rb +19 -0
  49. data/spec/features/heroku_spec.rb +7 -14
  50. data/spec/features/inline_svg_spec.rb +10 -0
  51. data/spec/features/json_spec.rb +1 -1
  52. data/spec/features/new_project_spec.rb +17 -35
  53. data/spec/features/preloader_spec.rb +25 -0
  54. data/spec/features/production/compression_spec.rb +23 -0
  55. data/spec/features/production/deployment_spec.rb +22 -0
  56. data/spec/features/production/email_spec.rb +1 -1
  57. data/spec/features/production/manifest_spec.rb +37 -0
  58. data/spec/features/production/single_redirect_spec.rb +25 -0
  59. data/spec/features/profiler_spec.rb +20 -0
  60. data/spec/features/runner_spec.rb +30 -0
  61. data/spec/features/staging/pull_requests_spec.rb +1 -1
  62. data/spec/features/static_spec.rb +17 -0
  63. data/spec/features/stylelint_spec.rb +60 -0
  64. data/spec/spec_helper.rb +1 -0
  65. data/spec/support/be_executable_matcher.rb +7 -0
  66. data/spec/support/contain_json_matcher.rb +16 -10
  67. data/spec/support/generators.rb +5 -0
  68. data/spec/support/project_files.rb +25 -0
  69. data/spec/support/rails_template.rb +1 -0
  70. data/spec/support/suspenders.rb +18 -15
  71. data/suspenders.gemspec +1 -1
  72. data/templates/Gemfile.erb +5 -11
  73. data/templates/_javascript.html.erb +1 -1
  74. data/templates/application.scss +0 -1
  75. data/templates/bin_auto_migrate +5 -0
  76. data/templates/bin_deploy +0 -2
  77. data/templates/bin_setup +2 -2
  78. data/templates/bin_setup_review_app.erb +0 -1
  79. data/templates/capybara_silence_puma.rb +1 -0
  80. data/templates/chromedriver.rb +14 -4
  81. data/templates/descriptions/advisories.md +5 -0
  82. data/templates/descriptions/analytics.md +4 -0
  83. data/templates/descriptions/ci.md +4 -0
  84. data/templates/descriptions/compression.md +4 -0
  85. data/templates/descriptions/db_optimizations.md +2 -0
  86. data/templates/descriptions/deployment.md +5 -0
  87. data/templates/descriptions/email.md +9 -0
  88. data/templates/descriptions/factories.md +12 -0
  89. data/templates/descriptions/force_tls.md +1 -0
  90. data/templates/descriptions/forms.md +1 -0
  91. data/templates/descriptions/inline_svg.md +2 -0
  92. data/templates/descriptions/jobs.md +3 -0
  93. data/templates/descriptions/js_driver.md +4 -0
  94. data/templates/descriptions/json.md +1 -0
  95. data/templates/descriptions/lint.md +3 -0
  96. data/templates/descriptions/manifest.md +2 -0
  97. data/templates/descriptions/preloader.md +3 -0
  98. data/templates/descriptions/profiler.md +7 -0
  99. data/templates/descriptions/pull_requests.md +4 -0
  100. data/templates/descriptions/runner.md +10 -0
  101. data/templates/descriptions/single_redirect.md +1 -0
  102. data/templates/descriptions/static.md +5 -0
  103. data/templates/descriptions/stylelint.md +3 -0
  104. data/templates/descriptions/stylesheet_base.md +4 -0
  105. data/templates/descriptions/testing.md +9 -0
  106. data/templates/descriptions/timeout.md +4 -0
  107. data/templates/descriptions/views.md +8 -0
  108. data/templates/hound.yml +3 -1
  109. data/templates/inline_svg.rb +3 -0
  110. data/templates/partials/ci_simplecov.rb +16 -0
  111. data/templates/partials/db_optimizations_configuration.rb +7 -0
  112. data/templates/partials/deployment_readme.md +8 -0
  113. data/templates/partials/email_smtp.rb +3 -0
  114. data/templates/partials/profiler_readme.md +8 -0
  115. data/templates/partials/pull_requests_config.rb +5 -0
  116. data/templates/partials/runner_readme.md +31 -0
  117. data/templates/partials/runner_setup.rb +3 -0
  118. data/templates/rack_mini_profiler.rb +2 -0
  119. data/templates/rails_helper.rb +7 -4
  120. data/templates/{dotfiles/.env → sample_env} +0 -2
  121. data/templates/spec_helper.rb +4 -7
  122. data/templates/spring.rb +6 -0
  123. data/templates/stylelintrc.json +3 -0
  124. data/templates/suspenders_gitignore +1 -1
  125. metadata +119 -17
  126. data/templates/app.json.erb +0 -27
  127. data/templates/browserslist +0 -3
  128. data/templates/dotfiles/.ctags +0 -2
  129. data/templates/puma.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8da6287b8db00f55d3055a907f8c8e38b449ef15d3f98c1e898770594a8b9134
4
- data.tar.gz: 54e3a53194b0b996d5971681d44269122bbf181c8d34f1638e2255592dcbf497
3
+ metadata.gz: a1c3a5fd298d2c49ceed3d4b3c79d99590aae75259c0f4ec6f06bd6f244336d3
4
+ data.tar.gz: c880d208a127a68da87b63a33da39fade1abf8e6c6d6b754806771be68e23e03
5
5
  SHA512:
6
- metadata.gz: 407d7b2087c72518a79276894c1b7c4c7d8ebd9d0d6d5cbbb2f5b068935d1543a976f86bba1314bcf698e4cf1cb54ac279a6c21f0dd5ee485c0f8357f82133f5
7
- data.tar.gz: b1bdb1c214097d96bb793614c822ddc20e090fe4cffc11b71841534c20d0108d03bb9fafaebc905b5b5923a26a5e364a2b6de21c03d41f9e2e523f4be6a4eeab
6
+ metadata.gz: 35d40b50ca80e2248efe6cc0c5ac5b87eff319aa6638e9293bafbb798081a1143b7a2d0e5907261bf68ceece79f482471c0762782a6d4cfebc69b0871fe8ea28
7
+ data.tar.gz: d02195af5d9673603233ce092cae10b4a2e2cf49697d8129c808a378d743d008f9046787b53ec050ec9a4450433fb063a7fbc4308fb5c16efc17d3ed73de291a
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.6.6
@@ -1,13 +1,15 @@
1
1
  language: ruby
2
- rvm: 2.5.3
2
+ rvm: 2.6.6
3
3
  cache: bundler
4
- sudo: false
5
4
  before_install:
6
- - "echo '--colour' > ~/.rspec"
5
+ - nvm install 13.12.0
7
6
  - git config --global user.name 'Travis CI'
8
7
  - git config --global user.email 'travis-ci@example.com'
9
- - gem install bundler
10
8
  - gem update --system
9
+ - gem install bundler
10
+ - bundler config --global disable_platform_warnings true
11
11
  install: bundle install
12
12
  notifications:
13
13
  email: false
14
+ services:
15
+ - postgresql
@@ -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,58 @@
1
+ Unreleased
2
+
3
+ 1.54.1 (June 30, 2020)
4
+
5
+ * Fixed: invalid Gemfile entry for bundler-audit
6
+ * Fixed: Deprecation warning for `Bundler.with_clean_env`
7
+
8
+ 1.54.0 (June 24, 2020)
9
+
10
+ * New generator: `suspenders:single_redirect` for setting up `Rack::CanonicalHost`
11
+ * New generator: `suspenders:production:compression` for setting up `Rack::Deflater`
12
+ * New generator: `suspenders:preloader` for managing spring
13
+ * New generator: `suspenders:advisories` for installing bundler-audit
14
+ * New generator: `suspenders:profiler` for setting up rack\_mini\_profiler
15
+ * New generator: `suspenders:runner` for making an app runnable locally
16
+ * Added: generator descriptions
17
+ * Added: Heroku release phase for running database migrations
18
+ * Added: automatic buildpack configuration for Heroku
19
+ * Added: system test configuration to opt into JavaScript as needed
20
+ * Added: spring-watcher-listen gem
21
+ * Changed: from `chromedriver-helper` to `webdrivers`
22
+ * Changed: replace `heroku join` calls with `heroku apps:info` in `bin/setup`
23
+ * Changed: check environment instead of `DATABASE\_URL` in test helper
24
+ * Fixed: `ExpandJson` merging
25
+ * Fixed: spacing in the generated config file
26
+ * Upgraded: bitters to version 2.x
27
+ * Upgraded: bourbon to version 6.x
28
+ * Upgraded: Ruby to version 2.6.6
29
+ * Removed: neat gem
30
+ * Removed: ctags configuration
31
+ * Removed: custom placeholder directories
32
+ * Removed: customization for error pages
33
+ * Removed: custom Puma config
34
+
35
+ 1.53.0 (August 23, 2019)
36
+ * Upgraded: Rails 6.0.
37
+ * New generator: `suspenders:inline_svg` for setting up the inline_svg gem.
38
+ * Changed: silence Puma's startup messages in JS specs.
39
+ * Changed: improve chromedriver configuration.
40
+ * Added: documentation for deploying to Heroku.
41
+ * Fixed: indentation in production config file.
42
+
43
+ 1.52.0 (June 7, 2019)
44
+ * Changed: Setup system tests instead of feature specs
45
+ * Upgraded: Rails 5.2.3
46
+
47
+ 1.51.0 (April 26, 2019)
48
+
49
+ * Changed: from sass-rails to sassc-rails.
50
+ * Upgraded: Ruby 2.6.3.
51
+ * Fixed: Avoid installing autoprefixer-rails in api mode
52
+ * New generator: `suspenders:stylelint` for setting up stylelint.
53
+ * New generator: `suspenders:production:manifest` for app.json.
54
+ * New generator: `suspenders:production:deployment` for bin/deploy script.
55
+
1
56
  1.50.0 (December 28, 2018)
2
57
 
3
58
  * Removed: jquery-rails.
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
 
@@ -101,6 +99,7 @@ Suspenders also comes with:
101
99
  environments
102
100
  * Configuration for [CircleCI][circle] Continuous Integration (tests)
103
101
  * Configuration for [Hound][hound] Continuous Integration (style)
102
+ * Configuration for [stylelint][stylelint]
104
103
  * The analytics adapter [Segment][segment] (and therefore config for Google
105
104
  Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
106
105
 
@@ -111,10 +110,13 @@ Suspenders also comes with:
111
110
  [i18n]: https://github.com/thoughtbot/suspenders/pull/304
112
111
  [circle]: https://circleci.com/docs
113
112
  [hound]: https://houndci.com
113
+ [stylelint]: https://stylelint.io/
114
114
  [segment]: https://segment.com
115
115
 
116
116
  ## Heroku
117
117
 
118
+ Read the documentation on [deploying to Heroku][heroku deploy]
119
+
118
120
  You can optionally create Heroku staging and production apps:
119
121
 
120
122
  suspenders app --heroku true
@@ -129,6 +131,7 @@ This:
129
131
  * Schedules automated backups for 10AM UTC for both `staging` and `production`
130
132
 
131
133
  [Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
134
+ [heroku deploy]: https://github.com/thoughtbot/suspenders/blob/master/docs/heroku_deploy.md
132
135
 
133
136
  You can optionally specify alternate Heroku flags:
134
137
 
@@ -220,6 +223,6 @@ See [our other projects][community].
220
223
  We are [available for hire][hire].
221
224
 
222
225
  [thoughtbot]: https://thoughtbot.com?utm_source=github
223
- [thoughtbot-logo]: http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg
226
+ [thoughtbot-logo]: https://thoughtbot.com/brand_assets/93:44.svg
224
227
  [community]: https://thoughtbot.com/community?utm_source=github
225
228
  [hire]: https://thoughtbot.com?utm_source=github
@@ -0,0 +1,19 @@
1
+ # Deploying to Heroku
2
+
3
+ ## Setup
4
+
5
+ Deploying to Heroku requires two additional steps:
6
+
7
+ 1. Set the following environment variables:
8
+
9
+ - `ASSET_HOST`: `siteURL.herokuapp.com`
10
+ - `APPLICATION_HOST`: `siteURL.herokuapp.com`
11
+ - `SMTP_ADDRESS`: `smtp.example.com`
12
+ - `SMTP_DOMAIN`: `example.com`
13
+ - `SMTP_USERNAME`: `username`
14
+ - `SMTP_PASSWORD`: `password`
15
+ - `AUTO_MIGRATE_DB`: `true`
16
+
17
+ ## Execution
18
+
19
+ - Use the `./bin/deploy` convention for deploying to Heroku
@@ -1,7 +1,9 @@
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"
6
+ require "suspenders/generators/stylelint_generator"
5
7
  require "suspenders/generators/forms_generator"
6
8
  require "suspenders/generators/ci_generator"
7
9
  require "suspenders/generators/db_optimizations_generator"
@@ -13,9 +15,17 @@ require "suspenders/generators/views_generator"
13
15
  require "suspenders/generators/js_driver_generator"
14
16
  require "suspenders/generators/json_generator"
15
17
  require "suspenders/generators/testing_generator"
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"
16
22
  require "suspenders/generators/production/force_tls_generator"
23
+ require "suspenders/generators/production/compression_generator"
17
24
  require "suspenders/generators/production/email_generator"
18
25
  require "suspenders/generators/production/timeout_generator"
26
+ require "suspenders/generators/production/deployment_generator"
27
+ require "suspenders/generators/production/manifest_generator"
28
+ require "suspenders/generators/production/single_redirect"
19
29
  require "suspenders/generators/staging/pull_requests_generator"
20
30
  require "suspenders/actions"
21
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
@@ -55,10 +55,6 @@ module Suspenders
55
55
  end
56
56
  end
57
57
 
58
- def create_heroku_application_manifest_file
59
- app_builder.template "app.json.erb", "app.json"
60
- end
61
-
62
58
  def create_heroku_pipeline
63
59
  pipelines_plugin = `heroku help | grep pipelines`
64
60
  if pipelines_plugin.empty?
@@ -88,6 +84,19 @@ module Suspenders
88
84
  end
89
85
  end
90
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
+
91
100
  private
92
101
 
93
102
  attr_reader :app_builder
@@ -96,7 +105,7 @@ module Suspenders
96
105
  heroku_app_name = heroku_app_name_for(environment)
97
106
  <<~SHELL
98
107
 
99
- 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
100
109
  git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
101
110
  printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
102
111
  else
@@ -7,7 +7,6 @@ module Suspenders
7
7
 
8
8
  def_delegators(
9
9
  :heroku_adapter,
10
- :create_heroku_application_manifest_file,
11
10
  :create_heroku_pipeline,
12
11
  :create_production_heroku_app,
13
12
  :create_staging_heroku_app,
@@ -16,6 +15,7 @@ module Suspenders
16
15
  :set_heroku_honeybadger_env,
17
16
  :set_heroku_rails_secrets,
18
17
  :set_heroku_remotes,
18
+ :set_heroku_buildpacks,
19
19
  )
20
20
 
21
21
  def readme
@@ -97,18 +97,6 @@ module Suspenders
97
97
  copy_file "email.rb", "config/initializers/email.rb"
98
98
  end
99
99
 
100
- def enable_rack_canonical_host
101
- config = <<-RUBY
102
- config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
103
- RUBY
104
-
105
- configure_environment "production", config
106
- end
107
-
108
- def enable_rack_deflater
109
- configure_environment "production", "config.middleware.use Rack::Deflater"
110
- end
111
-
112
100
  def setup_asset_host
113
101
  replace_in_file 'config/environments/production.rb',
114
102
  "# config.action_controller.asset_host = 'http://assets.example.com'",
@@ -186,101 +174,25 @@ config.public_file_server.headers = {
186
174
  )
187
175
  end
188
176
 
189
- def replace_default_puma_configuration
190
- copy_file "puma.rb", "config/puma.rb", force: true
191
- end
192
-
193
- def set_up_forego
194
- copy_file "Procfile", "Procfile"
195
- end
196
-
197
- def setup_default_directories
198
- [
199
- 'app/views/pages',
200
- 'spec/lib',
201
- 'spec/controllers',
202
- 'spec/helpers',
203
- 'spec/support/matchers',
204
- 'spec/support/mixins',
205
- 'spec/support/shared_examples'
206
- ].each do |dir|
207
- empty_directory_with_keep_file dir
208
- end
209
- end
210
-
211
- def copy_dotfiles
212
- directory("dotfiles", ".")
213
- end
214
-
215
177
  def create_heroku_apps(flags)
216
178
  create_staging_heroku_app(flags)
217
179
  create_production_heroku_app(flags)
218
180
  end
219
181
 
220
- def create_deploy_script
221
- copy_file "bin_deploy", "bin/deploy"
222
-
223
- instructions = <<-MARKDOWN
224
-
225
- ## Deploying
226
-
227
- If you have previously run the `./bin/setup` script,
228
- you can deploy to staging and production with:
229
-
230
- % ./bin/deploy staging
231
- % ./bin/deploy production
232
- MARKDOWN
233
-
234
- append_file "README.md", instructions
235
- run "chmod a+x bin/deploy"
236
- end
237
-
238
182
  def configure_automatic_deployment
239
- deploy_command = <<-YML.strip_heredoc
240
- deployment:
241
- staging:
242
- branch: master
243
- commands:
244
- - bin/deploy staging
245
- YML
246
-
247
- append_file "circle.yml", deploy_command
183
+ append_file "Procfile", "release: bin/auto_migrate\n"
184
+ copy_file "bin_auto_migrate", "bin/auto_migrate"
248
185
  end
249
186
 
250
187
  def create_github_repo(repo_name)
251
188
  run "hub create #{repo_name}"
252
189
  end
253
190
 
254
- def setup_bundler_audit
255
- copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
256
- append_file "Rakefile", %{\ntask default: "bundle:audit"\n}
257
- end
258
-
259
- def setup_spring
260
- bundle_command "exec spring binstub --all"
261
- end
262
-
263
191
  def copy_miscellaneous_files
264
- copy_file "browserslist", "browserslist"
265
192
  copy_file "errors.rb", "config/initializers/errors.rb"
266
193
  copy_file "json_encoding.rb", "config/initializers/json_encoding.rb"
267
194
  end
268
195
 
269
- def customize_error_pages
270
- meta_tags =<<-EOS
271
- <meta charset="utf-8" />
272
- <meta name="viewport" content="initial-scale=1" />
273
- EOS
274
-
275
- %w(500 404 422).each do |page|
276
- path = "public/#{page}.html"
277
- if File.exist?(path)
278
- inject_into_file path, meta_tags, after: "<head>\n"
279
- replace_in_file path, /<!--.+-->\n/, ''
280
- end
281
- end
282
- end
283
-
284
196
  def remove_config_comment_lines
285
197
  config_files = [
286
198
  "application.rb",