suspenders 1.54.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 +38 -1
- data/README.md +5 -12
- 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/adapters/heroku.rb +16 -16
- data/lib/suspenders/app_builder.rb +49 -47
- data/lib/suspenders/exit_on_failure.rb +19 -0
- data/lib/suspenders/generators/advisories_generator.rb +1 -1
- data/lib/suspenders/generators/analytics_generator.rb +1 -1
- data/lib/suspenders/generators/app_generator.rb +30 -23
- data/lib/suspenders/generators/base.rb +3 -2
- data/lib/suspenders/generators/db_optimizations_generator.rb +2 -2
- data/lib/suspenders/generators/factories_generator.rb +1 -1
- data/lib/suspenders/generators/jobs_generator.rb +3 -3
- data/lib/suspenders/generators/js_driver_generator.rb +1 -1
- data/lib/suspenders/generators/json_generator.rb +4 -0
- data/lib/suspenders/generators/lint_generator.rb +5 -0
- data/lib/suspenders/generators/production/compression_generator.rb +1 -1
- data/lib/suspenders/generators/production/email_generator.rb +7 -7
- data/lib/suspenders/generators/production/manifest_generator.rb +8 -8
- data/lib/suspenders/generators/production/single_redirect.rb +1 -1
- data/lib/suspenders/generators/production/timeout_generator.rb +2 -2
- data/lib/suspenders/generators/profiler_generator.rb +4 -4
- data/lib/suspenders/generators/runner_generator.rb +4 -4
- data/lib/suspenders/generators/staging/pull_requests_generator.rb +2 -2
- data/lib/suspenders/generators/stylelint_generator.rb +2 -1
- data/lib/suspenders/generators/stylesheet_base_generator.rb +1 -1
- data/lib/suspenders/generators/testing_generator.rb +2 -3
- data/lib/suspenders/version.rb +5 -5
- data/lib/suspenders.rb +2 -1
- data/templates/capybara_silence_puma.rb +1 -1
- data/templates/descriptions/testing.md +1 -1
- data/templates/errors.rb +4 -3
- data/templates/hound.yml +1 -2
- data/templates/oj.rb +3 -0
- data/templates/partials/ci_simplecov.rb +0 -2
- data/templates/partials/email_smtp.rb +0 -1
- data/templates/partials/pull_requests_config.rb +4 -4
- data/templates/partials/runner_setup.rb +1 -2
- data/templates/postgresql_database.yml.erb +1 -0
- data/templates/spec_helper.rb +1 -1
- metadata +64 -89
- data/.gitignore +0 -5
- data/.travis.yml +0 -15
- data/Gemfile +0 -3
- data/Rakefile +0 -8
- 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/new_project_spec.rb +0 -319
- 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 -185
- data/suspenders.gemspec +0 -35
- data/templates/descriptions/preloader.md +0 -3
- data/templates/spring.rb +0 -6
@@ -15,11 +15,11 @@ module Suspenders
|
|
15
15
|
:set_heroku_honeybadger_env,
|
16
16
|
:set_heroku_rails_secrets,
|
17
17
|
:set_heroku_remotes,
|
18
|
-
:set_heroku_buildpacks
|
18
|
+
:set_heroku_buildpacks
|
19
19
|
)
|
20
20
|
|
21
21
|
def readme
|
22
|
-
template
|
22
|
+
template "README.md.erb", "README.md"
|
23
23
|
end
|
24
24
|
|
25
25
|
def gitignore
|
@@ -33,7 +33,7 @@ module Suspenders
|
|
33
33
|
def setup_rack_mini_profiler
|
34
34
|
copy_file(
|
35
35
|
"rack_mini_profiler.rb",
|
36
|
-
"config/initializers/rack_mini_profiler.rb"
|
36
|
+
"config/initializers/rack_mini_profiler.rb"
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
@@ -42,15 +42,15 @@ module Suspenders
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def raise_on_delivery_errors
|
45
|
-
replace_in_file
|
46
|
-
|
45
|
+
replace_in_file "config/environments/development.rb",
|
46
|
+
"raise_delivery_errors = false", "raise_delivery_errors = true"
|
47
47
|
end
|
48
48
|
|
49
49
|
def set_test_delivery_method
|
50
50
|
inject_into_file(
|
51
51
|
"config/environments/development.rb",
|
52
52
|
"\n config.action_mailer.delivery_method = :file",
|
53
|
-
after: "config.action_mailer.raise_delivery_errors = true"
|
53
|
+
after: "config.action_mailer.raise_delivery_errors = true"
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
@@ -81,7 +81,8 @@ module Suspenders
|
|
81
81
|
config.generators do |generate|
|
82
82
|
generate.helper false
|
83
83
|
generate.javascripts false
|
84
|
-
generate.
|
84
|
+
generate.controller_specs false
|
85
|
+
generate.request_specs true
|
85
86
|
generate.routing_specs false
|
86
87
|
generate.stylesheets false
|
87
88
|
generate.test_framework :rspec
|
@@ -90,7 +91,7 @@ module Suspenders
|
|
90
91
|
|
91
92
|
RUBY
|
92
93
|
|
93
|
-
inject_into_class
|
94
|
+
inject_into_class "config/application.rb", "Application", config
|
94
95
|
end
|
95
96
|
|
96
97
|
def configure_local_mail
|
@@ -98,27 +99,27 @@ module Suspenders
|
|
98
99
|
end
|
99
100
|
|
100
101
|
def setup_asset_host
|
101
|
-
replace_in_file
|
102
|
+
replace_in_file "config/environments/production.rb",
|
102
103
|
"# config.action_controller.asset_host = 'http://assets.example.com'",
|
103
104
|
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))'
|
104
105
|
|
105
106
|
if File.exist?("config/initializers/assets.rb")
|
106
|
-
replace_in_file
|
107
|
+
replace_in_file "config/initializers/assets.rb",
|
107
108
|
"config.assets.version = '1.0'",
|
108
109
|
'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")'
|
109
110
|
end
|
110
111
|
|
111
|
-
config =
|
112
|
-
config.public_file_server.headers = {
|
113
|
-
|
114
|
-
|
112
|
+
config = <<~EOD
|
113
|
+
config.public_file_server.headers = {
|
114
|
+
"Cache-Control" => "public, max-age=31557600",
|
115
|
+
}
|
115
116
|
EOD
|
116
117
|
|
117
118
|
configure_environment("production", config)
|
118
119
|
end
|
119
120
|
|
120
121
|
def setup_secret_token
|
121
|
-
template
|
122
|
+
template "secrets.yml", "config/secrets.yml", force: true
|
122
123
|
end
|
123
124
|
|
124
125
|
def disallow_wrapping_parameters
|
@@ -126,7 +127,7 @@ config.public_file_server.headers = {
|
|
126
127
|
end
|
127
128
|
|
128
129
|
def use_postgres_config_template
|
129
|
-
template
|
130
|
+
template "postgresql_database.yml.erb", "config/database.yml",
|
130
131
|
force: true
|
131
132
|
end
|
132
133
|
|
@@ -134,10 +135,14 @@ config.public_file_server.headers = {
|
|
134
135
|
bundle_command "exec rails db:create db:migrate"
|
135
136
|
end
|
136
137
|
|
138
|
+
def run_database_migrations
|
139
|
+
bundle_command "exec rails db:migrate"
|
140
|
+
end
|
141
|
+
|
137
142
|
def replace_gemfile(path)
|
138
|
-
template
|
143
|
+
template "Gemfile.erb", "Gemfile", force: true do |content|
|
139
144
|
if path
|
140
|
-
content.gsub(%r{gem .suspenders.}) { |s| %
|
145
|
+
content.gsub(%r{gem .suspenders.}) { |s| %(#{s}, path: "#{path}") }
|
141
146
|
else
|
142
147
|
content
|
143
148
|
end
|
@@ -145,7 +150,7 @@ config.public_file_server.headers = {
|
|
145
150
|
end
|
146
151
|
|
147
152
|
def ruby_version
|
148
|
-
create_file
|
153
|
+
create_file ".ruby-version", "#{Suspenders::RUBY_VERSION}\n"
|
149
154
|
end
|
150
155
|
|
151
156
|
def configure_i18n_for_missing_translations
|
@@ -154,7 +159,7 @@ config.public_file_server.headers = {
|
|
154
159
|
end
|
155
160
|
|
156
161
|
def configure_action_mailer_in_specs
|
157
|
-
copy_file
|
162
|
+
copy_file "action_mailer.rb", "spec/support/action_mailer.rb"
|
158
163
|
end
|
159
164
|
|
160
165
|
def configure_time_formats
|
@@ -163,15 +168,17 @@ config.public_file_server.headers = {
|
|
163
168
|
end
|
164
169
|
|
165
170
|
def configure_action_mailer
|
166
|
-
action_mailer_host "development", %
|
167
|
-
action_mailer_asset_host "development", %
|
168
|
-
action_mailer_host "test", %
|
169
|
-
action_mailer_asset_host "test", %
|
171
|
+
action_mailer_host "development", %("localhost:3000")
|
172
|
+
action_mailer_asset_host "development", %("http://localhost:3000")
|
173
|
+
action_mailer_host "test", %("www.example.com")
|
174
|
+
action_mailer_asset_host "test", %("http://www.example.com")
|
170
175
|
action_mailer_host "production", %{ENV.fetch("APPLICATION_HOST")}
|
176
|
+
# rubocop:disable Lint/InterpolationCheck
|
171
177
|
action_mailer_asset_host(
|
172
178
|
"production",
|
173
|
-
%{ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))}
|
179
|
+
%q{"https://#{ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))}"}
|
174
180
|
)
|
181
|
+
# rubocop:enable Lint/InterpolationCheck
|
175
182
|
end
|
176
183
|
|
177
184
|
def create_heroku_apps(flags)
|
@@ -199,40 +206,35 @@ config.public_file_server.headers = {
|
|
199
206
|
"environment.rb",
|
200
207
|
"environments/development.rb",
|
201
208
|
"environments/production.rb",
|
202
|
-
"environments/test.rb"
|
209
|
+
"environments/test.rb"
|
203
210
|
]
|
204
211
|
|
205
212
|
config_files.each do |config_file|
|
206
|
-
path =
|
207
|
-
|
208
|
-
accepted_content = File.readlines(path).reject do |line|
|
209
|
-
line =~ /^.*#.*$/ || line =~ /^$\n/
|
210
|
-
end
|
213
|
+
path = Pathname(destination_root).join("config", config_file)
|
214
|
+
source = Actions::StripCommentsAction.call(path.read)
|
211
215
|
|
212
|
-
|
213
|
-
accepted_content.each { |line| file.puts line }
|
214
|
-
end
|
216
|
+
path.write(source)
|
215
217
|
end
|
216
218
|
end
|
217
219
|
|
218
220
|
def remove_routes_comment_lines
|
219
|
-
replace_in_file
|
221
|
+
replace_in_file "config/routes.rb",
|
220
222
|
/Rails\.application\.routes\.draw do.*end/m,
|
221
223
|
"Rails.application.routes.draw do\nend"
|
222
224
|
end
|
223
225
|
|
224
226
|
def setup_default_rake_task
|
225
|
-
append_file
|
226
|
-
|
227
|
-
task(:default).clear
|
228
|
-
task default: [:spec]
|
229
|
-
|
230
|
-
if defined? RSpec
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
end
|
227
|
+
append_file "Rakefile" do
|
228
|
+
<<~EOS
|
229
|
+
task(:default).clear
|
230
|
+
task default: [:spec]
|
231
|
+
|
232
|
+
if defined? RSpec
|
233
|
+
task(:spec).clear
|
234
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
235
|
+
t.verbose = false
|
236
|
+
end
|
237
|
+
end
|
236
238
|
EOS
|
237
239
|
end
|
238
240
|
end
|
@@ -240,7 +242,7 @@ end
|
|
240
242
|
private
|
241
243
|
|
242
244
|
def raise_on_missing_translations_in(environment)
|
243
|
-
config =
|
245
|
+
config = "config.action_view.raise_on_missing_translations = true"
|
244
246
|
|
245
247
|
uncomment_lines("config/environments/#{environment}.rb", config)
|
246
248
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
require "English"
|
3
|
+
|
4
|
+
module Suspenders
|
5
|
+
module ExitOnFailure
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
def bundle_command(*)
|
9
|
+
super
|
10
|
+
exit(false) if $CHILD_STATUS.exitstatus.nonzero?
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def exit_on_failure?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails/generators"
|
2
|
+
require "rails/generators/rails/app/app_generator"
|
3
3
|
|
4
4
|
module Suspenders
|
5
5
|
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
include ExitOnFailure
|
7
|
+
|
6
8
|
hide!
|
7
9
|
|
8
10
|
class_option :database, type: :string, aliases: "-d", default: "postgresql",
|
@@ -20,7 +22,7 @@ module Suspenders
|
|
20
22
|
class_option :version, type: :boolean, aliases: "-v", group: :suspenders,
|
21
23
|
desc: "Show Suspenders version number and quit"
|
22
24
|
|
23
|
-
class_option :help, type: :boolean, aliases:
|
25
|
+
class_option :help, type: :boolean, aliases: "-h", group: :suspenders,
|
24
26
|
desc: "Show this help message and quit"
|
25
27
|
|
26
28
|
class_option :path, type: :string, default: nil,
|
@@ -30,10 +32,13 @@ module Suspenders
|
|
30
32
|
desc: "Skip Test Unit"
|
31
33
|
|
32
34
|
class_option :skip_system_test,
|
33
|
-
|
35
|
+
type: :boolean, default: true, desc: "Skip system test files"
|
34
36
|
|
35
37
|
class_option :skip_turbolinks,
|
36
|
-
|
38
|
+
type: :boolean, default: true, desc: "Skip turbolinks gem"
|
39
|
+
|
40
|
+
class_option :skip_spring, type: :boolean, default: true,
|
41
|
+
desc: class_options[:skip_spring].description
|
37
42
|
|
38
43
|
def finish_template
|
39
44
|
invoke :suspenders_customization
|
@@ -54,18 +59,19 @@ module Suspenders
|
|
54
59
|
invoke :generate_deployment_default
|
55
60
|
invoke :remove_config_comment_lines
|
56
61
|
invoke :remove_routes_comment_lines
|
62
|
+
invoke :run_database_migrations
|
57
63
|
invoke :outro
|
58
64
|
end
|
59
65
|
|
60
66
|
def customize_gemfile
|
61
67
|
build :replace_gemfile, options[:path]
|
62
|
-
bundle_command
|
68
|
+
bundle_command "install"
|
63
69
|
end
|
64
70
|
|
65
71
|
def setup_database
|
66
|
-
say
|
72
|
+
say "Setting up database"
|
67
73
|
|
68
|
-
if
|
74
|
+
if options[:database] == "postgresql"
|
69
75
|
build :use_postgres_config_template
|
70
76
|
end
|
71
77
|
|
@@ -73,7 +79,7 @@ module Suspenders
|
|
73
79
|
end
|
74
80
|
|
75
81
|
def setup_development_environment
|
76
|
-
say
|
82
|
+
say "Setting up the development environment"
|
77
83
|
build :configure_local_mail
|
78
84
|
build :raise_on_missing_assets_in_test
|
79
85
|
build :raise_on_delivery_errors
|
@@ -86,17 +92,17 @@ module Suspenders
|
|
86
92
|
end
|
87
93
|
|
88
94
|
def setup_production_environment
|
89
|
-
say
|
95
|
+
say "Setting up the production environment"
|
90
96
|
build :setup_asset_host
|
91
97
|
end
|
92
98
|
|
93
99
|
def setup_secret_token
|
94
|
-
say
|
100
|
+
say "Moving secret token out of version control"
|
95
101
|
build :setup_secret_token
|
96
102
|
end
|
97
103
|
|
98
104
|
def configure_app
|
99
|
-
say
|
105
|
+
say "Configuring app"
|
100
106
|
build :configure_action_mailer
|
101
107
|
build :configure_time_formats
|
102
108
|
build :setup_default_rake_task
|
@@ -119,13 +125,13 @@ module Suspenders
|
|
119
125
|
|
120
126
|
def create_github_repo
|
121
127
|
if !options[:skip_git] && options[:github]
|
122
|
-
say
|
128
|
+
say "Creating Github repo"
|
123
129
|
build :create_github_repo, options[:github]
|
124
130
|
end
|
125
131
|
end
|
126
132
|
|
127
133
|
def copy_miscellaneous_files
|
128
|
-
say
|
134
|
+
say "Copying miscellaneous support files"
|
129
135
|
build :copy_miscellaneous_files
|
130
136
|
end
|
131
137
|
|
@@ -137,18 +143,21 @@ module Suspenders
|
|
137
143
|
build :remove_routes_comment_lines
|
138
144
|
end
|
139
145
|
|
146
|
+
def run_database_migrations
|
147
|
+
build :run_database_migrations
|
148
|
+
end
|
149
|
+
|
140
150
|
def generate_default
|
141
|
-
run("spring stop")
|
151
|
+
run("spring stop > /dev/null 2>&1 || true")
|
152
|
+
generate("suspenders:runner")
|
142
153
|
generate("suspenders:profiler")
|
143
154
|
generate("suspenders:json")
|
144
155
|
generate("suspenders:static")
|
145
|
-
generate("suspenders:stylesheet_base")
|
156
|
+
generate("suspenders:stylesheet_base") unless options[:api]
|
146
157
|
generate("suspenders:testing")
|
147
158
|
generate("suspenders:ci")
|
148
159
|
generate("suspenders:js_driver")
|
149
|
-
unless options[:api]
|
150
|
-
generate("suspenders:forms")
|
151
|
-
end
|
160
|
+
generate("suspenders:forms") unless options[:api]
|
152
161
|
generate("suspenders:db_optimizations")
|
153
162
|
generate("suspenders:factories")
|
154
163
|
generate("suspenders:lint")
|
@@ -156,8 +165,6 @@ module Suspenders
|
|
156
165
|
generate("suspenders:analytics")
|
157
166
|
generate("suspenders:inline_svg")
|
158
167
|
generate("suspenders:advisories")
|
159
|
-
generate("suspenders:runner")
|
160
|
-
generate("suspenders:preloader")
|
161
168
|
end
|
162
169
|
|
163
170
|
def generate_deployment_default
|
@@ -176,12 +183,12 @@ module Suspenders
|
|
176
183
|
end
|
177
184
|
|
178
185
|
def outro
|
179
|
-
say
|
186
|
+
say "Congratulations! You just pulled our suspenders."
|
180
187
|
say honeybadger_outro
|
181
188
|
end
|
182
189
|
|
183
190
|
def self.banner
|
184
|
-
"suspenders #{arguments.map(&:usage).join(
|
191
|
+
"suspenders #{arguments.map(&:usage).join(" ")} [options]"
|
185
192
|
end
|
186
193
|
|
187
194
|
protected
|
@@ -5,6 +5,7 @@ module Suspenders
|
|
5
5
|
module Generators
|
6
6
|
class Base < Rails::Generators::Base
|
7
7
|
include Suspenders::Actions
|
8
|
+
include ExitOnFailure
|
8
9
|
|
9
10
|
def self.default_source_root
|
10
11
|
File.expand_path(File.join("..", "..", "..", "templates"), __dir__)
|
@@ -17,8 +18,8 @@ module Suspenders
|
|
17
18
|
File.join(
|
18
19
|
default_source_root,
|
19
20
|
"descriptions",
|
20
|
-
"#{subclass.generator_name}.md"
|
21
|
-
)
|
21
|
+
"#{subclass.generator_name}.md"
|
22
|
+
)
|
22
23
|
)
|
23
24
|
|
24
25
|
subclass.desc File.read(description_file)
|
@@ -3,7 +3,7 @@ require_relative "base"
|
|
3
3
|
module Suspenders
|
4
4
|
class DbOptimizationsGenerator < Generators::Base
|
5
5
|
def add_bullet
|
6
|
-
gem "bullet", group: %i
|
6
|
+
gem "bullet", group: %i[development test]
|
7
7
|
Bundler.with_unbundled_env { run "bundle install" }
|
8
8
|
end
|
9
9
|
|
@@ -11,7 +11,7 @@ module Suspenders
|
|
11
11
|
inject_template_into_file(
|
12
12
|
"config/environments/development.rb",
|
13
13
|
"partials/db_optimizations_configuration.rb",
|
14
|
-
after: /config.action_mailer.raise_delivery_errors =
|
14
|
+
after: /config.action_mailer.raise_delivery_errors = .*/
|
15
15
|
)
|
16
16
|
end
|
17
17
|
end
|
@@ -3,7 +3,7 @@ require_relative "base"
|
|
3
3
|
module Suspenders
|
4
4
|
class FactoriesGenerator < Generators::Base
|
5
5
|
def add_factory_bot
|
6
|
-
gem "factory_bot_rails", group: %i
|
6
|
+
gem "factory_bot_rails", group: %i[development test]
|
7
7
|
Bundler.with_unbundled_env { run "bundle install" }
|
8
8
|
end
|
9
9
|
|
@@ -14,13 +14,13 @@ module Suspenders
|
|
14
14
|
def initialize_active_job
|
15
15
|
copy_file(
|
16
16
|
"active_job.rb",
|
17
|
-
"config/initializers/active_job.rb"
|
17
|
+
"config/initializers/active_job.rb"
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
21
|
def configure_active_job
|
22
22
|
configure_application_file(
|
23
|
-
"config.active_job.queue_adapter = :delayed_job"
|
23
|
+
"config.active_job.queue_adapter = :delayed_job"
|
24
24
|
)
|
25
25
|
configure_environment "test", "config.active_job.queue_adapter = :inline"
|
26
26
|
end
|
@@ -31,7 +31,7 @@ module Suspenders
|
|
31
31
|
inject_into_file(
|
32
32
|
"config/application.rb",
|
33
33
|
"\n #{config}",
|
34
|
-
before: "\n end"
|
34
|
+
before: "\n end"
|
35
35
|
)
|
36
36
|
end
|
37
37
|
end
|
@@ -7,14 +7,14 @@ module Suspenders
|
|
7
7
|
copy_file "smtp.rb", "config/smtp.rb"
|
8
8
|
|
9
9
|
prepend_file "config/environments/production.rb",
|
10
|
-
%{require Rails.root.join("config/smtp")\n}
|
10
|
+
%{require Rails.root.join("config/smtp")\n\n}
|
11
11
|
end
|
12
12
|
|
13
13
|
def use_smtp
|
14
14
|
inject_template_into_file(
|
15
15
|
"config/environments/production.rb",
|
16
16
|
"partials/email_smtp.rb",
|
17
|
-
after: "config.action_mailer.perform_caching = false"
|
17
|
+
after: "config.action_mailer.perform_caching = false\n"
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
@@ -22,11 +22,11 @@ module Suspenders
|
|
22
22
|
expand_json(
|
23
23
|
"app.json",
|
24
24
|
env: {
|
25
|
-
SMTP_ADDRESS: {
|
26
|
-
SMTP_DOMAIN: {
|
27
|
-
SMTP_PASSWORD: {
|
28
|
-
SMTP_USERNAME: {
|
29
|
-
}
|
25
|
+
SMTP_ADDRESS: {required: true},
|
26
|
+
SMTP_DOMAIN: {required: true},
|
27
|
+
SMTP_PASSWORD: {required: true},
|
28
|
+
SMTP_USERNAME: {required: true}
|
29
|
+
}
|
30
30
|
)
|
31
31
|
end
|
32
32
|
end
|
@@ -9,15 +9,15 @@ module Suspenders
|
|
9
9
|
name: app_name.dasherize,
|
10
10
|
scripts: {},
|
11
11
|
env: {
|
12
|
-
APPLICATION_HOST: {
|
13
|
-
AUTO_MIGRATE_DB: {
|
14
|
-
EMAIL_RECIPIENTS: {
|
15
|
-
HEROKU_APP_NAME: {
|
16
|
-
HEROKU_PARENT_APP_NAME: {
|
17
|
-
RACK_ENV: {
|
18
|
-
SECRET_KEY_BASE: {
|
12
|
+
APPLICATION_HOST: {required: true},
|
13
|
+
AUTO_MIGRATE_DB: {value: true},
|
14
|
+
EMAIL_RECIPIENTS: {required: true},
|
15
|
+
HEROKU_APP_NAME: {required: true},
|
16
|
+
HEROKU_PARENT_APP_NAME: {required: true},
|
17
|
+
RACK_ENV: {required: true},
|
18
|
+
SECRET_KEY_BASE: {generator: "secret"}
|
19
19
|
},
|
20
|
-
addons: ["heroku-postgresql"]
|
20
|
+
addons: ["heroku-postgresql"]
|
21
21
|
)
|
22
22
|
end
|
23
23
|
end
|
@@ -9,13 +9,13 @@ module Suspenders
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def configure_rack_timeout
|
12
|
-
append_file ".env", rack_timeout_config
|
12
|
+
append_file ".sample.env", rack_timeout_config
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def rack_timeout_config
|
18
|
-
%
|
18
|
+
%(RACK_TIMEOUT_SERVICE_TIMEOUT=10)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -3,12 +3,12 @@ require_relative "base"
|
|
3
3
|
module Suspenders
|
4
4
|
class ProfilerGenerator < Generators::Base
|
5
5
|
def augment_default_env
|
6
|
-
append_to_file ".env", "RACK_MINI_PROFILER=0\n"
|
6
|
+
append_to_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
7
7
|
rescue Errno::ENOENT
|
8
|
-
create_file ".env", "RACK_MINI_PROFILER=0\n"
|
8
|
+
create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
9
9
|
rescue Thor::Error => e
|
10
10
|
if e.message.match?(/does not appear to exist/)
|
11
|
-
create_file ".env", "RACK_MINI_PROFILER=0\n"
|
11
|
+
create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
12
12
|
else
|
13
13
|
raise
|
14
14
|
end
|
@@ -24,7 +24,7 @@ module Suspenders
|
|
24
24
|
"rack_mini_profiler.rb",
|
25
25
|
"config/initializers/rack_mini_profiler.rb",
|
26
26
|
force: false,
|
27
|
-
skip: true
|
27
|
+
skip: true
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|