welaika-suspenders 2.28.0 → 2.29.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +3 -1
- data/CONTRIBUTING.md +8 -3
- data/NEWS.md +35 -0
- data/README.md +1 -1
- data/RELEASING.md +6 -7
- data/Rakefile +1 -1
- data/diff_suspenders.sh +15 -0
- data/lib/suspenders.rb +21 -8
- data/lib/suspenders/actions.rb +55 -8
- data/lib/suspenders/app_builder.rb +20 -191
- data/lib/suspenders/generators/app_generator.rb +26 -55
- data/lib/suspenders/generators/ci_generator.rb +22 -0
- data/lib/suspenders/generators/db_optimizations_generator.rb +30 -0
- data/lib/suspenders/generators/decorator_generator.rb +19 -0
- data/lib/suspenders/generators/error_reporting_generator.rb +55 -0
- data/lib/suspenders/generators/factories_generator.rb +23 -0
- data/lib/suspenders/generators/faker_generator.rb +19 -0
- data/lib/suspenders/generators/forms_generator.rb +18 -0
- data/lib/suspenders/generators/js_driver_generator.rb +20 -0
- data/lib/suspenders/generators/lint_generator.rb +35 -0
- data/lib/suspenders/generators/production/email_generator.rb +45 -0
- data/lib/suspenders/generators/production/force_tls_generator.rb +14 -0
- data/lib/suspenders/generators/production/timeout_generator.rb +21 -0
- data/lib/suspenders/generators/security_generator.rb +29 -0
- data/lib/suspenders/generators/testing_generator.rb +72 -0
- data/lib/suspenders/generators/views_generator.rb +44 -0
- data/lib/suspenders/version.rb +2 -2
- data/spec/features/api_spec.rb +18 -0
- data/spec/features/new_project_spec.rb +9 -21
- data/spec/features/production/email_spec.rb +47 -0
- data/spec/support/contain_json_matcher.rb +24 -0
- data/spec/support/exist_as_a_file_matcher.rb +7 -0
- data/spec/support/match_contents_matcher.rb +6 -0
- data/spec/support/suspenders.rb +113 -30
- data/suspenders.gemspec +2 -2
- data/templates/Gemfile.erb +8 -31
- data/templates/Procfile +1 -1
- data/templates/_css_overrides.html.slim +4 -0
- data/templates/_javascript.html.slim +3 -3
- data/templates/action_mailer.rb +2 -0
- data/templates/app.json.erb +0 -15
- data/templates/brakeman.rake +2 -0
- data/templates/bundler_audit.rake +3 -1
- data/templates/capybara_helpers.rb +15 -0
- data/templates/chromedriver.rb +20 -0
- data/templates/dev.rake +4 -2
- data/templates/dotfiles/.env +2 -1
- data/templates/email.rb +5 -0
- data/templates/errors.rb +2 -0
- data/templates/factory_bot_rspec.rb +5 -0
- data/templates/faker_rspec.rb +2 -0
- data/templates/flashes_helper.rb +2 -0
- data/templates/i18n.rb +2 -0
- data/templates/json_encoding.rb +2 -0
- data/templates/puma.rb +2 -0
- data/templates/queries_helper_rspec.rb +2 -0
- data/templates/rack_mini_profiler.rb +2 -0
- data/templates/rails_helper.rb +11 -1
- data/templates/rubocop.rake +2 -0
- data/templates/rubocop.yml +2 -22
- data/templates/sentry.rb +8 -0
- data/templates/shoulda_matchers_config_rspec.rb +2 -0
- data/templates/slim-lint.rake +2 -0
- data/templates/slim.rb +2 -0
- data/templates/smtp.rb +2 -4
- data/templates/spec_helper.rb +12 -3
- data/templates/suspenders_layout.html.slim +3 -3
- metadata +42 -36
- data/lib/suspenders/generators/enforce_ssl_generator.rb +0 -12
- data/lib/suspenders/generators/initialize_active_job_generator.rb +0 -19
- data/templates/_css_overrides.html.erb +0 -7
- data/templates/active_job.rb +0 -13
- data/templates/capybara.rb +0 -29
- data/templates/circle.yml.erb +0 -15
- data/templates/database_cleaner_rspec.rb +0 -28
- data/templates/errbit.rb +0 -12
- data/templates/factories.rb +0 -2
- data/templates/factory_girl_rspec.rb +0 -3
- data/templates/fixtures_helper_rspec.rb +0 -9
- data/templates/sample_service.rb +0 -5
data/suspenders.gemspec
CHANGED
@@ -5,6 +5,7 @@ require 'date'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.required_ruby_version = ">= #{Suspenders::RUBY_VERSION}"
|
8
|
+
s.required_rubygems_version = ">= 2.7.4"
|
8
9
|
s.authors = ['thoughtbot', 'weLaika']
|
9
10
|
s.date = Date.today.strftime('%Y-%m-%d')
|
10
11
|
|
@@ -25,8 +26,7 @@ weLaika's fork of the famous thoughbot suspenders gem.
|
|
25
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
27
|
s.version = Suspenders::VERSION
|
27
28
|
|
28
|
-
s.add_dependency 'bundler', '>= 1.8.4'
|
29
29
|
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
30
30
|
|
31
|
-
s.add_development_dependency 'rspec', '~> 3.
|
31
|
+
s.add_development_dependency 'rspec', '~> 3.8'
|
32
32
|
end
|
data/templates/Gemfile.erb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
git_source(:github) do |repo_name|
|
@@ -7,71 +9,46 @@ end
|
|
7
9
|
|
8
10
|
ruby "<%= Suspenders::RUBY_VERSION %>"
|
9
11
|
|
10
|
-
gem "
|
11
|
-
|
12
|
-
gem "active_interaction", "~> 3.5"
|
13
|
-
gem "airbrake"
|
12
|
+
gem "active_interaction", "~> 3.6"
|
14
13
|
gem "autoprefixer-rails"
|
15
14
|
gem "coffee-rails", "~> 4.2"
|
16
|
-
gem "delayed_job_active_record"
|
17
|
-
gem "draper"
|
18
15
|
gem "email_validator"
|
19
16
|
gem "flutie"
|
20
|
-
gem "
|
21
|
-
gem "
|
17
|
+
gem "jquery-rails" #TODO keep it?
|
18
|
+
gem "pg", ">= 0.18", "< 2.0"
|
19
|
+
gem "puma", "~> 3.11"
|
22
20
|
gem "rack-canonical-host"
|
23
21
|
gem "rails", "<%= Suspenders::RAILS_VERSION %>"
|
24
22
|
gem "rails-i18n"
|
25
23
|
gem "recipient_interceptor"
|
26
24
|
gem "sass-rails", "~> 5.0"
|
27
|
-
gem "simple_form"
|
28
|
-
gem "skylight"
|
29
|
-
gem "slim-rails"
|
30
25
|
gem "title"
|
31
26
|
gem "uglifier", ">= 1.3.0"
|
27
|
+
gem "bootsnap", ">= 1.1.0", require: false
|
32
28
|
<% if options[:webpack] %>
|
33
29
|
gem "webpacker"
|
34
30
|
<% end %>
|
35
|
-
gem "welaika-suspenders"
|
36
31
|
|
37
32
|
group :development do
|
38
33
|
gem "letter_opener"
|
39
34
|
gem "listen", ">= 3.0.5", "< 3.2"
|
40
35
|
gem "rack-mini-profiler", require: false
|
41
36
|
gem "spring"
|
42
|
-
gem "spring-commands-rspec"
|
43
|
-
gem "spring-watcher-listen", "~> 2.0.0"
|
44
37
|
gem "web-console", ">= 3.3.0"
|
45
38
|
end
|
46
39
|
|
47
40
|
group :development, :test do
|
48
41
|
gem "awesome_print"
|
49
|
-
gem "brakeman", require: false
|
50
|
-
gem "bullet"
|
51
|
-
gem "bundler-audit", ">= 0.5.0", require: false
|
52
42
|
gem "dotenv-rails"
|
53
|
-
gem "factory_girl_rails"
|
54
|
-
gem "faker"
|
55
43
|
gem "pry-byebug"
|
56
44
|
gem "pry-rails"
|
57
|
-
gem "rspec-rails", "~> 3.6"
|
58
|
-
gem "rspec_junit_formatter"
|
59
|
-
gem "rubocop", require: false
|
60
|
-
gem "rubocop-rspec", require: false
|
61
|
-
gem "slim_lint", require: false
|
62
45
|
end
|
63
46
|
|
64
47
|
group :test do
|
65
|
-
gem "capybara"
|
66
|
-
gem "database_cleaner"
|
67
48
|
gem "launchy"
|
68
|
-
gem "selenium-webdriver"
|
69
|
-
gem "shoulda-matchers"
|
70
49
|
gem "simplecov", require: false
|
71
50
|
gem "timecop"
|
72
51
|
gem "webmock"
|
73
52
|
end
|
74
53
|
|
75
|
-
group :
|
76
|
-
gem "rack-timeout"
|
77
|
-
end
|
54
|
+
gem "welaika-suspenders", "~> <%= Suspenders::VERSION %>", group: [:development, :test]
|
data/templates/Procfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
web: bundle exec puma -p $PORT -C ./config/puma.rb
|
2
|
-
worker:
|
2
|
+
# worker:
|
data/templates/action_mailer.rb
CHANGED
data/templates/app.json.erb
CHANGED
@@ -19,21 +19,6 @@
|
|
19
19
|
},
|
20
20
|
"SECRET_KEY_BASE":{
|
21
21
|
"generator":"secret"
|
22
|
-
},
|
23
|
-
"SMTP_ADDRESS":{
|
24
|
-
"required":true
|
25
|
-
},
|
26
|
-
"SMTP_DOMAIN":{
|
27
|
-
"required":true
|
28
|
-
},
|
29
|
-
"SMTP_PASSWORD":{
|
30
|
-
"required":true
|
31
|
-
},
|
32
|
-
"SMTP_USERNAME":{
|
33
|
-
"required":true
|
34
|
-
},
|
35
|
-
"ERRBIT_API_KEY":{
|
36
|
-
"required":true
|
37
22
|
}
|
38
23
|
},
|
39
24
|
"addons":[
|
data/templates/brakeman.rake
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "selenium/webdriver"
|
4
|
+
|
5
|
+
Capybara.register_driver :chrome do |app|
|
6
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
7
|
+
end
|
8
|
+
|
9
|
+
Capybara.register_driver :headless_chrome do |app|
|
10
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
11
|
+
chromeOptions: { args: %w(headless disable-gpu) },
|
12
|
+
)
|
13
|
+
|
14
|
+
Capybara::Selenium::Driver.new app,
|
15
|
+
browser: :chrome,
|
16
|
+
desired_capabilities: capabilities
|
17
|
+
end
|
18
|
+
|
19
|
+
Capybara.javascript_driver = :headless_chrome
|
20
|
+
Capybara.asset_host = 'http://localhost:3000'
|
data/templates/dev.rake
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
if Rails.env.development? || Rails.env.test?
|
2
|
-
require '
|
4
|
+
require 'factory_bot'
|
3
5
|
|
4
6
|
namespace :dev do
|
5
7
|
desc 'Sample data for local development environment'
|
6
8
|
task prime: 'db:setup' do
|
7
|
-
include
|
9
|
+
include FactoryBot::Syntax::Methods
|
8
10
|
|
9
11
|
# create(:user, email: 'user@example.com', password: 'password')
|
10
12
|
end
|
data/templates/dotfiles/.env
CHANGED
data/templates/email.rb
ADDED
data/templates/errors.rb
CHANGED
data/templates/faker_rspec.rb
CHANGED
data/templates/flashes_helper.rb
CHANGED
data/templates/i18n.rb
CHANGED
data/templates/json_encoding.rb
CHANGED
data/templates/puma.rb
CHANGED
data/templates/rails_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ENV['RACK_ENV'] = 'test'
|
2
4
|
|
3
5
|
require File.expand_path('../../config/environment', __FILE__)
|
@@ -7,13 +9,21 @@ require 'rspec/rails'
|
|
7
9
|
|
8
10
|
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |file| require file }
|
9
11
|
|
12
|
+
begin
|
13
|
+
ActiveRecord::Migration.maintain_test_schema!
|
14
|
+
rescue ActiveRecord::PendingMigrationError => e
|
15
|
+
puts e.to_s.strip
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
10
19
|
RSpec.configure do |config|
|
20
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
11
21
|
config.infer_base_class_for_anonymous_controllers = false
|
12
22
|
config.infer_spec_type_from_file_location!
|
23
|
+
config.use_transactional_fixtures = true
|
13
24
|
|
14
25
|
config.filter_rails_from_backtrace!
|
15
26
|
# arbitrary gems may also be filtered via:
|
16
27
|
# config.filter_gems_from_backtrace('gem name')
|
17
28
|
end
|
18
29
|
|
19
|
-
ActiveRecord::Migration.maintain_test_schema!
|
data/templates/rubocop.rake
CHANGED
data/templates/rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ require: rubocop-rspec
|
|
2
2
|
inherit_from: .rubocop_todo.yml
|
3
3
|
|
4
4
|
AllCops:
|
5
|
-
|
5
|
+
DisplayCopNames: true
|
6
6
|
Exclude:
|
7
7
|
- 'bin/*'
|
8
8
|
- 'config/**/*'
|
@@ -10,16 +10,9 @@ AllCops:
|
|
10
10
|
- 'tmp/**/*'
|
11
11
|
- 'vendor/**/*'
|
12
12
|
|
13
|
-
Layout/TrailingBlankLines:
|
14
|
-
Exclude:
|
15
|
-
- "Gemfile"
|
16
|
-
|
17
13
|
Lint/Debugger:
|
18
14
|
Exclude:
|
19
|
-
-
|
20
|
-
|
21
|
-
Metrics/AbcSize:
|
22
|
-
Max: 20
|
15
|
+
- 'spec/support/capybara_helpers.rb'
|
23
16
|
|
24
17
|
Metrics/BlockLength:
|
25
18
|
Exclude:
|
@@ -30,18 +23,5 @@ Metrics/BlockLength:
|
|
30
23
|
Metrics/LineLength:
|
31
24
|
Max: 100
|
32
25
|
|
33
|
-
Naming/FileName:
|
34
|
-
Exclude:
|
35
|
-
- 'app/views/**/*'
|
36
|
-
|
37
26
|
Rails:
|
38
27
|
Enabled: true
|
39
|
-
|
40
|
-
Style/Documentation:
|
41
|
-
Enabled: false
|
42
|
-
|
43
|
-
Style/FrozenStringLiteralComment:
|
44
|
-
Enabled: false
|
45
|
-
|
46
|
-
Style/StringLiterals:
|
47
|
-
Enabled: false
|
data/templates/sentry.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Raven.configure do |config|
|
4
|
+
config.dsn = ENV.fetch('SENTRY_DSN')
|
5
|
+
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
|
6
|
+
config.environments = %w[ staging production ]
|
7
|
+
config.current_environment = ENV.fetch('SENTRY_CURRENT_ENV', Rails.env)
|
8
|
+
end
|
data/templates/slim-lint.rake
CHANGED
data/templates/slim.rb
CHANGED
data/templates/smtp.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
SMTP_SETTINGS = {
|
2
4
|
address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
|
3
5
|
authentication: :plain,
|
@@ -7,7 +9,3 @@ SMTP_SETTINGS = {
|
|
7
9
|
port: "587",
|
8
10
|
user_name: ENV.fetch("SMTP_USERNAME")
|
9
11
|
}
|
10
|
-
|
11
|
-
if ENV["EMAIL_RECIPIENTS"].present?
|
12
|
-
Mail.register_interceptor RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])
|
13
|
-
end
|
data/templates/spec_helper.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
4
|
+
|
2
5
|
SimpleCov.start 'rails' do
|
3
|
-
|
6
|
+
# TODO: interactors
|
7
|
+
add_group 'Interactions', 'app/interactions'
|
4
8
|
end
|
5
9
|
|
6
|
-
# Save to CircleCI's artifacts directory if we're on CircleCI
|
7
10
|
if ENV['CIRCLE_ARTIFACTS']
|
8
11
|
dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
|
9
12
|
SimpleCov.coverage_dir(dir)
|
@@ -15,6 +18,7 @@ require 'timecop'
|
|
15
18
|
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
19
|
RSpec.configure do |config|
|
17
20
|
config.expect_with :rspec do |expectations|
|
21
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
22
|
expectations.syntax = :expect
|
19
23
|
end
|
20
24
|
|
@@ -23,10 +27,15 @@ RSpec.configure do |config|
|
|
23
27
|
mocks.verify_partial_doubles = true
|
24
28
|
end
|
25
29
|
|
30
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
31
|
+
config.disable_monkey_patching!
|
26
32
|
config.example_status_persistence_file_path = 'tmp/rspec_examples.txt'
|
33
|
+
config.filter_run_when_matching :focus
|
27
34
|
config.order = :random
|
35
|
+
config.profile_examples = 10
|
36
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
28
37
|
|
29
|
-
|
38
|
+
Kernel.srand config.seed
|
30
39
|
end
|
31
40
|
|
32
41
|
WebMock.disable_net_connect!(allow_localhost: true)
|