jt_tools 0.0.11 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,9 @@
7
7
  version: 2.1
8
8
 
9
9
  orbs:
10
- ruby: circleci/ruby@1.0.5
11
- node: circleci/node@3.0.1
10
+ browser-tools: circleci/browser-tools@1.1.1
11
+ node: circleci/node@4
12
+ ruby: circleci/ruby@1
12
13
 
13
14
  workflows:
14
15
  version: 2
@@ -38,7 +39,7 @@ jobs:
38
39
  test:
39
40
  docker:
40
41
  # specify the version you desire here
41
- - image: circleci/ruby:2.7-node-browsers
42
+ - image: cimg/ruby:3.0-browsers
42
43
  environment:
43
44
  BUNDLE_GEMFILE: Gemfile
44
45
  BUNDLE_PATH: vendor/bundle
@@ -61,6 +62,8 @@ jobs:
61
62
 
62
63
  steps:
63
64
  - checkout
65
+ - browser-tools/install-chrome
66
+ - browser-tools/install-chromedriver
64
67
 
65
68
  - restore_cache:
66
69
  name: Restore Bundler Cache between Branches
@@ -74,10 +77,14 @@ jobs:
74
77
  with-cache: false
75
78
  path: './vendor/bundle'
76
79
 
80
+ - run: bundle exec bootsnap precompile --gemfile app/ lib/
81
+ - run: gem install spring
82
+
77
83
  - save_cache:
78
84
  name: Save Bundler Cache between Branches
79
85
  paths:
80
- - ./vendor/bundle
86
+ - vendor/bundle
87
+ - tmp/cache/bootsnap-compile-cache
81
88
  key: v1-dependencies-{{ checksum "Gemfile.lock" }}
82
89
 
83
90
  - node/install-packages:
@@ -106,43 +113,45 @@ jobs:
106
113
  - tmp/cache/assets
107
114
  - tmp/cache/webpacker
108
115
 
109
- - restore_cache:
110
- name: Restore Jest Cache
111
- keys:
112
- - jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
113
- - jest-cache-v1-{{ arch }}-{{ .Branch }}-
114
- - jest-cache-v1-
115
-
116
- - run:
117
- name: JavaScript Unit Tests
118
- command: |
119
- bin/yarn test --ci --no-watchman \
120
- --coverage --coverageDirectory coverage/jest \
121
- --coverageReporters text-summary --coverageReporters html \
122
- --reporters=jest-junit
123
- environment:
124
- JEST_JUNIT_OUTPUT_DIR: tmp/reports/jest-results
125
-
126
- - save_cache:
127
- name: Save Jest Cache
128
- key: jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
129
- paths:
130
- - tmp/cache/jest
131
-
132
- - run: bin/rails db:schema:load
133
- # rails test
134
-
135
- # collect reports
116
+ # Run JS Tests
117
+ # - restore_cache:
118
+ # name: Restore Jest Cache
119
+ # keys:
120
+ # - jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
121
+ # - jest-cache-v1-{{ arch }}-{{ .Branch }}-
122
+ # - jest-cache-v1-
123
+ #
124
+ # - run:
125
+ # name: JavaScript Unit Tests
126
+ # command: |
127
+ # bin/yarn test --ci --no-watchman \
128
+ # --coverage --coverageDirectory coverage/jest \
129
+ # --coverageReporters text-summary --coverageReporters html \
130
+ # --reporters=jest-junit
131
+ # environment:
132
+ # JEST_JUNIT_OUTPUT_DIR: tmp/reports/jest-results
133
+ #
134
+ # - save_cache:
135
+ # name: Save Jest Cache
136
+ # key: jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
137
+ # paths:
138
+ # - tmp/cache/jest
139
+
140
+ - run: bin/rails db:test:prepare
141
+ - run: bin/rails test "test/**/*_test.rb"
142
+
143
+ # Collect reports
136
144
  - store_test_results:
137
145
  path: ./tmp/reports/
138
146
  - store_artifacts:
139
147
  path: ./coverage
140
148
  lint:
141
149
  docker:
142
- - image: cimg/ruby:2.7-node
150
+ - image: cimg/ruby:3.0-node
143
151
  environment:
144
152
  DISABLE_SPRING: 1
145
153
  BUNDLE_GEMFILE: Gemfile.tools
154
+ BUNDLE_PATH: vendor/bundle-tools
146
155
  BUNDLE_JOBS: 4
147
156
  BUNDLE_RETRY: 3
148
157
 
@@ -162,7 +171,7 @@ jobs:
162
171
 
163
172
  - run:
164
173
  name: Install Bundle Dependencies
165
- command: bin/bundle check --path vendor/bundle-tools || bin/bundle install --path vendor/bundle-tools
174
+ command: bin/bundle check || bin/bundle install
166
175
 
167
176
  - run:
168
177
  name: Install Node Packages
@@ -178,7 +187,7 @@ jobs:
178
187
 
179
188
  upgrade_tools:
180
189
  docker:
181
- - image: cimg/ruby:2.7-node
190
+ - image: cimg/ruby:3.0-node
182
191
  environment:
183
192
  DISABLE_SPRING: 1
184
193
  BUNDLE_GEMFILE: Gemfile.tools
@@ -0,0 +1,3 @@
1
+ ---
2
+ speedups:
3
+ fetch_with_argument_vs_block: false
@@ -0,0 +1,10 @@
1
+ *.gemspec diff=ruby
2
+ *.rake diff=ruby
3
+ *.rb diff=ruby
4
+ *.js diff=javascript
5
+
6
+ db/schema.rb merge=ours diff=ruby
7
+ yarn.lock merge=ours
8
+ Gemfile.lock merge=ours
9
+
10
+ vendor/* linguist-vendored
@@ -0,0 +1,21 @@
1
+ ---
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: bundler
5
+ directory: "/"
6
+ schedule:
7
+ interval: weekly
8
+ time: "10:00"
9
+ open-pull-requests-limit: 3
10
+ versioning-strategy: lockfile-only
11
+ allow:
12
+ - dependency-type: all
13
+ - package-ecosystem: npm
14
+ directory: "/"
15
+ schedule:
16
+ interval: weekly
17
+ time: "10:00"
18
+ open-pull-requests-limit: 3
19
+ versioning-strategy: lockfile-only
20
+ allow:
21
+ - dependency-type: all
@@ -1,15 +1,19 @@
1
1
  ---
2
2
  require:
3
- - standard
3
+ - rubocop-minitest
4
4
  - rubocop-rails
5
+ - rubocop-performance
6
+ - standard
5
7
 
6
8
  inherit_gem:
7
9
  standard: config/base.yml
8
10
 
9
11
  AllCops:
10
- TargetRubyVersion: 2.7
12
+ NewCops: enable
13
+ TargetRubyVersion: 3.0
11
14
 
12
15
  Exclude:
16
+ - 'bin/**/*'
13
17
  - 'db/migrate/**/*'
14
18
  - 'db/schema.rb'
15
19
  - 'vendor/**/*'
@@ -63,6 +67,13 @@ Naming/PredicateName:
63
67
  Exclude:
64
68
  - 'app/helpers/application_helper.rb'
65
69
 
70
+ Standard/SemanticBlocks:
71
+ Enabled: false
72
+
73
+ Style/BlockDelimiters:
74
+ Enabled: true
75
+ EnforcedStyle: braces_for_chaining
76
+
66
77
  Style/ClassAndModuleChildren:
67
78
  Exclude:
68
79
  - 'test/**/*.rb'
@@ -70,23 +81,15 @@ Style/ClassAndModuleChildren:
70
81
  Style/Documentation:
71
82
  Enabled: false
72
83
 
73
- Style/ExponentialNotation:
74
- Enabled: true
75
-
76
84
  Style/FrozenStringLiteralComment:
77
85
  Enabled: true
78
86
 
79
87
  Style/HashEachMethods:
80
88
  Enabled: true
81
89
 
82
- Style/HashTransformKeys:
83
- Enabled: true
84
-
85
- Style/HashTransformValues:
86
- Enabled: true
87
-
88
- Style/SlicingWithRange:
90
+ Style/StringLiterals:
89
91
  Enabled: true
92
+ EnforcedStyle: single_quotes
90
93
 
91
94
  # Rails
92
95
 
@@ -94,7 +97,7 @@ Rails:
94
97
  Enabled: true
95
98
 
96
99
  Rails/SkipsModelValidations:
97
- Blacklist: []
100
+ Enabled: false
98
101
 
99
102
  Rails/UnknownEnv:
100
103
  Environments:
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if defined?(Spring) && ENV["DISABLE_SPRING"].nil?
4
- puts "**** NO COVERAGE FOR YOU! ****"
5
- puts "Please disable Spring to get COVERAGE by `DISABLE_SPRING=1 COVERAGE=1 bin/rspec`"
3
+ if defined?(Spring) && ENV['DISABLE_SPRING'].nil?
4
+ puts '**** NO COVERAGE FOR YOU! ****'
5
+ puts 'Please disable Spring to get COVERAGE by `DISABLE_SPRING=1 COVERAGE=1 bin/rspec`'
6
6
  else
7
- SimpleCov.start "rails" do
7
+ SimpleCov.start 'rails' do
8
8
  add_filter %w[app/views bin spec test]
9
9
 
10
10
  maximum_coverage_drop 0.5
11
11
  end
12
12
 
13
- if ENV["CODECOV_TOKEN"]
14
- require "codecov"
13
+ if ENV['CODECOV_TOKEN']
14
+ require 'codecov'
15
15
  SimpleCov.formatter = SimpleCov::Formatter::Codecov
16
16
  end
17
17
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- tap "heroku/brew"
3
+ tap 'heroku/brew'
4
4
 
5
- brew "circleci"
6
- brew "graphicsmagick" # For ActiveStorage
7
- brew "heroku"
8
- brew "hub" # For creating Pull Request from CLI
9
- brew "postgresql"
10
- brew "rbenv"
11
- brew "ruby-build"
12
- brew "vips" # For ActiveStorage
13
- brew "yamllint" # For Linters
14
- brew "yarn"
5
+ brew 'circleci'
6
+ brew 'graphicsmagick' # For ActiveStorage
7
+ brew 'heroku'
8
+ brew 'hub' # For creating Pull Request from CLI
9
+ brew 'postgresql'
10
+ brew 'rbenv'
11
+ brew 'ruby-build'
12
+ brew 'vips' # For ActiveStorage
13
+ brew 'yamllint' # For Linters
14
+ brew 'yarn'
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  source 'https://rubygems.org'
4
2
 
5
3
  git_source(:github) do |repo_name|
@@ -10,19 +8,22 @@ end
10
8
  gem 'oj'
11
9
 
12
10
  group :tools do
13
- gem 'pronto'
11
+ gem 'pronto', require: false
14
12
  gem 'pronto-blacklist', require: false
15
13
  gem 'pronto-erb_lint', require: false
16
14
  gem 'pronto-eslint_npm', require: false
17
15
  gem 'pronto-fasterer', require: false
18
16
  gem 'pronto-rails_best_practices', require: false
19
17
  gem 'pronto-reek', require: false
20
- gem 'pronto-rubocop', require: false
18
+ gem 'pronto-rubocop', require: false, github: 'prontolabs/pronto-rubocop'
21
19
  # gem 'pronto-standardrb', require: false
22
20
  gem 'pronto-yamllint', require: false
23
21
 
24
- # gem 'rubocop-minitest', require: false
22
+ gem 'rubocop-performance', require: false
25
23
  gem 'rubocop-rails', require: false
26
- # gem 'rubocop-rspec', require: false
24
+ gem 'rubocop-minitest', require: false
25
+
27
26
  gem 'standard', '>= 0.4.7', require: false
27
+ # gem 'pronto-standardrb', require: false
28
+ # gem 'rubocop-rspec', require: false
28
29
  end
@@ -48,5 +48,5 @@
48
48
  "url": "heroku/ruby"
49
49
  }
50
50
  ],
51
- "stack": "heroku-18"
51
+ "stack": "heroku-20"
52
52
  }
@@ -7,6 +7,8 @@ set -eo pipefail
7
7
 
8
8
  export BUNDLE_GEMFILE=Gemfile.tools
9
9
 
10
+ [[ (-z "$(command -v bundle)") ]] && gem install --conservative bundler
11
+
10
12
  bundle check || bundle install --jobs=4 --retry=3
11
13
 
12
- yarn check || yarn install
14
+ bin/yarn check || bin/yarn install
@@ -7,6 +7,6 @@ set -eo pipefail
7
7
 
8
8
  export BUNDLE_GEMFILE=Gemfile.tools
9
9
 
10
- bundle update --jobs=4 --retry=3
10
+ bundle update --jobs=4 --retry=3 --all
11
11
 
12
- yarn check || yarn install
12
+ yarn check || yarn upgrade
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "jt_tools/version"
3
+ require 'jt_tools/version'
4
4
 
5
- require "jt_tools/railtie" if defined?(Rails)
5
+ require 'jt_tools/railtie' if defined?(Rails)
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/railtie"
3
+ require 'rails/railtie'
4
4
 
5
5
  class JtToolsRailtie < Rails::Railtie
6
6
  rake_tasks do
7
- load "tasks/install.rake"
7
+ load 'tasks/install.rake'
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JtTools
4
- VERSION = "0.0.11"
4
+ VERSION = '0.0.16'
5
5
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- install_template_path = File.expand_path("../../template.rb", __dir__).freeze
4
- bin_path = ENV["BUNDLE_BIN"] || "./bin"
3
+ install_template_path = File.expand_path('../../template.rb', __dir__).freeze
4
+ bin_path = ENV['BUNDLE_BIN'] || './bin'
5
5
 
6
6
  namespace :jt_tools do
7
- desc "Install jt-tools in this application"
7
+ desc 'Install jt-tools in this application'
8
8
  task install: :environment do
9
9
  exec "#{RbConfig.ruby} #{bin_path}/rails app:template LOCATION=#{install_template_path}"
10
10
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "devDependencies": {
3
+ "eslint": "^7.16.0"
4
+ }
5
+ }
@@ -1,17 +1,19 @@
1
- require "json"
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
2
4
 
3
5
  EXTRACT_DEPENDENCY_NAME = /"?(.+?)@.+?"?(?:,\s+|\Z)/.freeze
4
6
  EXTRACT_DEPENDENCY_DETAILS = /(^((?!= ).*?):\n.*?(?:\n\n|\Z))/m.freeze
5
7
 
6
8
  def direct_dependencies_names
7
- package_json = JSON.parse(File.open("package.json").read)
8
- direct_dependencies = package_json.fetch_values("dependencies", "devDependencies", "peerDependencies") {}
9
+ package_json = JSON.parse(File.open('package.json').read)
10
+ direct_dependencies = package_json.fetch_values('dependencies', 'devDependencies', 'peerDependencies') {}
9
11
  direct_dependencies.compact.inject([]) { |memo, v| memo.concat(v.keys) }
10
12
  end
11
13
 
12
14
  @dependencies = direct_dependencies_names
13
15
 
14
- yarn_lock_content = File.open("yarn.lock").read
16
+ yarn_lock_content = File.open('yarn.lock').read
15
17
  yarn_lock_content.scan(EXTRACT_DEPENDENCY_DETAILS).each do |dependency_block|
16
18
  direct_dep = @dependencies.include?(dependency_block[1].match(EXTRACT_DEPENDENCY_NAME).to_a[1])
17
19
  puts dependency_block[0] if direct_dep
@@ -7,17 +7,17 @@
7
7
  # In that case, use `git clone` to download them to a local temporary dir.
8
8
  def add_template_repository_to_source_path
9
9
  if __FILE__.match?(%r{\Ahttps?://})
10
- require "shellwords"
11
- require "tmpdir"
10
+ require 'shellwords'
11
+ require 'tmpdir'
12
12
 
13
- source_paths.unshift(temp_dir = Dir.mktmpdir("jt_tools-"))
13
+ source_paths.unshift(temp_dir = Dir.mktmpdir('jt_tools-'))
14
14
  at_exit { FileUtils.remove_entry(temp_dir) }
15
15
  git clone: [
16
- "--quiet",
17
- "https://github.com/jetthoughts/jt_tools.git",
16
+ '--quiet',
17
+ 'https://github.com/jetthoughts/jt_tools.git',
18
18
  temp_dir
19
19
  ].map { |args| Shellwords.escape(args) }
20
- .join(" ")
20
+ .join(' ')
21
21
 
22
22
  if (branch = __FILE__[%r{jt_tools/(.+)/template.rb}, 1])
23
23
  Dir.chdir(temp_dir) { git checkout: branch }
@@ -29,105 +29,123 @@ def add_template_repository_to_source_path
29
29
 
30
30
  add_template_repository_to_source_path
31
31
 
32
- say "=> Copying binstubs"
33
- directory "lib/install/bin", "bin"
32
+ say '=> Copying binstubs'
33
+ directory 'lib/install/bin', 'bin'
34
34
 
35
- chmod "bin", 0o755 & ~File.umask, verbose: false
35
+ chmod 'bin', 0o755 & ~File.umask, verbose: false
36
36
 
37
- say "=> Copying tools gemfile"
38
- copy_file "lib/install/Gemfile.tools", "Gemfile.tools"
37
+ say '=> Copying tools gemfile'
38
+ copy_file 'lib/install/Gemfile.tools', 'Gemfile.tools'
39
39
 
40
- run "yarn add -D eslint jest-junit"
40
+ run 'yarn add -D eslint jest-junit'
41
41
 
42
- say "Copying lint configurations"
43
- copy_file "lib/install/.better-html.yml", ".better-html.yml"
44
- copy_file "lib/install/.erb-lint.yml", ".erb-lint.yml"
45
- copy_file "lib/install/.eslintrc.js", ".eslintrc.js"
46
- copy_file "lib/install/.pronto.yml", ".pronto.yml"
47
- copy_file "lib/install/.pronto_eslint_npm.yml", ".pronto_eslint_npm.yml"
48
- copy_file "lib/install/.rubocop.yml", ".rubocop.yml"
49
- copy_file "lib/install/.yamllint.yml", ".yamllint.yml"
50
- copy_file "lib/install/.reek.yml", ".reek.yml"
51
- copy_file "lib/install/config/rails_best_practices.yml", "config/rails_best_practices.yml"
52
- copy_file "lib/install/.editorconfig", ".editorconfig"
42
+ say 'Copying lint configurations'
43
+ copy_file 'lib/install/.better-html.yml', '.better-html.yml'
44
+ copy_file 'lib/install/.erb-lint.yml', '.erb-lint.yml'
45
+ copy_file 'lib/install/.eslintrc.js', '.eslintrc.js'
46
+ copy_file 'lib/install/.pronto.yml', '.pronto.yml'
47
+ copy_file 'lib/install/.pronto_eslint_npm.yml', '.pronto_eslint_npm.yml'
48
+ copy_file 'lib/install/.rubocop.yml', '.rubocop.yml'
49
+ copy_file 'lib/install/.yamllint.yml', '.yamllint.yml'
50
+ copy_file 'lib/install/.reek.yml', '.reek.yml'
51
+ copy_file 'lib/install/config/rails_best_practices.yml', 'config/rails_best_practices.yml'
52
+ copy_file 'lib/install/.editorconfig', '.editorconfig'
53
53
 
54
- say "=> Copying services configuration"
55
- copy_file "lib/install/.simplecov", ".simplecov"
56
- copy_file "lib/install/codecov.yml", "codecov.yml"
54
+ say '=> Copying services configuration'
55
+ copy_file 'lib/install/.simplecov', '.simplecov'
56
+ copy_file 'lib/install/codecov.yml', 'codecov.yml'
57
57
 
58
- say "=> Adds service client API gems"
58
+ say '=> Adds service client API gems'
59
59
 
60
60
  gem_group :test do
61
- gem "simplecov", require: false, group: :test
62
- gem "codecov", require: false, group: :test
61
+ gem 'simplecov', require: false, group: :test
62
+ gem 'codecov', require: false, group: :test
63
+ gem 'rexml', require: false, group: :test # for hot fix of webdrivers and ruby 3
63
64
  end
64
65
 
65
- gem "oj"
66
+ gem 'oj'
66
67
 
67
68
  gem_group :production, :staging do
68
- gem "dalli"
69
- gem "r7insight"
70
- gem "rollbar"
69
+ gem 'dalli'
70
+ gem 'r7insight'
71
+ gem 'rollbar'
71
72
  end
72
73
 
73
- directory "lib/install/.circleci", ".circleci"
74
+ directory 'lib/install/.circleci', '.circleci'
74
75
 
75
- if File.read("Gemfile").include? "rspec"
76
- gem "rspec_junit_formatter", require: false, group: :test
76
+ if File.read('Gemfile').include? 'rspec'
77
+ gem 'rspec_junit_formatter', require: false, group: :test
77
78
  insert_into_file(
78
- "spec/spec_helper.rb",
79
+ 'spec/spec_helper.rb',
79
80
  "require 'simplecov' if ENV['COVERAGE']\n",
80
81
  after: /\A/
81
82
  )
82
83
  insert_into_file(
83
- ".circleci/config.yml",
84
- "\n" + " - run: bin/rspec --format RspecJunitFormatter --out tmp/reports/rspec-results.xml --format progress",
85
- after: "# rails test"
84
+ '.circleci/config.yml',
85
+ "\n" \
86
+ ' - run: bin/rspec --format RspecJunitFormatter --out tmp/reports/rspec-results.xml --format progress',
87
+ after: '# rails test'
86
88
  )
87
89
  else
88
- gem "minitest-ci", require: false, group: :test
90
+ gem 'minitest-ci', require: false, group: :test
89
91
  insert_into_file(
90
- "test/test_helper.rb",
92
+ 'test/test_helper.rb',
91
93
  "require 'simplecov' if ENV['COVERAGE']\n",
92
94
  after: /\A/
93
95
  )
94
96
  insert_into_file(
95
- ".circleci/config.yml",
97
+ '.circleci/config.yml',
96
98
  "\n" + ' - run: bin/rails test "test/**/*_test.rb"',
97
- after: "# rails test"
99
+ after: '# rails test'
98
100
  )
99
101
 
100
- gsub_file "test/test_helper.rb",
101
- "parallelize(workers: :number_of_processors)",
102
+ gsub_file 'test/test_helper.rb',
103
+ 'parallelize(workers: :number_of_processors)',
102
104
  "parallelize(workers: :number_of_processors) unless ENV['COVERAGE']"
103
105
  end
104
106
 
105
- directory "lib/install/.dependabot", ".dependabot"
107
+ say '=> Copying git configuration'
108
+ directory 'lib/install/.github', '.github'
109
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
110
+ gitattributes = <<~GITATTRIBUTES
111
+ *.gemspec diff=ruby
112
+ *.rake diff=ruby
113
+ *.rb diff=ruby
114
+ *.js diff=javascript
115
+
116
+ db/schema.rb merge=ours diff=ruby
117
+ yarn.lock merge=ours
118
+ Gemfile.lock merge=ours linguist-generated
119
+ GITATTRIBUTES
120
+ insert_into_file '.gitattributes', gitattributes
121
+ else
122
+ copy_file 'lib/install/.gitattributes', '.gitattributes'
123
+ end
106
124
 
107
- say "=> Copying heroku configuration"
108
- copy_file "lib/install/app.json", "app.json"
109
- copy_file "lib/install/Procfile", "Procfile"
125
+ say '=> Copying heroku configuration'
126
+ copy_file 'lib/install/app.json', 'app.json'
127
+ copy_file 'lib/install/Procfile', 'Procfile'
110
128
 
111
- say "=> Install Brew dependencies"
112
- copy_file "lib/install/Brewfile", "Brewfile"
129
+ say '=> Install Brew dependencies'
130
+ copy_file 'lib/install/Brewfile', 'Brewfile'
113
131
 
114
- say "Setup git hooks"
115
- directory "lib/install/bin/git-hooks", "bin/git-hooks"
132
+ say 'Setup git hooks'
133
+ directory 'lib/install/bin/git-hooks', 'bin/git-hooks'
116
134
 
117
- require "bundler"
135
+ require 'bundler'
118
136
  Bundler.with_original_env do
119
- say "=> Install tools"
120
- run "bin/tools-setup"
137
+ say '=> Install tools'
138
+ run 'bin/tools-setup'
121
139
 
122
- say "=> Generate binstubs for linters"
123
- run "BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force pronto"
124
- run "BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force rubocop"
125
- run "BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force standard"
140
+ say '=> Generate binstubs for linters'
141
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force pronto'
142
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force rubocop'
143
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force standard'
126
144
  end
127
145
 
128
- say "=> Set git hooks"
129
- run "git config core.hooksPath ./bin/git-hooks"
130
- say "=> Install all new dependencies"
146
+ say '=> Set git hooks'
147
+ run 'git config core.hooksPath ./bin/git-hooks'
148
+ say '=> Install all new dependencies'
131
149
 
132
150
  run <<~BREW_INSTALL
133
151
  hash brew 2> /dev/null \
@@ -135,29 +153,32 @@ def add_template_repository_to_source_path
135
153
  || echo "Please install Homebrew: https://brew.sh/"
136
154
  BREW_INSTALL
137
155
 
138
- say "=> Update development config"
139
- uncomment_lines "config/environments/development.rb", /config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/
156
+ say '=> Update development config'
157
+ uncomment_lines(
158
+ 'config/environments/development.rb',
159
+ /config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/
160
+ )
140
161
 
141
- say "=> Set up R7Insight"
162
+ say '=> Set up R7Insight'
142
163
  r7insight_config = <<-CODE
143
164
  if ENV['R7INSIGHT_TOKEN'].present?
144
165
  Rails.logger = R7Insight.new(ENV['R7INSIGHT_TOKEN'], ENV['R7INSIGHT_REGION'])
145
166
  end
146
167
  CODE
147
- insert_into_file "config/environments/production.rb",
168
+ insert_into_file 'config/environments/production.rb',
148
169
  "require 'r7_insight.rb'" + "\n\n",
149
- before: "Rails.application.configure do"
150
- environment(r7insight_config, env: "production")
151
- if File.exist?("config/environments/staging.rb")
152
- insert_into_file "config/environments/staging.rb",
170
+ before: 'Rails.application.configure do'
171
+ environment(r7insight_config, env: 'production')
172
+ if File.exist?('config/environments/staging.rb')
173
+ insert_into_file 'config/environments/staging.rb',
153
174
  "require 'r7_insight.rb'" + "\n\n",
154
- before: "Rails.application.configure do"
155
- environment(r7insight_config, env: "staging")
175
+ before: 'Rails.application.configure do'
176
+ environment(r7insight_config, env: 'staging')
156
177
  end
157
178
 
158
- gem "connection_pool"
179
+ gem 'connection_pool'
159
180
 
160
- say "=> Set up Memcachier"
181
+ say '=> Set up Memcachier'
161
182
  memcachier_config = <<-CODE
162
183
  if ENV["MEMCACHIER_SERVERS"]
163
184
  config.cache_store = :mem_cache_store,
@@ -169,40 +190,42 @@ def add_template_repository_to_source_path
169
190
  end
170
191
 
171
192
  CODE
172
- environment(memcachier_config, env: "production")
173
- if File.exist?("config/environments/staging.rb")
174
- environment(memcachier_config, env: "staging")
193
+ environment(memcachier_config, env: 'production')
194
+ if File.exist?('config/environments/staging.rb')
195
+ environment(memcachier_config, env: 'staging')
175
196
  end
176
197
 
177
198
  Bundler.with_original_env do
178
- say "=> Setup default bundle config"
179
- run "bundle config jobs 4"
180
- run "bundle config retry 3"
199
+ say '=> Setup default bundle config'
200
+ run 'bundle config jobs 4'
201
+ run 'bundle config retry 3'
202
+
203
+ run 'bundle'
181
204
 
182
- run "bundle"
205
+ run 'bundle lock --add-platform x86_64-linux'
183
206
  end
184
207
 
185
- uncomment_lines "bin/setup", /system\(.*?\\byarn\b/
208
+ uncomment_lines 'bin/setup', /system\(.*?\\byarn\b/
186
209
 
187
210
  insert_into_file(
188
- "bin/setup",
189
- "system!('bin/tools-setup')\n",
190
- after: "system('bundle check') || system!('bundle install')\n"
211
+ 'bin/setup',
212
+ "system! 'bin/tools-setup'\n",
213
+ after: "system! 'gem install bundler --conservative'\n"
191
214
  )
192
215
 
193
- say "**************************************************************************"
194
- say "**************************************************************************"
195
- say ""
196
- say "1. Recommended Heroku Addons: Mailtrap, Rollbar, Cloudinary"
197
- say ""
198
- say "2. Setup Git Hooks to auto-check code and cleanup staled branches:"
199
- say "$ `git config core.hooksPath bin/git-hooks`"
200
- say ""
201
- say "3. Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN"
202
- say "environment variables in CircleCI and your local env"
203
- say ""
204
- say " For code coverage report aggregator, running code static analysis"
205
- say "and auto-update of the tools."
206
- say ""
207
- say "**************************************************************************"
208
- say "**************************************************************************"
216
+ say '**************************************************************************'
217
+ say '**************************************************************************'
218
+ say ''
219
+ say '1. Recommended Heroku Addons: Mailtrap, Rollbar, Cloudinary'
220
+ say ''
221
+ say '2. Setup Git Hooks to auto-check code and cleanup staled branches:'
222
+ say '$ `git config core.hooksPath bin/git-hooks`'
223
+ say ''
224
+ say '3. Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
225
+ say 'environment variables in CircleCI and your local env'
226
+ say ''
227
+ say ' For code coverage report aggregator, running code static analysis'
228
+ say 'and auto-update of the tools.'
229
+ say ''
230
+ say '**************************************************************************'
231
+ say '**************************************************************************'