suspenders 1.55.1 → 1.56.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +1 -1
- data/NEWS.md +28 -1
- data/README.md +4 -11
- data/bin/suspenders +29 -2
- data/lib/suspenders/actions/strip_comments_action.rb +254 -0
- data/lib/suspenders/actions.rb +1 -1
- data/lib/suspenders/app_builder.rb +13 -11
- data/lib/suspenders/exit_on_failure.rb +19 -0
- data/lib/suspenders/generators/app_generator.rb +21 -14
- data/lib/suspenders/generators/base.rb +1 -0
- data/lib/suspenders/generators/json_generator.rb +4 -0
- data/lib/suspenders/generators/production/email_generator.rb +2 -2
- data/lib/suspenders/generators/testing_generator.rb +1 -2
- data/lib/suspenders/version.rb +1 -1
- data/lib/suspenders.rb +2 -1
- data/templates/descriptions/testing.md +1 -1
- data/templates/errors.rb +1 -0
- data/templates/oj.rb +3 -0
- data/templates/partials/email_smtp.rb +2 -2
- data/templates/partials/pull_requests_config.rb +5 -4
- data/templates/postgresql_database.yml.erb +1 -0
- metadata +53 -95
- data/.gitignore +0 -5
- data/.standard.yml +0 -2
- data/.travis.yml +0 -15
- data/Gemfile +0 -3
- data/Rakefile +0 -9
- data/USAGE +0 -13
- data/bin/rake +0 -16
- data/bin/rspec +0 -16
- data/bin/setup +0 -13
- data/lib/suspenders/generators/preloader_generator.rb +0 -122
- data/spec/adapters/heroku_spec.rb +0 -98
- data/spec/expand_json_spec.rb +0 -89
- data/spec/fakes/bin/heroku +0 -5
- data/spec/fakes/bin/hub +0 -5
- data/spec/features/advisories_spec.rb +0 -24
- data/spec/features/api_spec.rb +0 -18
- data/spec/features/ci_spec.rb +0 -31
- data/spec/features/cli_help_spec.rb +0 -36
- data/spec/features/db_optimizations_spec.rb +0 -19
- data/spec/features/github_spec.rb +0 -16
- data/spec/features/heroku_spec.rb +0 -64
- data/spec/features/inline_svg_spec.rb +0 -10
- data/spec/features/json_spec.rb +0 -15
- data/spec/features/lint_spec.rb +0 -26
- data/spec/features/new_project_spec.rb +0 -321
- data/spec/features/preloader_spec.rb +0 -25
- data/spec/features/production/compression_spec.rb +0 -23
- data/spec/features/production/deployment_spec.rb +0 -22
- data/spec/features/production/email_spec.rb +0 -47
- data/spec/features/production/manifest_spec.rb +0 -37
- data/spec/features/production/single_redirect_spec.rb +0 -25
- data/spec/features/profiler_spec.rb +0 -20
- data/spec/features/runner_spec.rb +0 -30
- data/spec/features/staging/pull_requests_spec.rb +0 -22
- data/spec/features/static_spec.rb +0 -17
- data/spec/features/stylelint_spec.rb +0 -60
- data/spec/spec_helper.rb +0 -21
- data/spec/support/be_executable_matcher.rb +0 -7
- data/spec/support/contain_json_matcher.rb +0 -30
- data/spec/support/exist_as_a_file_matcher.rb +0 -7
- data/spec/support/fake_github.rb +0 -21
- data/spec/support/fake_heroku.rb +0 -53
- data/spec/support/generators.rb +0 -5
- data/spec/support/match_contents_matcher.rb +0 -6
- data/spec/support/project_files.rb +0 -25
- data/spec/support/rails_template.rb +0 -1
- data/spec/support/suspenders.rb +0 -184
- data/suspenders.gemspec +0 -35
- data/templates/descriptions/preloader.md +0 -3
- data/templates/spring.rb +0 -6
@@ -1,2 +1,2 @@
|
|
1
|
-
config.action_mailer.delivery_method = :smtp
|
2
|
-
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
1
|
+
config.action_mailer.delivery_method = :smtp
|
2
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
@@ -1,4 +1,5 @@
|
|
1
|
-
if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
|
2
|
-
|
3
|
-
|
4
|
-
end
|
1
|
+
if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
|
2
|
+
ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
|
3
|
+
ENV["ASSET_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
|
4
|
+
end
|
5
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.56.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: parser
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rails
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +66,20 @@ dependencies:
|
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: 6.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
84
|
name: rspec
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,28 +120,21 @@ extra_rdoc_files:
|
|
78
120
|
- README.md
|
79
121
|
- LICENSE
|
80
122
|
files:
|
81
|
-
- ".gitignore"
|
82
123
|
- ".ruby-version"
|
83
|
-
- ".standard.yml"
|
84
|
-
- ".travis.yml"
|
85
124
|
- CONTRIBUTING.md
|
86
125
|
- GOALS.md
|
87
|
-
- Gemfile
|
88
126
|
- LICENSE
|
89
127
|
- NEWS.md
|
90
128
|
- README.md
|
91
129
|
- RELEASING.md
|
92
|
-
- Rakefile
|
93
|
-
- USAGE
|
94
|
-
- bin/rake
|
95
|
-
- bin/rspec
|
96
|
-
- bin/setup
|
97
130
|
- bin/suspenders
|
98
131
|
- docs/heroku_deploy.md
|
99
132
|
- lib/suspenders.rb
|
100
133
|
- lib/suspenders/actions.rb
|
134
|
+
- lib/suspenders/actions/strip_comments_action.rb
|
101
135
|
- lib/suspenders/adapters/heroku.rb
|
102
136
|
- lib/suspenders/app_builder.rb
|
137
|
+
- lib/suspenders/exit_on_failure.rb
|
103
138
|
- lib/suspenders/generators/advisories_generator.rb
|
104
139
|
- lib/suspenders/generators/analytics_generator.rb
|
105
140
|
- lib/suspenders/generators/app_generator.rb
|
@@ -113,7 +148,6 @@ files:
|
|
113
148
|
- lib/suspenders/generators/js_driver_generator.rb
|
114
149
|
- lib/suspenders/generators/json_generator.rb
|
115
150
|
- lib/suspenders/generators/lint_generator.rb
|
116
|
-
- lib/suspenders/generators/preloader_generator.rb
|
117
151
|
- lib/suspenders/generators/production/compression_generator.rb
|
118
152
|
- lib/suspenders/generators/production/deployment_generator.rb
|
119
153
|
- lib/suspenders/generators/production/email_generator.rb
|
@@ -130,44 +164,6 @@ files:
|
|
130
164
|
- lib/suspenders/generators/testing_generator.rb
|
131
165
|
- lib/suspenders/generators/views_generator.rb
|
132
166
|
- lib/suspenders/version.rb
|
133
|
-
- spec/adapters/heroku_spec.rb
|
134
|
-
- spec/expand_json_spec.rb
|
135
|
-
- spec/fakes/bin/heroku
|
136
|
-
- spec/fakes/bin/hub
|
137
|
-
- spec/features/advisories_spec.rb
|
138
|
-
- spec/features/api_spec.rb
|
139
|
-
- spec/features/ci_spec.rb
|
140
|
-
- spec/features/cli_help_spec.rb
|
141
|
-
- spec/features/db_optimizations_spec.rb
|
142
|
-
- spec/features/github_spec.rb
|
143
|
-
- spec/features/heroku_spec.rb
|
144
|
-
- spec/features/inline_svg_spec.rb
|
145
|
-
- spec/features/json_spec.rb
|
146
|
-
- spec/features/lint_spec.rb
|
147
|
-
- spec/features/new_project_spec.rb
|
148
|
-
- spec/features/preloader_spec.rb
|
149
|
-
- spec/features/production/compression_spec.rb
|
150
|
-
- spec/features/production/deployment_spec.rb
|
151
|
-
- spec/features/production/email_spec.rb
|
152
|
-
- spec/features/production/manifest_spec.rb
|
153
|
-
- spec/features/production/single_redirect_spec.rb
|
154
|
-
- spec/features/profiler_spec.rb
|
155
|
-
- spec/features/runner_spec.rb
|
156
|
-
- spec/features/staging/pull_requests_spec.rb
|
157
|
-
- spec/features/static_spec.rb
|
158
|
-
- spec/features/stylelint_spec.rb
|
159
|
-
- spec/spec_helper.rb
|
160
|
-
- spec/support/be_executable_matcher.rb
|
161
|
-
- spec/support/contain_json_matcher.rb
|
162
|
-
- spec/support/exist_as_a_file_matcher.rb
|
163
|
-
- spec/support/fake_github.rb
|
164
|
-
- spec/support/fake_heroku.rb
|
165
|
-
- spec/support/generators.rb
|
166
|
-
- spec/support/match_contents_matcher.rb
|
167
|
-
- spec/support/project_files.rb
|
168
|
-
- spec/support/rails_template.rb
|
169
|
-
- spec/support/suspenders.rb
|
170
|
-
- suspenders.gemspec
|
171
167
|
- templates/Gemfile.erb
|
172
168
|
- templates/Procfile
|
173
169
|
- templates/README.md.erb
|
@@ -203,7 +199,6 @@ files:
|
|
203
199
|
- templates/descriptions/json.md
|
204
200
|
- templates/descriptions/lint.md
|
205
201
|
- templates/descriptions/manifest.md
|
206
|
-
- templates/descriptions/preloader.md
|
207
202
|
- templates/descriptions/profiler.md
|
208
203
|
- templates/descriptions/pull_requests.md
|
209
204
|
- templates/descriptions/runner.md
|
@@ -224,6 +219,7 @@ files:
|
|
224
219
|
- templates/i18n.rb
|
225
220
|
- templates/inline_svg.rb
|
226
221
|
- templates/json_encoding.rb
|
222
|
+
- templates/oj.rb
|
227
223
|
- templates/partials/ci_simplecov.rb
|
228
224
|
- templates/partials/db_optimizations_configuration.rb
|
229
225
|
- templates/partials/deployment_readme.md
|
@@ -240,7 +236,6 @@ files:
|
|
240
236
|
- templates/shoulda_matchers_config_rspec.rb
|
241
237
|
- templates/smtp.rb
|
242
238
|
- templates/spec_helper.rb
|
243
|
-
- templates/spring.rb
|
244
239
|
- templates/stylelintrc.json
|
245
240
|
- templates/suspenders_gitignore
|
246
241
|
- templates/suspenders_layout.html.erb.erb
|
@@ -248,7 +243,7 @@ homepage: http://github.com/thoughtbot/suspenders
|
|
248
243
|
licenses:
|
249
244
|
- MIT
|
250
245
|
metadata: {}
|
251
|
-
post_install_message:
|
246
|
+
post_install_message:
|
252
247
|
rdoc_options:
|
253
248
|
- "--charset=UTF-8"
|
254
249
|
require_paths:
|
@@ -257,52 +252,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
252
|
requirements:
|
258
253
|
- - ">="
|
259
254
|
- !ruby/object:Gem::Version
|
260
|
-
version: 2.
|
255
|
+
version: 2.7.4
|
261
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
257
|
requirements:
|
263
258
|
- - ">="
|
264
259
|
- !ruby/object:Gem::Version
|
265
260
|
version: 2.7.4
|
266
261
|
requirements: []
|
267
|
-
rubygems_version: 3.1.
|
268
|
-
signing_key:
|
262
|
+
rubygems_version: 3.1.6
|
263
|
+
signing_key:
|
269
264
|
specification_version: 4
|
270
265
|
summary: Generate a Rails app using thoughtbot's best practices.
|
271
|
-
test_files:
|
272
|
-
- spec/adapters/heroku_spec.rb
|
273
|
-
- spec/expand_json_spec.rb
|
274
|
-
- spec/fakes/bin/heroku
|
275
|
-
- spec/fakes/bin/hub
|
276
|
-
- spec/features/advisories_spec.rb
|
277
|
-
- spec/features/api_spec.rb
|
278
|
-
- spec/features/ci_spec.rb
|
279
|
-
- spec/features/cli_help_spec.rb
|
280
|
-
- spec/features/db_optimizations_spec.rb
|
281
|
-
- spec/features/github_spec.rb
|
282
|
-
- spec/features/heroku_spec.rb
|
283
|
-
- spec/features/inline_svg_spec.rb
|
284
|
-
- spec/features/json_spec.rb
|
285
|
-
- spec/features/lint_spec.rb
|
286
|
-
- spec/features/new_project_spec.rb
|
287
|
-
- spec/features/preloader_spec.rb
|
288
|
-
- spec/features/production/compression_spec.rb
|
289
|
-
- spec/features/production/deployment_spec.rb
|
290
|
-
- spec/features/production/email_spec.rb
|
291
|
-
- spec/features/production/manifest_spec.rb
|
292
|
-
- spec/features/production/single_redirect_spec.rb
|
293
|
-
- spec/features/profiler_spec.rb
|
294
|
-
- spec/features/runner_spec.rb
|
295
|
-
- spec/features/staging/pull_requests_spec.rb
|
296
|
-
- spec/features/static_spec.rb
|
297
|
-
- spec/features/stylelint_spec.rb
|
298
|
-
- spec/spec_helper.rb
|
299
|
-
- spec/support/be_executable_matcher.rb
|
300
|
-
- spec/support/contain_json_matcher.rb
|
301
|
-
- spec/support/exist_as_a_file_matcher.rb
|
302
|
-
- spec/support/fake_github.rb
|
303
|
-
- spec/support/fake_heroku.rb
|
304
|
-
- spec/support/generators.rb
|
305
|
-
- spec/support/match_contents_matcher.rb
|
306
|
-
- spec/support/project_files.rb
|
307
|
-
- spec/support/rails_template.rb
|
308
|
-
- spec/support/suspenders.rb
|
266
|
+
test_files: []
|
data/.standard.yml
DELETED
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm: 2.6.6
|
3
|
-
cache: bundler
|
4
|
-
before_install:
|
5
|
-
- nvm install 13.12.0
|
6
|
-
- git config --global user.name 'Travis CI'
|
7
|
-
- git config --global user.email 'travis-ci@example.com'
|
8
|
-
- gem update --system
|
9
|
-
- gem install bundler
|
10
|
-
- bundler config --global disable_platform_warnings true
|
11
|
-
install: bundle install
|
12
|
-
notifications:
|
13
|
-
email: false
|
14
|
-
services:
|
15
|
-
- postgresql
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/USAGE
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Suspenders is a Rails template with thoughtbot standard
|
3
|
-
defaults, ready to deploy to Heroku.
|
4
|
-
|
5
|
-
For full details on the changes we've made compared to
|
6
|
-
a vanilla Rails app, check our GitHub project:
|
7
|
-
https://github.com/thoughtbot/suspenders
|
8
|
-
|
9
|
-
Example:
|
10
|
-
suspenders ~/Code/weblog
|
11
|
-
|
12
|
-
This generates a Rails installation in ~/Code/weblog configured
|
13
|
-
with our preferred defaults.
|
data/bin/rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rake' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('rake', 'rake')
|
data/bin/rspec
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rspec' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/setup
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# Run this script immediately after cloning the codebase.
|
4
|
-
|
5
|
-
# Exit if any subcommand fails
|
6
|
-
set -e
|
7
|
-
|
8
|
-
# Set up Ruby dependencies via Bundler
|
9
|
-
bundle install
|
10
|
-
|
11
|
-
# Add binstubs to PATH in ~/.zshenv like this:
|
12
|
-
# export PATH=".git/safe/../../bin:$PATH"
|
13
|
-
mkdir -p .git/safe
|
@@ -1,122 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class PreloaderGenerator < Generators::Base
|
5
|
-
def spring_config
|
6
|
-
template "spring.rb", "config/spring.rb", force: false, skip: true
|
7
|
-
end
|
8
|
-
|
9
|
-
def spring_gem
|
10
|
-
always_gsub_file("Gemfile", /# Spring speeds up development.*/, "")
|
11
|
-
|
12
|
-
gem_group :development do
|
13
|
-
gem "spring"
|
14
|
-
gem "spring-watcher-listen", "~> 2.0.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
18
|
-
end
|
19
|
-
|
20
|
-
def cache_classes_test
|
21
|
-
action UncacheClasses.new(self, "config/environments/test.rb")
|
22
|
-
end
|
23
|
-
|
24
|
-
def spring_binstubs
|
25
|
-
action SpringBinstubs.new(self)
|
26
|
-
end
|
27
|
-
|
28
|
-
class SpringBinstubs
|
29
|
-
def initialize(base)
|
30
|
-
@base = base
|
31
|
-
end
|
32
|
-
|
33
|
-
def invoke!
|
34
|
-
Bundler.with_unbundled_env do
|
35
|
-
@base.send(:always_run, "spring binstub --all")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def revoke!
|
40
|
-
Bundler.with_unbundled_env do
|
41
|
-
@base.send(:always_run, "spring binstub --remove --all")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class UncacheClasses
|
47
|
-
def initialize(base, config_file)
|
48
|
-
@base = base
|
49
|
-
@config_file = config_file
|
50
|
-
end
|
51
|
-
|
52
|
-
def invoke!
|
53
|
-
@base.send(
|
54
|
-
:always_gsub_file,
|
55
|
-
@config_file,
|
56
|
-
"config.cache_classes = true",
|
57
|
-
"config.cache_classes = false"
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
def revoke!
|
62
|
-
@base.send(
|
63
|
-
:always_gsub_file,
|
64
|
-
@config_file,
|
65
|
-
"config.cache_classes = false",
|
66
|
-
"config.cache_classes = true"
|
67
|
-
)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
protected
|
72
|
-
|
73
|
-
def always_run(command, with: nil, verbose: true, env: nil, capture: nil,
|
74
|
-
abort_on_failure: nil)
|
75
|
-
destination = relative_to_original_destination_root(
|
76
|
-
destination_root,
|
77
|
-
false
|
78
|
-
)
|
79
|
-
desc = "#{command} from #{destination.inspect}"
|
80
|
-
|
81
|
-
if with
|
82
|
-
desc = "#{File.basename(with.to_s)} #{desc}"
|
83
|
-
command = "#{with} #{command}"
|
84
|
-
end
|
85
|
-
|
86
|
-
say_status :run, desc, verbose
|
87
|
-
|
88
|
-
return if options[:pretend]
|
89
|
-
|
90
|
-
env_splat = [env] if env
|
91
|
-
|
92
|
-
if capture
|
93
|
-
result, status = Open3.capture2e(*env_splat, command.to_s)
|
94
|
-
success = status.success?
|
95
|
-
else
|
96
|
-
result = system(*env_splat, command.to_s)
|
97
|
-
success = result
|
98
|
-
end
|
99
|
-
|
100
|
-
if abort_on_failure.nil?
|
101
|
-
abort_on_failure = self.class.send(:exit_on_failure?)
|
102
|
-
end
|
103
|
-
|
104
|
-
if !success && abort_on_failure
|
105
|
-
abort
|
106
|
-
end
|
107
|
-
|
108
|
-
result
|
109
|
-
end
|
110
|
-
|
111
|
-
def always_gsub_file(path, flag, replacement, verbose: true)
|
112
|
-
path = File.expand_path(path, destination_root)
|
113
|
-
say_status :gsub, relative_to_original_destination_root(path), verbose
|
114
|
-
|
115
|
-
unless options[:pretend]
|
116
|
-
content = File.binread(path)
|
117
|
-
content.gsub!(flag, replacement)
|
118
|
-
File.open(path, "wb") { |file| file.write(content) }
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Adapters
|
5
|
-
RSpec.describe Heroku do
|
6
|
-
it "sets the heroku remotes" do
|
7
|
-
setup_file = "bin/setup"
|
8
|
-
app_builder = double(app_name: app_name)
|
9
|
-
allow(app_builder).to receive(:append_file)
|
10
|
-
|
11
|
-
Heroku.new(app_builder).set_heroku_remotes
|
12
|
-
|
13
|
-
expect(app_builder).to have_received(:append_file)
|
14
|
-
.with(setup_file, /heroku apps:info --app #{app_name.dasherize}-production/)
|
15
|
-
expect(app_builder).to have_received(:append_file)
|
16
|
-
.with(setup_file, /heroku apps:info --app #{app_name.dasherize}-staging/)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "sets the heroku rails secrets" do
|
20
|
-
app_builder = double(app_name: app_name)
|
21
|
-
allow(app_builder).to receive(:run)
|
22
|
-
|
23
|
-
Heroku.new(app_builder).set_heroku_rails_secrets
|
24
|
-
|
25
|
-
expect(app_builder).to(
|
26
|
-
have_configured_var("staging", "SECRET_KEY_BASE")
|
27
|
-
)
|
28
|
-
expect(app_builder).to(
|
29
|
-
have_configured_var("production", "SECRET_KEY_BASE")
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "sets the heroku backup schedule" do
|
34
|
-
app_builder = double(app_name: app_name)
|
35
|
-
allow(app_builder).to receive(:run)
|
36
|
-
|
37
|
-
Heroku.new(app_builder).set_heroku_backup_schedule
|
38
|
-
|
39
|
-
expect(app_builder).to have_backup_schedule("staging")
|
40
|
-
expect(app_builder).to have_backup_schedule("production")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "sets the application host" do
|
44
|
-
app_builder = double(app_name: app_name)
|
45
|
-
allow(app_builder).to receive(:run)
|
46
|
-
|
47
|
-
Heroku.new(app_builder).set_heroku_application_host
|
48
|
-
|
49
|
-
expect(app_builder).to(
|
50
|
-
have_configured_var("staging", "APPLICATION_HOST")
|
51
|
-
)
|
52
|
-
|
53
|
-
expect(app_builder).to(
|
54
|
-
have_configured_var("production", "APPLICATION_HOST")
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "configures nodejs and ruby packs" do
|
59
|
-
app_builder = double(app_name: app_name)
|
60
|
-
allow(app_builder).to receive(:run)
|
61
|
-
|
62
|
-
Heroku.new(app_builder).set_heroku_buildpacks
|
63
|
-
|
64
|
-
%w[staging production].each do |remote|
|
65
|
-
expect(app_builder).to(
|
66
|
-
have_configured_buildpack(
|
67
|
-
remote_name: remote, index: 1, packname: "heroku/nodejs"
|
68
|
-
)
|
69
|
-
)
|
70
|
-
expect(app_builder).to(
|
71
|
-
have_configured_buildpack(
|
72
|
-
remote_name: remote, index: 2, packname: "heroku/ruby"
|
73
|
-
)
|
74
|
-
)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def app_name
|
79
|
-
SuspendersTestHelpers::APP_NAME
|
80
|
-
end
|
81
|
-
|
82
|
-
def have_backup_schedule(remote_name)
|
83
|
-
have_received(:run)
|
84
|
-
.with(/pg:backups:schedule DATABASE_URL --at '10:00 UTC' --remote #{remote_name}/)
|
85
|
-
end
|
86
|
-
|
87
|
-
def have_configured_var(remote_name, var)
|
88
|
-
have_received(:run).with(/config:add #{var}=.+ --remote #{remote_name}/)
|
89
|
-
end
|
90
|
-
|
91
|
-
def have_configured_buildpack(remote_name:, index:, packname:)
|
92
|
-
have_received(:run).with(
|
93
|
-
/buildpacks:add --index #{index} #{packname} --remote #{remote_name}/
|
94
|
-
)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/spec/expand_json_spec.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Suspenders::Actions::ExpandJson do
|
4
|
-
let(:destination_root) { File.join(root_path, "tmp") }
|
5
|
-
let(:destination_file_name) { "app.json" }
|
6
|
-
let(:destination_path) { File.join(destination_root, destination_file_name) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
FileUtils.rm destination_path if File.exist?(destination_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#invoke!" do
|
13
|
-
context "when calling multiple times with the same root key" do
|
14
|
-
before do
|
15
|
-
described_class.new(
|
16
|
-
destination_root,
|
17
|
-
destination_file_name,
|
18
|
-
env: {
|
19
|
-
SMTP_ADDRESS: {required: true}
|
20
|
-
}
|
21
|
-
).invoke!
|
22
|
-
end
|
23
|
-
|
24
|
-
it "deep merges the hash" do
|
25
|
-
described_class.new(
|
26
|
-
destination_root,
|
27
|
-
destination_file_name,
|
28
|
-
env: {
|
29
|
-
HEROKU_APP_NAME: {required: true}
|
30
|
-
}
|
31
|
-
).invoke!
|
32
|
-
|
33
|
-
expected = <<~JSON
|
34
|
-
{
|
35
|
-
"env": {
|
36
|
-
"SMTP_ADDRESS": {
|
37
|
-
"required": true
|
38
|
-
},
|
39
|
-
"HEROKU_APP_NAME": {
|
40
|
-
"required": true
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
JSON
|
45
|
-
expect(existing_json).to eq(expected.chomp)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#revoke!" do
|
51
|
-
before do
|
52
|
-
described_class.new(
|
53
|
-
destination_root,
|
54
|
-
destination_file_name,
|
55
|
-
env: {
|
56
|
-
foo: {required: true},
|
57
|
-
bar: {required: true}
|
58
|
-
}
|
59
|
-
).invoke!
|
60
|
-
end
|
61
|
-
|
62
|
-
it "removes data from the JSON" do
|
63
|
-
described_class.new(
|
64
|
-
destination_root,
|
65
|
-
destination_file_name,
|
66
|
-
env: {
|
67
|
-
foo: {required: true}
|
68
|
-
}
|
69
|
-
).revoke!
|
70
|
-
|
71
|
-
expected = <<~JSON
|
72
|
-
{
|
73
|
-
"env": {
|
74
|
-
"bar": {
|
75
|
-
"required": true
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
JSON
|
80
|
-
expect(existing_json).to eq(expected.chomp)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
private
|
85
|
-
|
86
|
-
def existing_json
|
87
|
-
IO.read(destination_path)
|
88
|
-
end
|
89
|
-
end
|