code42template 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/Gemfile +3 -0
  6. data/NEWS.md +56 -0
  7. data/README.md +280 -0
  8. data/Rakefile +8 -0
  9. data/bin/code42template +24 -0
  10. data/bin/rake +16 -0
  11. data/bin/rspec +16 -0
  12. data/bin/setup +13 -0
  13. data/code42template.gemspec +30 -0
  14. data/lib/code42template/actions.rb +28 -0
  15. data/lib/code42template/adapters/heroku.rb +174 -0
  16. data/lib/code42template/app_builder.rb +251 -0
  17. data/lib/code42template/generators/app_generator.rb +208 -0
  18. data/lib/code42template/version.rb +9 -0
  19. data/lib/code42template.rb +5 -0
  20. data/spec/adapters/heroku_spec.rb +56 -0
  21. data/spec/code42template.rb +58 -0
  22. data/spec/fakes/bin/heroku +5 -0
  23. data/spec/fakes/bin/hub +5 -0
  24. data/spec/features/heroku_spec.rb +83 -0
  25. data/spec/features/new_project_spec.rb +186 -0
  26. data/spec/fixtures/feature_smoke_test.rb +15 -0
  27. data/spec/fixtures/home_controller.rb +4 -0
  28. data/spec/fixtures/index.html.erb +1 -0
  29. data/spec/fixtures/routes.rb +3 -0
  30. data/spec/fixtures/smoke_test.rb +10 -0
  31. data/spec/spec_helper.rb +14 -0
  32. data/spec/support/code42template.rb +83 -0
  33. data/spec/support/fake_heroku.rb +83 -0
  34. data/templates/Gemfile.erb +42 -0
  35. data/templates/Procfile +3 -0
  36. data/templates/README.md.erb +10 -0
  37. data/templates/active_job.rb +1 -0
  38. data/templates/application.js +1 -0
  39. data/templates/bin_deploy +12 -0
  40. data/templates/bin_setup +21 -0
  41. data/templates/bin_setup_review_app.erb +19 -0
  42. data/templates/code42_gitignore +16 -0
  43. data/templates/config_locales_pt-BR.yml.erb +17 -0
  44. data/templates/dotfiles/.babelrc +5 -0
  45. data/templates/dotfiles/.codeclimate.yml +3 -0
  46. data/templates/dotfiles/.env +8 -0
  47. data/templates/dotfiles/.rspec +2 -0
  48. data/templates/dotfiles/.rubocop.yml +20 -0
  49. data/templates/feature_helper.rb.erb +5 -0
  50. data/templates/health.rake +22 -0
  51. data/templates/karma.conf.js +48 -0
  52. data/templates/mocha-webpack.opts +4 -0
  53. data/templates/package.json +39 -0
  54. data/templates/postgresql_database.yml.erb +22 -0
  55. data/templates/puma.rb +28 -0
  56. data/templates/rails_helper.rb +59 -0
  57. data/templates/secrets.yml +14 -0
  58. data/templates/setup +32 -0
  59. data/templates/sidekiq.yml +7 -0
  60. data/templates/spec/javascripts/.gitkeep +0 -0
  61. data/templates/spec/javascripts/index.browser.js +5 -0
  62. data/templates/spec/javascripts/index.integration.js +5 -0
  63. data/templates/spec/javascripts/integration/smoke.spec.js +7 -0
  64. data/templates/spec/javascripts/unit/smoke.spec.js +7 -0
  65. data/templates/spec_helper.rb +15 -0
  66. data/templates/travis.yml.erb +12 -0
  67. data/templates/webpack.config.js +68 -0
  68. data/templates/webpack.config.test.browser.js +17 -0
  69. data/templates/webpack.config.test.js +5 -0
  70. data/templates/webpack.rake +26 -0
  71. metadata +158 -0
@@ -0,0 +1,186 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Create a new project with default configuration" do
4
+ before(:all) do
5
+ drop_dummy_database
6
+ remove_project_directory
7
+ run_code42template
8
+ end
9
+
10
+ it "uses custom Gemfile" do
11
+ gemfile_file = IO.read("#{project_path}/Gemfile")
12
+
13
+ expect(gemfile_file).to match(
14
+ /^ruby "#{Code42Template::RUBY_VERSION}"$/,
15
+ )
16
+ expect(gemfile_file).to match(
17
+ /^gem "rails", "#{Code42Template::RAILS_VERSION}"$/,
18
+ )
19
+ end
20
+
21
+ it "ensures project specs pass" do
22
+ copy_file 'smoke_test.rb', 'spec/models/smoke_test_spec.rb'
23
+ copy_file 'feature_smoke_test.rb', 'spec/models/feature_smoke_spec.rb'
24
+ copy_file 'routes.rb', 'config/routes.rb'
25
+ copy_file 'home_controller.rb', 'app/controllers/home_controller.rb'
26
+ copy_file 'index.html.erb', 'app/views/home/index.html.erb'
27
+
28
+ Dir.chdir(project_path) do
29
+ Bundler.with_clean_env do
30
+ expect(`rake health`).to include(
31
+ '3 examples, 0 failures', # rspec
32
+ 'LOC (100.0%) covered.', # simplecov
33
+ 'no offenses detected', # rubocop
34
+ 'Security Warnings | 0', # brakeman
35
+ 'No vulnerabilities found', # bundler-audit
36
+ '1 passing', # mocha
37
+ 'TOTAL: 1 SUCCESS' # karma
38
+ )
39
+ end
40
+ end
41
+ end
42
+
43
+ it "creates .ruby-version from template's .ruby-version" do
44
+ ruby_version_file = IO.read("#{project_path}/.ruby-version")
45
+
46
+ expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
47
+ end
48
+
49
+ it "copies dotfiles" do
50
+ %w[.env .rspec .codeclimate.yml].each do |dotfile|
51
+ expect(File).to exist("#{project_path}/#{dotfile}")
52
+ end
53
+ end
54
+
55
+ it 'copies rspec configuration' do
56
+ %w[spec_helper.rb rails_helper.rb].each do |spec_config|
57
+ expect(File).to exist(file_path("spec/#{spec_config}"))
58
+ end
59
+ end
60
+
61
+ it 'copies NPM and javascript files' do
62
+ %w[
63
+ config/karma.conf.js
64
+ config/webpack.config.js
65
+ config/webpack.config.test.js
66
+ config/webpack.config.test.browser.js
67
+ spec/javascripts/index.browser.js
68
+ spec/javascripts/index.integration.js
69
+ spec/javascripts/unit/smoke.spec.js
70
+ package.json
71
+ Procfile
72
+ mocha-webpack.opts
73
+ ].each do |file|
74
+ expect(File).to exist(file_path(file))
75
+ end
76
+ end
77
+
78
+ it 'copies health task and continuous integration setup' do
79
+ expect(File).to exist(file_path('lib/tasks/health.rake'))
80
+ expect(File).to exist(file_path('.travis.yml'))
81
+ end
82
+
83
+ it "loads secret_key_base from env" do
84
+ secrets_file = IO.read("#{project_path}/config/secrets.yml")
85
+
86
+ expect(secrets_file).to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
87
+ end
88
+
89
+ it "adds bin/setup file" do
90
+ expect(File).to exist("#{project_path}/bin/setup")
91
+ end
92
+
93
+ it "makes bin/setup executable" do
94
+ bin_setup_path = "#{project_path}/bin/setup"
95
+
96
+ expect(File.stat(bin_setup_path)).to be_executable
97
+ end
98
+
99
+ it 'sets action dispatch show exceptions to true in test env' do
100
+ test_config = read_file('config/environments/test.rb')
101
+
102
+ expect(test_config).to match(
103
+ /config.action_dispatch.show_exceptions.*=.*true/
104
+ )
105
+ expect(test_config).not_to match(
106
+ /config.action_dispatch.show_exceptions.*=.*false/
107
+ )
108
+ end
109
+
110
+ it "adds explicit quiet_assets configuration" do
111
+ result = IO.read("#{project_path}/config/application.rb")
112
+
113
+ expect(result).to match(/^ +config.assets.quiet = true$/)
114
+ end
115
+
116
+ it "adds spring to binstubs" do
117
+ expect(File).to exist("#{project_path}/bin/spring")
118
+
119
+ bin_stubs = %w(rake rails rspec)
120
+ bin_stubs.each do |bin_stub|
121
+ expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(/spring/)
122
+ end
123
+ end
124
+
125
+ it "configs bullet gem in development" do
126
+ test_config = IO.read("#{project_path}/config/environments/development.rb")
127
+
128
+ expect(test_config).to match /^ +Bullet.enable = true$/
129
+ expect(test_config).to match /^ +Bullet.bullet_logger = true$/
130
+ expect(test_config).to match /^ +Bullet.rails_logger = true$/
131
+ end
132
+
133
+ it "creates review apps setup script" do
134
+ bin_setup_path = "#{project_path}/bin/setup_review_app"
135
+ bin_setup = IO.read(bin_setup_path)
136
+
137
+ expect(bin_setup).to include(
138
+ "heroku run rake db:migrate --exit-code "\
139
+ "--app #{app_name.dasherize}-staging-pr-$1"
140
+ )
141
+ expect(bin_setup).to include(
142
+ "heroku ps:scale worker=1 "\
143
+ "--app #{app_name.dasherize}-staging-pr-$1"
144
+ )
145
+ expect(bin_setup).to include(
146
+ "heroku restart "\
147
+ "--app #{app_name.dasherize}-staging-pr-$1"
148
+ )
149
+ expect(File.stat(bin_setup_path)).to be_executable
150
+ end
151
+
152
+ it "creates deploy script" do
153
+ bin_deploy_path = "#{project_path}/bin/deploy"
154
+ bin_deploy = IO.read(bin_deploy_path)
155
+
156
+ expect(bin_deploy).to include("heroku run rake db:migrate --exit-code")
157
+ expect(File.stat(bin_deploy_path)).to be_executable
158
+ end
159
+
160
+ it "sets up heroku specific gems" do
161
+ gemfile_file = IO.read("#{project_path}/Gemfile")
162
+
163
+ expect(gemfile_file).to include %{gem 'rails_12factor'}
164
+ end
165
+
166
+ def app_name
167
+ Code42TemplateTestHelpers::APP_NAME
168
+ end
169
+
170
+ def read_file(path)
171
+ IO.read(file_path(path))
172
+ end
173
+
174
+ def file_path(path)
175
+ File.join(project_path, path)
176
+ end
177
+
178
+ def copy_file(source_fixture_name, destination_path)
179
+ source_path = Pathname(__dir__).join('..', 'fixtures', source_fixture_name)
180
+ destination_path = Pathname(project_path).join(destination_path)
181
+ destination_dir = destination_path.join('..')
182
+ FileUtils.mkdir_p(destination_dir) unless destination_dir.exist?
183
+
184
+ FileUtils.cp(source_path, destination_path)
185
+ end
186
+ end
@@ -0,0 +1,15 @@
1
+ require 'feature_helper'
2
+
3
+ RSpec.feature 'feature smoke test' do
4
+ it 'works with js', js: true do
5
+ visit '/'
6
+
7
+ expect(page).to have_content('It works!')
8
+ end
9
+
10
+ it 'works without js' do
11
+ visit '/'
12
+
13
+ expect(page).to have_content('It works!')
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1 @@
1
+ <p>It works!</p>
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ root to: 'home#index'
3
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'rails_helper smoke test' do
4
+ it 'is configured correctly' do
5
+ expect(Rails.env).to be_test
6
+ expect(RSpec.configuration.use_transactional_fixtures).to eq true
7
+ expect(Capybara.javascript_driver).to eq :poltergeist
8
+ expect(Capybara.default_driver).to eq :rack_test
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ require 'bundler/setup'
2
+
3
+ require (Pathname.new(__FILE__).dirname + '../lib/code42template').expand_path
4
+
5
+ Dir['./spec/support/**/*.rb'].each { |file| require file }
6
+
7
+ RSpec.configure do |config|
8
+ config.include Code42TemplateTestHelpers
9
+
10
+ config.before(:all) do
11
+ add_fakes_to_path
12
+ create_tmp_directory
13
+ end
14
+ end
@@ -0,0 +1,83 @@
1
+ module Code42TemplateTestHelpers
2
+ APP_NAME = "dummy_app"
3
+
4
+ def remove_project_directory
5
+ FileUtils.rm_rf(project_path)
6
+ end
7
+
8
+ def create_tmp_directory
9
+ FileUtils.mkdir_p(tmp_path)
10
+ end
11
+
12
+ def run_code42template(arguments = nil)
13
+ arguments = "--path=#{root_path} #{arguments}"
14
+ Dir.chdir(tmp_path) do
15
+ Bundler.with_clean_env do
16
+ add_fakes_to_path
17
+ `
18
+ #{code42template_bin} #{APP_NAME} #{arguments}
19
+ `
20
+ end
21
+ end
22
+ end
23
+
24
+ def code42template_help_command
25
+ Dir.chdir(tmp_path) do
26
+ Bundler.with_clean_env do
27
+ `
28
+ #{code42template_bin} -h
29
+ `
30
+ end
31
+ end
32
+ end
33
+
34
+ def setup_app_dependencies
35
+ if File.exist?(project_path)
36
+ Dir.chdir(project_path) do
37
+ Bundler.with_clean_env do
38
+ `bundle check || bundle install`
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ def drop_dummy_database
45
+ if File.exist?(project_path)
46
+ Dir.chdir(project_path) do
47
+ Bundler.with_clean_env do
48
+ `rake db:drop`
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ def add_fakes_to_path
55
+ ENV["PATH"] = "#{support_bin}:#{ENV['PATH']}"
56
+ end
57
+
58
+ def project_path
59
+ @project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
60
+ end
61
+
62
+ def usage_file
63
+ @usage_path ||= File.join(root_path, "USAGE")
64
+ end
65
+
66
+ private
67
+
68
+ def tmp_path
69
+ @tmp_path ||= Pathname.new("#{root_path}/tmp")
70
+ end
71
+
72
+ def code42template_bin
73
+ File.join(root_path, 'bin', 'code42template')
74
+ end
75
+
76
+ def support_bin
77
+ File.join(root_path, "spec", "fakes", "bin")
78
+ end
79
+
80
+ def root_path
81
+ File.expand_path('../../../', __FILE__)
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ require 'pathname'
2
+
3
+ class FakeHeroku
4
+ RECORDER = Pathname(__dir__).join('..', '..', 'tmp', 'heroku_commands')
5
+
6
+ def initialize(args)
7
+ @args = args
8
+ end
9
+
10
+ def run!
11
+ if @args.first == "plugins"
12
+ puts "heroku-pipelines@0.29.0"
13
+ end
14
+
15
+ File.open(RECORDER, 'a') do |file|
16
+ file.puts @args.join(' ')
17
+ end
18
+ end
19
+
20
+ def self.clear!
21
+ FileUtils.rm_rf RECORDER
22
+ end
23
+
24
+ def self.has_gem_included?(project_path, gem_name)
25
+ gemfile = File.open(File.join(project_path, 'Gemfile'), 'a')
26
+
27
+ File.foreach(gemfile).any? do |line|
28
+ line.match(/#{Regexp.quote(gem_name)}/)
29
+ end
30
+ end
31
+
32
+ def self.has_configured_buildpacks_sequentially?(environment, buildpack_urls)
33
+ lines = commands_ran.each_line.grep(
34
+ /.*buildpacks:(add|clear).*#{environment}.*/
35
+ )
36
+ app_name = app_name_for(environment)
37
+
38
+ if lines.shift !~ /^buildpacks:clear -a #{app_name} --remote #{environment}/
39
+ fail "Expected #{environment} to have cleared buildpacks before "\
40
+ "adding new ones"
41
+ end
42
+
43
+ if lines.count != buildpack_urls.count
44
+ fail "Expected #{environment} to have #{buildpack_urls.count} "\
45
+ "buildpacks configured but has #{lines.count}"
46
+ end
47
+
48
+ lines.zip(buildpack_urls).all? do |line, buildpack_url|
49
+ line =~ /^buildpacks:add #{buildpack_url} -a #{app_name} --remote #{environment}/
50
+ end
51
+ end
52
+
53
+ def self.has_created_app_for?(environment, flags = nil)
54
+ app_name = app_name_for(environment)
55
+
56
+ command = if flags
57
+ "create #{app_name} #{flags} --remote #{environment}\n"
58
+ else
59
+ "create #{app_name} --remote #{environment}\n"
60
+ end
61
+
62
+ File.foreach(RECORDER).any? { |line| line == command }
63
+ end
64
+
65
+ def self.has_configured_vars?(remote_name, var, value = '.+')
66
+ commands_ran =~ /^config:add #{var}=#{value} --remote #{remote_name}\n/
67
+ end
68
+
69
+ def self.has_setup_pipeline_for?(app_name)
70
+ commands_ran =~ /^pipelines:create #{app_name} -a #{app_name}-staging --stage staging/ &&
71
+ commands_ran =~ /^pipelines:add #{app_name} -a #{app_name}-production --stage production/
72
+ end
73
+
74
+ def self.commands_ran
75
+ @commands_ran ||= File.read(RECORDER)
76
+ end
77
+ private_class_method :commands_ran
78
+
79
+ def self.app_name_for(environment)
80
+ "#{Code42TemplateTestHelpers::APP_NAME.dasherize}-#{environment}"
81
+ end
82
+ private_class_method :app_name_for
83
+ end
@@ -0,0 +1,42 @@
1
+ source "https://rubygems.org"
2
+
3
+ ruby "<%= Code42Template::RUBY_VERSION %>"
4
+
5
+ gem "pg"
6
+ gem "rails", "<%= Code42Template::RAILS_VERSION %>"
7
+ gem 'puma'
8
+ gem 'rack-mini-profiler'
9
+ gem 'rubocop', require: false
10
+ gem 'webpack-rails'
11
+ gem 'foreman'
12
+ gem 'sidekiq'
13
+
14
+ group :development do
15
+ gem "spring"
16
+ gem "spring-commands-rspec"
17
+ gem "binding_of_caller"
18
+ gem "better_errors"
19
+ end
20
+
21
+ group :development, :test do
22
+ gem 'brakeman', require: false
23
+ gem "bullet"
24
+ gem 'listen'
25
+ gem "bundler-audit", require: false
26
+ gem "dotenv-rails"
27
+ gem "pry-byebug"
28
+ gem "pry-rails"
29
+ gem "rspec-rails", "~> 3.5.1"
30
+ end
31
+
32
+ group :test do
33
+ gem 'database_cleaner'
34
+ gem 'capybara'
35
+ gem 'factory_girl_rails'
36
+ gem 'simplecov', require: false
37
+ gem 'poltergeist'
38
+ end
39
+
40
+ group :staging, :production do
41
+ gem 'rails_12factor'
42
+ end
@@ -0,0 +1,3 @@
1
+ rails: bundle exec puma -p $PORT -C ./config/puma.rb
2
+ webpack: ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js
3
+ worker: bundle exec sidekiq -C ./config/sidekiq.yml
@@ -0,0 +1,10 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Getting Started
4
+
5
+ After you have cloned this repo, run this setup script to set up your machine
6
+ with the necessary dependencies to run and test this app:
7
+
8
+ % ./bin/setup
9
+
10
+ It assumes you have a machine equipped with Ruby, Postgres, etc.
@@ -0,0 +1 @@
1
+ ActiveJob::Base.queue_adapter = :sidekiq
@@ -0,0 +1 @@
1
+ (() => console.log('I am alive!'))()
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ # Run this script to deploy the app to Heroku.
4
+
5
+ set -e
6
+
7
+ branch="$(git symbolic-ref HEAD --short)"
8
+ target="${1:-staging}"
9
+
10
+ git push "$target" "$branch:master"
11
+ heroku run rake db:migrate --exit-code --remote "$target"
12
+ heroku restart --remote "$target"
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ # Set up Rails app. Run this script immediately after cloning the codebase.
4
+ # https://github.com/thoughtbot/guides/tree/master/protocol
5
+
6
+ # Exit if any subcommand fails
7
+ set -e
8
+
9
+ # Set up Ruby dependencies via Bundler
10
+ gem install bundler --conservative
11
+ bundle check || bundle install
12
+
13
+ # Set up database and add any development seed data
14
+ bin/rake dev:prime
15
+
16
+ # Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
17
+ mkdir -p .git/safe
18
+
19
+ # Only if this isn't CI
20
+ # if [ -z "$CI" ]; then
21
+ # fi
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ # Run this script to set up a review app's database and worker dyno
4
+
5
+ set -e
6
+
7
+ if [ -z "$1" ]; then
8
+ printf "You must provide a review app (same as the pull request) id.\n"
9
+ exit 64
10
+ fi
11
+
12
+ heroku pg:backups restore \
13
+ `heroku pg:backups public-url -a <%= app_name.dasherize %>-staging` \
14
+ DATABASE_URL \
15
+ --confirm <%= app_name.dasherize %>-staging-pr-$1 \
16
+ --app <%= app_name.dasherize %>-staging-pr-$1
17
+ heroku run rake db:migrate --exit-code --app <%= app_name.dasherize %>-staging-pr-$1
18
+ heroku ps:scale worker=1 --app <%= app_name.dasherize %>-staging-pr-$1
19
+ heroku restart --app <%= app_name.dasherize %>-staging-pr-$1
@@ -0,0 +1,16 @@
1
+ !.keep
2
+ *.DS_Store
3
+ *.swo
4
+ *.swp
5
+ /.bundle
6
+ /.env.local
7
+ /coverage/*
8
+ /db/*.sqlite3
9
+ /log/*
10
+ /public/system
11
+ /public/assets
12
+ /tags
13
+ /tmp/*
14
+ coverage
15
+ node_modules
16
+ public/webpack
@@ -0,0 +1,17 @@
1
+ pt-BR:
2
+ date:
3
+ formats:
4
+ default:
5
+ "%d/%m/%Y"
6
+
7
+ time:
8
+ formats:
9
+ default:
10
+ "%a, %b %-d, %Y at %r"
11
+ date:
12
+ "%b %-d, %Y"
13
+ short:
14
+ "%B %d"
15
+
16
+ titles:
17
+ application: <%= app_name.humanize %>
@@ -0,0 +1,5 @@
1
+ {
2
+ "presets": [
3
+ "es2015"
4
+ ]
5
+ }
@@ -0,0 +1,3 @@
1
+ languages:
2
+ Ruby: true
3
+ JavaScript: true
@@ -0,0 +1,8 @@
1
+ ASSET_HOST=localhost:3000
2
+ APPLICATION_HOST=localhost:3000
3
+ PORT=3000
4
+ SECRET_KEY_BASE=development_secret
5
+ SMTP_ADDRESS=smtp.example.com
6
+ SMTP_DOMAIN=example.com
7
+ SMTP_PASSWORD=password
8
+ SMTP_USERNAME=username
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ Exclude:
3
+ - Rakefile
4
+ - db/*
5
+ - bin/*
6
+ - config/**/*
7
+ FrozenStringLiteralComment:
8
+ Enabled: false
9
+ AndOr:
10
+ Enabled: false
11
+ IfUnlessModifier:
12
+ Enabled: false
13
+ LeadingCommentSpace:
14
+ Enabled: false
15
+ StringLiterals:
16
+ Enabled: false
17
+ SignalException:
18
+ EnforcedStyle: semantic
19
+ Documentation:
20
+ Enabled: false
@@ -0,0 +1,5 @@
1
+ require 'rails_helper'
2
+ require 'rake'
3
+
4
+ <%= app_name.camelize %>::Application.load_tasks
5
+ Rake::Task['webpack:compile'].invoke
@@ -0,0 +1,22 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ def run_command(command, env = {})
3
+ description = "Running '#{command}'"
4
+ separator = '-' * description.length
5
+
6
+ puts '', separator, description, separator, ''
7
+
8
+ system(env, command) or fail "There was an error while running '#{command}'"
9
+ end
10
+
11
+ desc 'Checks app health: runs tests, security checks and rubocop'
12
+ task :health do
13
+ rails_helper = Rails.root / 'spec/rails_helper.rb'
14
+
15
+ run_command "bundle exec rspec -r#{rails_helper}", 'COVERAGE' => 'true'
16
+ run_command 'npm run test'
17
+ run_command 'bundle exec bundle-audit update'
18
+ run_command 'bundle exec bundle-audit check'
19
+ run_command 'bundle exec brakeman -z'
20
+ run_command 'bundle exec rubocop'
21
+ end
22
+ end