welaika-suspenders 2.29.0 → 2.30.0
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/.travis.yml +2 -3
- data/NEWS.md +18 -0
- data/README.md +2 -1
- data/lib/suspenders.rb +4 -0
- data/lib/suspenders/adapters/heroku.rb +13 -27
- data/lib/suspenders/app_builder.rb +2 -29
- data/lib/suspenders/generators/app_generator.rb +10 -16
- data/lib/suspenders/generators/base.rb +20 -0
- data/lib/suspenders/generators/ci_generator.rb +3 -10
- data/lib/suspenders/generators/db_optimizations_generator.rb +2 -2
- data/lib/suspenders/generators/decorator_generator.rb +1 -6
- data/lib/suspenders/generators/factories_generator.rb +2 -7
- data/lib/suspenders/generators/faker_generator.rb +1 -6
- data/lib/suspenders/generators/js_driver_generator.rb +2 -7
- data/lib/suspenders/generators/json_generator.rb +10 -0
- data/lib/suspenders/generators/lint_generator.rb +2 -7
- data/lib/suspenders/generators/production/deployment_generator.rb +27 -0
- data/lib/suspenders/generators/production/email_generator.rb +3 -11
- data/lib/suspenders/generators/production/error_reporting_generator.rb +1 -8
- data/lib/suspenders/generators/production/force_tls_generator.rb +2 -5
- data/lib/suspenders/generators/production/manifest_generator.rb +24 -0
- data/lib/suspenders/generators/production/timeout_generator.rb +2 -2
- data/lib/suspenders/generators/security_generator.rb +1 -6
- data/lib/suspenders/generators/staging/pull_requests_generator.rb +33 -0
- data/lib/suspenders/generators/static_generator.rb +2 -2
- data/lib/suspenders/generators/stylesheet_base_generator.rb +2 -6
- data/lib/suspenders/generators/testing_generator.rb +2 -7
- data/lib/suspenders/generators/views_generator.rb +2 -7
- data/lib/suspenders/version.rb +2 -2
- data/spec/adapters/heroku_spec.rb +2 -2
- data/spec/features/heroku_spec.rb +22 -6
- data/spec/features/json_spec.rb +15 -0
- data/spec/features/new_project_spec.rb +13 -8
- data/spec/features/production/deployment_spec.rb +22 -0
- data/spec/features/production/email_spec.rb +1 -1
- data/spec/features/production/manifest_spec.rb +35 -0
- data/spec/features/staging/pull_requests_spec.rb +22 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/be_executable_matcher.rb +7 -0
- data/spec/support/generators.rb +5 -0
- data/spec/support/project_files.rb +13 -0
- data/suspenders.gemspec +2 -0
- data/templates/Gemfile.erb +3 -5
- data/templates/_flashes.html.slim +1 -1
- data/templates/factory_bot_rspec.rb +2 -0
- data/templates/gitlab-ci.yml.erb +13 -16
- data/templates/overcommit.yml +1 -1
- data/templates/suspenders_gitignore +3 -0
- data/templates/suspenders_layout.html.slim +2 -3
- metadata +53 -9
- data/templates/app.json.erb +0 -27
- data/templates/browserslist +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca30a79a04c6c0f4d08c421228a00b20d59afbf477c0ebace4fd2111746dbde
|
4
|
+
data.tar.gz: 7e6f3c35081463c596b65a061a0c56f0df6ab43e1fce9336e87c225c6cc7d0d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9844e030e5bf1298011b28068501a02b8c0646a01d1ad0e9ca02191b6e425a7cdf5ef5a70c8c4b36a909a2135db9572d28e9d59fa5b0c896ad43c24d5e9327
|
7
|
+
data.tar.gz: 39460d4cd9b9470f28ed665d6bd0009dfb8fbb996b47f83e35987c90bb9da4c0b59a98e88555e8427e5db729d7725fc1c61b46e55ca4990c97702e5590997943
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
data/.travis.yml
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
language: ruby
|
2
|
-
rvm: 2.
|
2
|
+
rvm: 2.6.1
|
3
3
|
cache: bundler
|
4
4
|
sudo: false
|
5
5
|
before_install:
|
6
|
-
- "echo '--colour' > ~/.rspec"
|
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 -v '< 2'
|
11
10
|
install: bundle install
|
12
11
|
notifications:
|
13
12
|
email: false
|
data/NEWS.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
1.50.0 (December 28, 2018)
|
2
|
+
|
3
|
+
* Removed: jquery-rails.
|
4
|
+
* Changed: default FactoryBot to `use_parent_strategy = true`.
|
5
|
+
* Upgraded: Ruby 2.5.3.
|
6
|
+
* Fixed: set `ASSET_HOST` and `APPLICATION_HOST` at top of `production.rb`.
|
7
|
+
* Fixed: `tzinfo-data` gem for Windows.
|
8
|
+
* New generator: `suspenders:json` for JSON parsing.
|
9
|
+
* New generator: `suspenders:staging:pull_requests` for Heroku app per PR.
|
10
|
+
|
11
|
+
1.49.0 (October 19, 2018)
|
12
|
+
|
13
|
+
* Removed: NOODP robots meta tags
|
14
|
+
* Removed: flutie gem and body class in application layout
|
15
|
+
* Upgraded: remove version constraint for pg gem
|
16
|
+
* Fixed: install JavaScript dependencies in bin/setup
|
17
|
+
* Fixed: include action_mailer SMTP settings in production config
|
18
|
+
|
1
19
|
1.48.0 (August 10, 2018)
|
2
20
|
|
3
21
|
* Bug fix: change production timeouts generator to use working configuration
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# weLaika's Suspenders [![Build Status](https://travis-ci.org/welaika/welaika-suspenders.svg?branch=master)](https://travis-ci.org/welaika/welaika-suspenders)
|
2
|
+
=======
|
2
3
|
|
3
4
|
This is a [suspenders](https://github.com/thoughtbot/suspenders) fork in use at [weLaika](http://dev.welaika.com).
|
4
5
|
Big thanks to [thoughtbot](http://thoughtbot.com/community) for providing such a great starting point.
|
@@ -31,7 +32,7 @@ You can optionally specify alternate Heroku flags:
|
|
31
32
|
|
32
33
|
welaika-suspenders projectname \
|
33
34
|
--heroku true \
|
34
|
-
--heroku-flags "--
|
35
|
+
--heroku-flags "--addons sendgrid,logentries,scheduler"
|
35
36
|
|
36
37
|
See all possible Heroku flags:
|
37
38
|
|
data/lib/suspenders.rb
CHANGED
@@ -8,6 +8,7 @@ require "suspenders/generators/factories_generator"
|
|
8
8
|
require "suspenders/generators/lint_generator"
|
9
9
|
require "suspenders/generators/views_generator"
|
10
10
|
require "suspenders/generators/js_driver_generator"
|
11
|
+
require "suspenders/generators/json_generator"
|
11
12
|
require "suspenders/generators/testing_generator"
|
12
13
|
require "suspenders/generators/decorator_generator"
|
13
14
|
require "suspenders/generators/faker_generator"
|
@@ -16,6 +17,9 @@ require "suspenders/generators/production/force_tls_generator"
|
|
16
17
|
require "suspenders/generators/production/email_generator"
|
17
18
|
require "suspenders/generators/production/timeout_generator"
|
18
19
|
require "suspenders/generators/production/error_reporting_generator"
|
20
|
+
require "suspenders/generators/production/deployment_generator"
|
21
|
+
require "suspenders/generators/production/manifest_generator"
|
22
|
+
require "suspenders/generators/staging/pull_requests_generator"
|
19
23
|
require "suspenders/actions"
|
20
24
|
require "suspenders/adapters/heroku"
|
21
25
|
require "suspenders/app_builder"
|
@@ -39,12 +39,20 @@ module Suspenders
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def set_heroku_smtp_settings
|
43
43
|
%w(staging production).each do |environment|
|
44
|
-
run_toolbelt_command(
|
45
|
-
|
46
|
-
|
47
|
-
)
|
44
|
+
run_toolbelt_command("config:add SMTP_ADDRESS=smtp.example.com", environment)
|
45
|
+
run_toolbelt_command("config:add SMTP_DOMAIN=example.com", environment)
|
46
|
+
run_toolbelt_command("config:add SMTP_USERNAME=username", environment)
|
47
|
+
run_toolbelt_command("config:add SMTP_PASSWORD=password", environment)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_heroku_sentry_configuration
|
52
|
+
%w(staging production).each do |environment|
|
53
|
+
run_toolbelt_command("config:add SENTRY_ENV=#{environment}", environment)
|
54
|
+
run_toolbelt_command("config:add SENTRY_DSN='https://changeme@sentry.io/changeme'", environment)
|
55
|
+
run_toolbelt_command("labs:enable runtime-dyno-metadata", environment)
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
@@ -57,19 +65,6 @@ module Suspenders
|
|
57
65
|
end
|
58
66
|
end
|
59
67
|
|
60
|
-
def create_review_apps_setup_script
|
61
|
-
app_builder.template(
|
62
|
-
"bin_setup_review_app.erb",
|
63
|
-
"bin/setup_review_app",
|
64
|
-
force: true,
|
65
|
-
)
|
66
|
-
app_builder.run "chmod a+x bin/setup_review_app"
|
67
|
-
end
|
68
|
-
|
69
|
-
def create_heroku_application_manifest_file
|
70
|
-
app_builder.template "app.json.erb", "app.json"
|
71
|
-
end
|
72
|
-
|
73
68
|
def create_heroku_pipeline
|
74
69
|
pipelines_plugin = `heroku help | grep pipelines`
|
75
70
|
if pipelines_plugin.empty?
|
@@ -99,15 +94,6 @@ module Suspenders
|
|
99
94
|
end
|
100
95
|
end
|
101
96
|
|
102
|
-
def set_heroku_metadata_for_sentry
|
103
|
-
%w(staging production).each do |environment|
|
104
|
-
run_toolbelt_command(
|
105
|
-
"labs:enable runtime-dyno-metadata",
|
106
|
-
environment
|
107
|
-
)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
97
|
def set_buildpacks
|
112
98
|
%w(staging production).each do |environment|
|
113
99
|
run_toolbelt_command(
|
@@ -7,17 +7,15 @@ 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
|
-
:create_review_apps_setup_script,
|
14
12
|
:create_staging_heroku_app,
|
15
13
|
:set_heroku_application_host,
|
16
14
|
:set_heroku_backup_schedule,
|
17
|
-
:set_heroku_error_reporting_env,
|
18
15
|
:set_heroku_rails_secrets,
|
19
16
|
:set_heroku_remotes,
|
20
|
-
:
|
17
|
+
:set_heroku_sentry_configuration,
|
18
|
+
:set_heroku_smtp_settings,
|
21
19
|
:set_buildpacks,
|
22
20
|
)
|
23
21
|
|
@@ -102,11 +100,6 @@ module Suspenders
|
|
102
100
|
|
103
101
|
def enable_rack_canonical_host
|
104
102
|
config = <<-RUBY
|
105
|
-
|
106
|
-
if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
|
107
|
-
ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
|
108
|
-
end
|
109
|
-
|
110
103
|
config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
|
111
104
|
RUBY
|
112
105
|
|
@@ -243,26 +236,7 @@ config.public_file_server.headers = {
|
|
243
236
|
create_production_heroku_app(flags)
|
244
237
|
end
|
245
238
|
|
246
|
-
def create_deploy_script
|
247
|
-
copy_file "bin_deploy", "bin/deploy"
|
248
|
-
|
249
|
-
instructions = <<-MARKDOWN
|
250
|
-
|
251
|
-
## Deploying
|
252
|
-
|
253
|
-
If you have previously run the `./bin/setup` script,
|
254
|
-
you can deploy to staging and production with:
|
255
|
-
|
256
|
-
% ./bin/deploy staging
|
257
|
-
% ./bin/deploy production
|
258
|
-
MARKDOWN
|
259
|
-
|
260
|
-
append_file "README.md", instructions
|
261
|
-
run "chmod a+x bin/deploy"
|
262
|
-
end
|
263
|
-
|
264
239
|
def copy_miscellaneous_files
|
265
|
-
copy_file "browserslist", "browserslist"
|
266
240
|
copy_file "errors.rb", "config/initializers/errors.rb"
|
267
241
|
copy_file "json_encoding.rb", "config/initializers/json_encoding.rb"
|
268
242
|
end
|
@@ -270,7 +244,6 @@ you can deploy to staging and production with:
|
|
270
244
|
def customize_error_pages
|
271
245
|
meta_tags =<<-EOS
|
272
246
|
<meta charset="utf-8" />
|
273
|
-
<meta name="ROBOTS" content="NOODP" />
|
274
247
|
<meta name="viewport" content="initial-scale=1" />
|
275
248
|
EOS
|
276
249
|
|
@@ -48,15 +48,14 @@ module Suspenders
|
|
48
48
|
invoke :configure_app
|
49
49
|
invoke :copy_miscellaneous_files
|
50
50
|
invoke :customize_error_pages
|
51
|
-
invoke :remove_config_comment_lines
|
52
|
-
invoke :remove_routes_comment_lines
|
53
51
|
invoke :setup_dotfiles
|
54
52
|
invoke :setup_database
|
55
53
|
invoke :generate_default
|
56
54
|
invoke :setup_default_directories
|
57
|
-
invoke :create_local_heroku_setup
|
58
55
|
invoke :create_heroku_apps
|
59
|
-
invoke :
|
56
|
+
invoke :generate_deployment_default
|
57
|
+
invoke :remove_config_comment_lines
|
58
|
+
invoke :remove_routes_comment_lines
|
60
59
|
invoke :outro
|
61
60
|
end
|
62
61
|
|
@@ -112,15 +111,6 @@ module Suspenders
|
|
112
111
|
build :setup_rack_mini_profiler
|
113
112
|
end
|
114
113
|
|
115
|
-
def create_local_heroku_setup
|
116
|
-
if options[:heroku]
|
117
|
-
say "Creating local Heroku setup"
|
118
|
-
build :create_review_apps_setup_script
|
119
|
-
build :create_deploy_script
|
120
|
-
build :create_heroku_application_manifest_file
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
114
|
def create_heroku_apps
|
125
115
|
if options[:heroku]
|
126
116
|
say "Creating Heroku apps"
|
@@ -128,9 +118,9 @@ module Suspenders
|
|
128
118
|
build :set_heroku_remotes
|
129
119
|
build :set_heroku_rails_secrets
|
130
120
|
build :set_heroku_application_host
|
131
|
-
build :set_heroku_error_reporting_env
|
132
121
|
build :set_heroku_backup_schedule
|
133
|
-
build :
|
122
|
+
build :set_heroku_sentry_configuration
|
123
|
+
build :set_heroku_smtp_settings
|
134
124
|
build :set_buildpacks
|
135
125
|
build :create_heroku_pipeline
|
136
126
|
build :configure_automatic_deployment
|
@@ -164,6 +154,7 @@ module Suspenders
|
|
164
154
|
end
|
165
155
|
|
166
156
|
def generate_default
|
157
|
+
generate("suspenders:json")
|
167
158
|
generate("suspenders:static")
|
168
159
|
generate("suspenders:stylesheet_base")
|
169
160
|
generate("suspenders:testing")
|
@@ -178,11 +169,14 @@ module Suspenders
|
|
178
169
|
generate("suspenders:security")
|
179
170
|
end
|
180
171
|
|
181
|
-
def
|
172
|
+
def generate_deployment_default
|
173
|
+
generate("suspenders:staging:pull_requests")
|
182
174
|
generate("suspenders:production:force_tls")
|
183
175
|
generate("suspenders:production:email")
|
184
176
|
generate("suspenders:production:timeout")
|
185
177
|
generate("suspenders:production:error_reporting")
|
178
|
+
generate("suspenders:production:deployment")
|
179
|
+
generate("suspenders:production:manifest")
|
186
180
|
end
|
187
181
|
|
188
182
|
def outro
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
require_relative "../actions"
|
3
|
+
|
4
|
+
module Suspenders
|
5
|
+
module Generators
|
6
|
+
class Base < Rails::Generators::Base
|
7
|
+
include Suspenders::Actions
|
8
|
+
|
9
|
+
def self.default_source_root
|
10
|
+
File.expand_path(File.join("..", "..", "..", "templates"), __dir__)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def app_name
|
16
|
+
Rails.app_class.parent_name.demodulize.underscore.dasherize
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,16 +1,9 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class CiGenerator <
|
5
|
-
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__))
|
8
|
-
|
9
|
-
def setup_gitlab_ci
|
4
|
+
class CiGenerator < Generators::Base
|
5
|
+
def configure_ci
|
10
6
|
template 'gitlab-ci.yml.erb', '.gitlab-ci.yml'
|
11
|
-
end
|
12
|
-
|
13
|
-
def copy_database_yml_for_gitlab
|
14
7
|
copy_file 'database.gitlab.yml', 'config/database.gitlab.yml'
|
15
8
|
end
|
16
9
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class DbOptimizationsGenerator <
|
4
|
+
class DbOptimizationsGenerator < Generators::Base
|
5
5
|
def add_bullet
|
6
6
|
gem "bullet", group: %i(development test)
|
7
7
|
Bundler.with_clean_env { run "bundle install" }
|
@@ -1,12 +1,7 @@
|
|
1
1
|
require "rails/generators"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class DecoratorGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class DecoratorGenerator < Generators::Base
|
10
5
|
def add_draper_gem
|
11
6
|
gem "draper"
|
12
7
|
Bundler.with_clean_env { run "bundle install" }
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class FactoriesGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class FactoriesGenerator < Generators::Base
|
10
5
|
def add_factory_bot
|
11
6
|
gem "factory_bot_rails", group: %i(development test)
|
12
7
|
gem "database_cleaner", group: %i(development test)
|
@@ -1,12 +1,7 @@
|
|
1
1
|
require "rails/generators"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class FakerGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class FakerGenerator < Generators::Base
|
10
5
|
def add_factory_bot
|
11
6
|
gem 'faker', group: %i(development test)
|
12
7
|
Bundler.with_clean_env { run "bundle install" }
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class JsDriverGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class JsDriverGenerator < Generators::Base
|
10
5
|
def add_gems
|
11
6
|
gem 'capybara', '>= 2.15', '< 4.0', group: :test
|
12
7
|
gem 'selenium-webdriver', group: :test
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class LintGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class LintGenerator < Generators::Base
|
10
5
|
def add_linters_gems
|
11
6
|
gem 'rubocop', require: false, group: :development
|
12
7
|
gem 'rubocop-rspec', require: false, group: :development
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "../base"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
module Production
|
5
|
+
class DeploymentGenerator < Generators::Base
|
6
|
+
def copy_script
|
7
|
+
copy_file "bin_deploy", "bin/deploy"
|
8
|
+
chmod "bin/deploy", 0o755
|
9
|
+
end
|
10
|
+
|
11
|
+
def inform_user
|
12
|
+
instructions = <<~MARKDOWN
|
13
|
+
|
14
|
+
## Deploying
|
15
|
+
|
16
|
+
If you have previously run the `./bin/setup` script,
|
17
|
+
you can deploy to staging and production with:
|
18
|
+
|
19
|
+
% ./bin/deploy staging
|
20
|
+
% ./bin/deploy production
|
21
|
+
MARKDOWN
|
22
|
+
|
23
|
+
append_file "README.md", instructions
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|