welaika-suspenders 2.29.0.alpha.1 → 2.29.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/suspenders/app_builder.rb +5 -19
- data/lib/suspenders/generators/app_generator.rb +7 -5
- data/lib/suspenders/generators/decorator_generator.rb +1 -1
- data/lib/suspenders/generators/factories_generator.rb +5 -0
- data/lib/suspenders/generators/lint_generator.rb +14 -2
- data/lib/suspenders/generators/security_generator.rb +0 -9
- data/lib/suspenders/version.rb +1 -1
- data/spec/features/new_project_spec.rb +2 -1
- data/templates/Gemfile.erb +34 -35
- data/templates/bin_setup +28 -18
- data/templates/chromedriver.rb +5 -3
- data/templates/factory_bot.rake +20 -0
- data/templates/overcommit.yml +14 -0
- data/templates/rails_helper.rb +3 -2
- data/templates/rakefile_template.rb +20 -0
- data/templates/reek +7 -0
- data/templates/rubocop.yml +3 -0
- metadata +5 -5
- data/templates/brakeman.rake +0 -20
- data/templates/bundler_audit.rake +0 -6
- data/templates/rubocop.rake +0 -7
- data/templates/slim-lint.rake +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c15d50a9c274c2685a1a9807bd5dd3c68e23308e4f9367da74d1ca7270aef1
|
4
|
+
data.tar.gz: 28b04a2011baaa632eb1ab8889bf413a42aede7b102e2b167760aea3fd808c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 113ae2339f91f79d66f7cee8fba15e2f11f78cbad5fd0db05ae75e8dec9c2b1342da198c2f4118dde86256a2266a2557f39ae885ce28fb57819d612d95327e27
|
7
|
+
data.tar.gz: 3c9fad55bfb2c5826956a20de2b1a4255df2b0ab4a7f44defe47d39be6b7f37e55f11ae6a256f26001362455cb4557c82dd32b2bcf7e9e2ba1fe377312cd8ac4
|
@@ -313,25 +313,11 @@ you can deploy to staging and production with:
|
|
313
313
|
"Rails.application.routes.draw do\nend"
|
314
314
|
end
|
315
315
|
|
316
|
-
def
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
if defined? RSpec
|
322
|
-
task(:spec).clear
|
323
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
324
|
-
t.verbose = false
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
task default: :rubocop
|
329
|
-
task default: :slim_lint
|
330
|
-
task default: 'brakeman:check'
|
331
|
-
task default: 'bundle:audit'
|
332
|
-
task default: :spec
|
333
|
-
EOS
|
334
|
-
end
|
316
|
+
def setup_rakefile
|
317
|
+
# NOTE: we named our file `rakefile_template` and not
|
318
|
+
# `Rakefile` because otherwise `copy_file` would copy the
|
319
|
+
# rails `Rakefile` into the project folder.
|
320
|
+
copy_file 'rakefile_template.rb', 'Rakefile', force: true
|
335
321
|
end
|
336
322
|
|
337
323
|
private
|
@@ -104,17 +104,19 @@ module Suspenders
|
|
104
104
|
build :configure_action_mailer
|
105
105
|
build :configure_locales_and_time_zone
|
106
106
|
build :configure_time_formats
|
107
|
-
build :
|
107
|
+
build :setup_rakefile
|
108
108
|
build :replace_default_puma_configuration
|
109
109
|
build :set_up_forego
|
110
110
|
build :setup_rack_mini_profiler
|
111
111
|
end
|
112
112
|
|
113
113
|
def create_local_heroku_setup
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
114
|
+
if options[:heroku]
|
115
|
+
say "Creating local Heroku setup"
|
116
|
+
build :create_review_apps_setup_script
|
117
|
+
build :create_deploy_script
|
118
|
+
build :create_heroku_application_manifest_file
|
119
|
+
end
|
118
120
|
end
|
119
121
|
|
120
122
|
def create_heroku_apps
|
@@ -9,6 +9,7 @@ module Suspenders
|
|
9
9
|
|
10
10
|
def add_factory_bot
|
11
11
|
gem "factory_bot_rails", group: %i(development test)
|
12
|
+
gem "database_cleaner", group: %i(development test)
|
12
13
|
Bundler.with_clean_env { run "bundle install" }
|
13
14
|
end
|
14
15
|
|
@@ -16,6 +17,10 @@ module Suspenders
|
|
16
17
|
copy_file "factory_bot_rspec.rb", "spec/support/factory_bot.rb"
|
17
18
|
end
|
18
19
|
|
20
|
+
def set_up_factory_lint
|
21
|
+
copy_file 'factory_bot.rake', 'lib/tasks/factory_bot.rake'
|
22
|
+
end
|
23
|
+
|
19
24
|
def provide_dev_prime_task
|
20
25
|
copy_file "dev.rake", "lib/tasks/dev.rake"
|
21
26
|
end
|
@@ -11,24 +11,36 @@ module Suspenders
|
|
11
11
|
gem 'rubocop', require: false, group: :development
|
12
12
|
gem 'rubocop-rspec', require: false, group: :development
|
13
13
|
gem 'slim_lint', require: false, group: :development
|
14
|
+
gem 'overcommit', require: false, group: :development
|
15
|
+
gem 'rubycritic', require: false, group: :development
|
14
16
|
Bundler.with_clean_env { run "bundle install" }
|
15
17
|
end
|
16
18
|
|
17
19
|
def setup_rubocop
|
18
|
-
copy_file "rubocop.rake", "lib/tasks/rubocop.rake"
|
19
20
|
copy_file "rubocop.yml", ".rubocop.yml"
|
20
21
|
copy_file "rubocop_todo.yml", ".rubocop_todo.yml"
|
21
22
|
end
|
22
23
|
|
23
24
|
def setup_slim_lint
|
24
|
-
copy_file "slim-lint.rake", "lib/tasks/slim-lint.rake"
|
25
25
|
copy_file "slim-lint.yml", ".slim-lint.yml"
|
26
26
|
end
|
27
27
|
|
28
|
+
def setup_overcommit
|
29
|
+
run "overcommit --install"
|
30
|
+
copy_file "overcommit.yml", ".overcommit.yml", force: true
|
31
|
+
run "overcommit --sign"
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_rubycritic
|
35
|
+
copy_file "reek", ".reek"
|
36
|
+
end
|
37
|
+
|
28
38
|
def create_binstubs
|
29
39
|
Bundler.with_clean_env do
|
30
40
|
run "bundle binstubs rubocop"
|
31
41
|
run "bundle binstubs slim_lint"
|
42
|
+
run "bundle binstubs overcommit"
|
43
|
+
run "bundle binstubs rubycritic"
|
32
44
|
end
|
33
45
|
end
|
34
46
|
end
|
@@ -13,15 +13,6 @@ module Suspenders
|
|
13
13
|
Bundler.with_clean_env { run "bundle install" }
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
def setup_brakeman
|
18
|
-
copy_file "brakeman.rake", "lib/tasks/brakeman.rake"
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup_bundler_audit
|
22
|
-
copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
|
23
|
-
end
|
24
|
-
|
25
16
|
def create_binstubs
|
26
17
|
Bundler.with_clean_env { run "bundle binstubs brakeman" }
|
27
18
|
end
|
data/lib/suspenders/version.rb
CHANGED
@@ -24,7 +24,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
24
24
|
it "ensures project specs pass" do
|
25
25
|
Dir.chdir(project_path) do
|
26
26
|
Bundler.with_clean_env do
|
27
|
-
expect(`
|
27
|
+
expect(`bundle exec rspec spec/`).to include('0 failures')
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -230,6 +230,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
230
230
|
expect(File).to exist("#{project_path}/bin/brakeman")
|
231
231
|
expect(File).to exist("#{project_path}/bin/rubocop")
|
232
232
|
expect(File).to exist("#{project_path}/bin/rspec")
|
233
|
+
expect(File).to exist("#{project_path}/bin/overcommit")
|
233
234
|
end
|
234
235
|
|
235
236
|
it "removes comments and extra newlines from config files" do
|
data/templates/Gemfile.erb
CHANGED
@@ -1,54 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
git_source(:github) do |repo_name|
|
6
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?(
|
6
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
7
7
|
"https://github.com/#{repo_name}.git"
|
8
8
|
end
|
9
9
|
|
10
|
-
ruby
|
11
|
-
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
18
|
-
gem
|
19
|
-
gem
|
20
|
-
gem
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem
|
24
|
-
gem
|
25
|
-
gem
|
26
|
-
gem
|
27
|
-
gem "bootsnap", ">= 1.1.0", require: false
|
10
|
+
ruby '<%= Suspenders::RUBY_VERSION %>'
|
11
|
+
|
12
|
+
gem 'active_interaction', '~> 3.6'
|
13
|
+
gem 'autoprefixer-rails'
|
14
|
+
gem 'coffee-rails', '~> 4.2'
|
15
|
+
gem 'email_validator'
|
16
|
+
gem 'flutie'
|
17
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
18
|
+
gem 'puma', '~> 3.11'
|
19
|
+
gem 'rack-canonical-host'
|
20
|
+
gem 'rails', '<%= Suspenders::RAILS_VERSION %>'
|
21
|
+
gem 'rails-i18n'
|
22
|
+
gem 'recipient_interceptor'
|
23
|
+
gem 'sass-rails', '~> 5.0'
|
24
|
+
gem 'title'
|
25
|
+
gem 'uglifier', '>= 1.3.0'
|
26
|
+
gem 'bootsnap', '>= 1.1.0', require: false
|
28
27
|
<% if options[:webpack] %>
|
29
|
-
gem
|
28
|
+
gem 'webpacker'
|
30
29
|
<% end %>
|
31
30
|
|
32
31
|
group :development do
|
33
|
-
gem
|
34
|
-
gem
|
35
|
-
gem
|
36
|
-
gem
|
37
|
-
gem
|
32
|
+
gem 'letter_opener'
|
33
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
34
|
+
gem 'rack-mini-profiler', require: false
|
35
|
+
gem 'spring'
|
36
|
+
gem 'web-console', '>= 3.3.0'
|
38
37
|
end
|
39
38
|
|
40
39
|
group :development, :test do
|
41
|
-
gem
|
42
|
-
gem
|
43
|
-
gem
|
44
|
-
gem
|
40
|
+
gem 'awesome_print'
|
41
|
+
gem 'dotenv-rails'
|
42
|
+
gem 'pry-byebug'
|
43
|
+
gem 'pry-rails'
|
45
44
|
end
|
46
45
|
|
47
46
|
group :test do
|
48
|
-
gem
|
49
|
-
gem
|
50
|
-
gem
|
51
|
-
gem
|
47
|
+
gem 'launchy'
|
48
|
+
gem 'simplecov', require: false
|
49
|
+
gem 'timecop'
|
50
|
+
gem 'webmock'
|
52
51
|
end
|
53
52
|
|
54
|
-
gem
|
53
|
+
gem 'welaika-suspenders', '~> <%= Suspenders::VERSION %>', group: %i[development test]
|
data/templates/bin_setup
CHANGED
@@ -1,24 +1,34 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
2
4
|
|
3
|
-
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
chdir APP_ROOT do
|
12
|
+
puts '== Installing dependencies =='
|
13
|
+
system! 'gem install bundler --conservative'
|
14
|
+
system('bundle check') || system!('bundle install')
|
11
15
|
|
12
|
-
|
13
|
-
bin/rails dev:prime
|
16
|
+
system('bin/yarn')
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
echo
|
20
|
-
fi
|
18
|
+
puts "\n== Copying sample files =="
|
19
|
+
unless File.exist?('.env.local')
|
20
|
+
cp '.env', '.env.local'
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
puts "\n== Preparing database and seeds =="
|
24
|
+
system! 'bin/rake dev:prime'
|
25
|
+
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
27
|
+
system! 'bin/rails log:clear tmp:clear'
|
28
|
+
|
29
|
+
puts "\n== Restarting application server =="
|
30
|
+
system! 'bin/rails restart'
|
31
|
+
|
32
|
+
puts "\n== Activating overcommit =="
|
33
|
+
system! 'bin/overcommit --install'
|
34
|
+
end
|
data/templates/chromedriver.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'selenium/webdriver'
|
4
4
|
|
5
5
|
Capybara.register_driver :chrome do |app|
|
6
6
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
@@ -8,12 +8,14 @@ end
|
|
8
8
|
|
9
9
|
Capybara.register_driver :headless_chrome do |app|
|
10
10
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
11
|
-
chromeOptions: { args: %w
|
11
|
+
chromeOptions: { args: %w[headless disable-gpu] }
|
12
12
|
)
|
13
13
|
|
14
|
-
Capybara::Selenium::Driver.new
|
14
|
+
Capybara::Selenium::Driver.new(
|
15
|
+
app,
|
15
16
|
browser: :chrome,
|
16
17
|
desired_capabilities: capabilities
|
18
|
+
)
|
17
19
|
end
|
18
20
|
|
19
21
|
Capybara.javascript_driver = :headless_chrome
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'database_cleaner'
|
4
|
+
|
5
|
+
namespace :factory_bot do
|
6
|
+
desc 'Verify that all FactoryBot factories are valid'
|
7
|
+
task lint: :environment do
|
8
|
+
if Rails.env.test?
|
9
|
+
sh 'bundle exec rails db:migrate'
|
10
|
+
DatabaseCleaner.clean_with :truncation
|
11
|
+
DatabaseCleaner.strategy = :transaction
|
12
|
+
DatabaseCleaner.cleaning do
|
13
|
+
FactoryBot.lint(traits: true)
|
14
|
+
end
|
15
|
+
else
|
16
|
+
system('bundle exec rake factory_bot:lint RAILS_ENV=test')
|
17
|
+
raise if $CHILD_STATUS.exitstatus.nonzero?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
gemfile: 'Gemfile'
|
2
|
+
|
3
|
+
verify_signatures: false # (default: true)
|
4
|
+
|
5
|
+
PreCommit:
|
6
|
+
RuboCop:
|
7
|
+
enabled: true
|
8
|
+
on_warn: fail # Treat all warnings as failures
|
9
|
+
command: ['bundle', 'exec', 'rubocop'] # Invoke within Bundler context
|
10
|
+
|
11
|
+
SlimLint:
|
12
|
+
enabled: true
|
13
|
+
on_warn: fail # Treat all warnings as failures
|
14
|
+
command: ['bundle', 'exec', 'slim-lint'] # Invoke within Bundler context
|
data/templates/rails_helper.rb
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
ENV['RACK_ENV'] = 'test'
|
4
4
|
|
5
|
-
require File.expand_path('
|
5
|
+
require File.expand_path('../config/environment', __dir__)
|
6
|
+
|
7
|
+
|
6
8
|
abort('DATABASE_URL environment variable is set') if ENV['DATABASE_URL']
|
7
9
|
|
8
10
|
require 'rspec/rails'
|
@@ -26,4 +28,3 @@ RSpec.configure do |config|
|
|
26
28
|
# arbitrary gems may also be filtered via:
|
27
29
|
# config.filter_gems_from_backtrace('gem name')
|
28
30
|
end
|
29
|
-
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
4
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
5
|
+
|
6
|
+
require_relative 'config/application'
|
7
|
+
|
8
|
+
Rails.application.load_tasks
|
9
|
+
task(:default).clear
|
10
|
+
|
11
|
+
desc 'Run linters, quality, security and tests'
|
12
|
+
task :default do
|
13
|
+
sh 'bundle exec rubocop'
|
14
|
+
sh 'bundle exec rubycritic app/ config/ lib/ --no-browser --minimum-score 94 --format console'
|
15
|
+
sh 'bundle exec bundle-audit check --update'
|
16
|
+
sh 'bundle exec brakeman -z'
|
17
|
+
sh 'bundle exec rails db:migrate RAILS_ENV=test'
|
18
|
+
sh 'bundle exec rake factory_bot:lint RAILS_ENV=test'
|
19
|
+
sh 'bundle exec rspec spec/'
|
20
|
+
end
|
data/templates/reek
ADDED
data/templates/rubocop.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: welaika-suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.29.0.alpha.
|
4
|
+
version: 2.29.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
@@ -117,9 +117,7 @@ files:
|
|
117
117
|
- templates/bin_deploy
|
118
118
|
- templates/bin_setup
|
119
119
|
- templates/bin_setup_review_app.erb
|
120
|
-
- templates/brakeman.rake
|
121
120
|
- templates/browserslist
|
122
|
-
- templates/bundler_audit.rake
|
123
121
|
- templates/capybara_helpers.rb
|
124
122
|
- templates/chromedriver.rb
|
125
123
|
- templates/config_locales_it.yml.erb
|
@@ -128,23 +126,25 @@ files:
|
|
128
126
|
- templates/dotfiles/.env
|
129
127
|
- templates/email.rb
|
130
128
|
- templates/errors.rb
|
129
|
+
- templates/factory_bot.rake
|
131
130
|
- templates/factory_bot_rspec.rb
|
132
131
|
- templates/faker_rspec.rb
|
133
132
|
- templates/flashes_helper.rb
|
134
133
|
- templates/i18n.rb
|
135
134
|
- templates/json_encoding.rb
|
135
|
+
- templates/overcommit.yml
|
136
136
|
- templates/postgresql_database.yml.erb
|
137
137
|
- templates/puma.rb
|
138
138
|
- templates/queries_helper_rspec.rb
|
139
139
|
- templates/rack_mini_profiler.rb
|
140
140
|
- templates/rails_helper.rb
|
141
|
-
- templates/
|
141
|
+
- templates/rakefile_template.rb
|
142
|
+
- templates/reek
|
142
143
|
- templates/rubocop.yml
|
143
144
|
- templates/rubocop_todo.yml
|
144
145
|
- templates/secrets.yml
|
145
146
|
- templates/sentry.rb
|
146
147
|
- templates/shoulda_matchers_config_rspec.rb
|
147
|
-
- templates/slim-lint.rake
|
148
148
|
- templates/slim-lint.yml
|
149
149
|
- templates/slim.rb
|
150
150
|
- templates/smtp.rb
|
data/templates/brakeman.rake
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Rails.env.development? || Rails.env.test?
|
4
|
-
namespace :brakeman do
|
5
|
-
desc 'Run Brakeman'
|
6
|
-
task :run, :output_files do |_t, args|
|
7
|
-
require 'brakeman'
|
8
|
-
|
9
|
-
files = args[:output_files].split(' ') if args[:output_files]
|
10
|
-
Brakeman.run app_path: '.', output_files: files, print_report: true
|
11
|
-
end
|
12
|
-
|
13
|
-
desc 'Check your code with Brakeman'
|
14
|
-
task :check do
|
15
|
-
require 'brakeman'
|
16
|
-
result = Brakeman.run app_path: '.', print_report: true
|
17
|
-
exit Brakeman::Warnings_Found_Exit_Code unless result.filtered_warnings.empty?
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/templates/rubocop.rake
DELETED