jt_tools 0.0.13 → 0.0.18

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.
@@ -48,5 +48,5 @@
48
48
  "url": "heroku/ruby"
49
49
  }
50
50
  ],
51
- "stack": "heroku-18"
51
+ "stack": "heroku-20"
52
52
  }
@@ -6,7 +6,7 @@ reporters_opt=""
6
6
 
7
7
  if [[ -n "$PRONTO_GITHUB_ACCESS_TOKEN" && "$CIRCLECI" == "true" ]]
8
8
  then
9
- git fetch origin master
9
+ git fetch origin master --depth 1
10
10
  reporters_opt="-f github_status github_pr_review"
11
11
  fi
12
12
 
@@ -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.13"
4
+ VERSION = '0.0.18'
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.17.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,112 @@ 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
- 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"
86
- )
87
83
  else
88
- gem "minitest-ci", require: false, group: :test
84
+ gem 'minitest-ci', require: false, group: :test
89
85
  insert_into_file(
90
- "test/test_helper.rb",
86
+ 'test/test_helper.rb',
91
87
  "require 'simplecov' if ENV['COVERAGE']\n",
92
88
  after: /\A/
93
89
  )
94
- insert_into_file(
95
- ".circleci/config.yml",
96
- "\n" + ' - run: bin/rails test "test/**/*_test.rb"',
97
- after: "# rails test"
98
- )
99
-
100
- gsub_file "test/test_helper.rb",
101
- "parallelize(workers: :number_of_processors)",
90
+ gsub_file 'test/test_helper.rb',
91
+ 'parallelize(workers: :number_of_processors)',
102
92
  "parallelize(workers: :number_of_processors) unless ENV['COVERAGE']"
103
93
  end
104
94
 
105
- directory "lib/install/.github", ".github"
95
+ say '=> Copying git configuration'
96
+ directory 'lib/install/.github', '.github'
97
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
98
+ gitattributes = <<~GITATTRIBUTES
99
+ *.gemspec diff=ruby
100
+ *.rake diff=ruby
101
+ *.rb diff=ruby
102
+ *.js diff=javascript
103
+
104
+ db/schema.rb merge=ours diff=ruby
105
+ yarn.lock merge=ours
106
+ Gemfile.lock merge=ours linguist-generated
107
+ GITATTRIBUTES
108
+ insert_into_file '.gitattributes', gitattributes
109
+ else
110
+ copy_file 'lib/install/.gitattributes', '.gitattributes'
111
+ end
106
112
 
107
- say "=> Copying heroku configuration"
108
- copy_file "lib/install/app.json", "app.json"
109
- copy_file "lib/install/Procfile", "Procfile"
113
+ say '=> Copying heroku configuration'
114
+ copy_file 'lib/install/app.json', 'app.json'
115
+ copy_file 'lib/install/Procfile', 'Procfile'
110
116
 
111
- say "=> Install Brew dependencies"
112
- copy_file "lib/install/Brewfile", "Brewfile"
117
+ say '=> Install Brew dependencies'
118
+ copy_file 'lib/install/Brewfile', 'Brewfile'
113
119
 
114
- say "Setup git hooks"
115
- directory "lib/install/bin/git-hooks", "bin/git-hooks"
120
+ say 'Setup git hooks'
121
+ directory 'lib/install/bin/git-hooks', 'bin/git-hooks'
116
122
 
117
- require "bundler"
123
+ require 'bundler'
118
124
  Bundler.with_original_env do
119
- say "=> Install tools"
120
- run "bin/tools-setup"
121
-
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"
125
+ say '=> Install tools'
126
+ run 'bin/tools-setup'
127
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle lock --add-platform x86_64-linux'
128
+
129
+ say '=> Generate binstubs for linters'
130
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force pronto'
131
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force rubocop'
132
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force standard'
126
133
  end
127
134
 
128
- say "=> Set git hooks"
129
- run "git config core.hooksPath ./bin/git-hooks"
130
- say "=> Install all new dependencies"
135
+ say '=> Set git hooks'
136
+ run 'git config core.hooksPath ./bin/git-hooks'
137
+ say '=> Install all new dependencies'
131
138
 
132
139
  run <<~BREW_INSTALL
133
140
  hash brew 2> /dev/null \
@@ -135,29 +142,32 @@ def add_template_repository_to_source_path
135
142
  || echo "Please install Homebrew: https://brew.sh/"
136
143
  BREW_INSTALL
137
144
 
138
- say "=> Update development config"
139
- uncomment_lines "config/environments/development.rb", /config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/
145
+ say '=> Update development config'
146
+ uncomment_lines(
147
+ 'config/environments/development.rb',
148
+ /config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/
149
+ )
140
150
 
141
- say "=> Set up R7Insight"
151
+ say '=> Set up R7Insight'
142
152
  r7insight_config = <<-CODE
143
153
  if ENV['R7INSIGHT_TOKEN'].present?
144
154
  Rails.logger = R7Insight.new(ENV['R7INSIGHT_TOKEN'], ENV['R7INSIGHT_REGION'])
145
155
  end
146
156
  CODE
147
- insert_into_file "config/environments/production.rb",
157
+ insert_into_file 'config/environments/production.rb',
148
158
  "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",
159
+ before: 'Rails.application.configure do'
160
+ environment(r7insight_config, env: 'production')
161
+ if File.exist?('config/environments/staging.rb')
162
+ insert_into_file 'config/environments/staging.rb',
153
163
  "require 'r7_insight.rb'" + "\n\n",
154
- before: "Rails.application.configure do"
155
- environment(r7insight_config, env: "staging")
164
+ before: 'Rails.application.configure do'
165
+ environment(r7insight_config, env: 'staging')
156
166
  end
157
167
 
158
- gem "connection_pool"
168
+ gem 'connection_pool'
159
169
 
160
- say "=> Set up Memcachier"
170
+ say '=> Set up Memcachier'
161
171
  memcachier_config = <<-CODE
162
172
  if ENV["MEMCACHIER_SERVERS"]
163
173
  config.cache_store = :mem_cache_store,
@@ -169,40 +179,42 @@ def add_template_repository_to_source_path
169
179
  end
170
180
 
171
181
  CODE
172
- environment(memcachier_config, env: "production")
173
- if File.exist?("config/environments/staging.rb")
174
- environment(memcachier_config, env: "staging")
182
+ environment(memcachier_config, env: 'production')
183
+ if File.exist?('config/environments/staging.rb')
184
+ environment(memcachier_config, env: 'staging')
175
185
  end
176
186
 
177
187
  Bundler.with_original_env do
178
- say "=> Setup default bundle config"
179
- run "bundle config jobs 4"
180
- run "bundle config retry 3"
188
+ say '=> Setup default bundle config'
189
+ run 'bundle config jobs 4'
190
+ run 'bundle config retry 3'
191
+
192
+ run 'bundle'
181
193
 
182
- run "bundle"
194
+ run 'bundle lock --add-platform x86_64-linux'
183
195
  end
184
196
 
185
- uncomment_lines "bin/setup", /system\(.*?\\byarn\b/
197
+ uncomment_lines 'bin/setup', /system\(.*?\\byarn\b/
186
198
 
187
199
  insert_into_file(
188
- "bin/setup",
189
- "system!('bin/tools-setup')\n",
190
- after: "system!('bin/yarn')\n"
200
+ 'bin/setup',
201
+ "system! 'bin/tools-setup'\n",
202
+ after: "system! 'gem install bundler --conservative'\n"
191
203
  )
192
204
 
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 "**************************************************************************"
205
+ say '**************************************************************************'
206
+ say '**************************************************************************'
207
+ say ''
208
+ say '1. Recommended Heroku Addons: Mailtrap, Rollbar, Cloudinary'
209
+ say ''
210
+ say '2. Setup Git Hooks to auto-check code and cleanup staled branches:'
211
+ say '$ `git config core.hooksPath bin/git-hooks`'
212
+ say ''
213
+ say '3. Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
214
+ say 'environment variables in CircleCI and your local env'
215
+ say ''
216
+ say ' For code coverage report aggregator, running code static analysis'
217
+ say 'and auto-update of the tools.'
218
+ say ''
219
+ say '**************************************************************************'
220
+ say '**************************************************************************'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jt_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Keen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2021-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bump
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Helpful scripts to run linters locally and on CI
28
42
  email:
29
43
  - pftg@users.noreply.github.com
@@ -32,19 +46,25 @@ extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
34
48
  - ".circleci/config.yml"
49
+ - ".gitattributes"
35
50
  - ".github/FUNDING.yml"
36
51
  - ".github/ISSUE_TEMPLATE/bug_report.md"
37
52
  - ".github/ISSUE_TEMPLATE/custom.md"
38
53
  - ".github/ISSUE_TEMPLATE/feature_request.md"
54
+ - ".github/workflows/test.yml"
39
55
  - ".gitignore"
56
+ - ".rubocop.yml"
40
57
  - ".standard.yml"
41
58
  - Gemfile
59
+ - Gemfile.lock
42
60
  - LICENSE
43
61
  - LICENSE.txt
44
62
  - README.md
45
63
  - Rakefile
46
64
  - _config.yml
47
- - bin/standardrb
65
+ - bin/ci-test
66
+ - bin/lint
67
+ - bin/rubocop
48
68
  - bin/test
49
69
  - jt_tools.gemspec
50
70
  - lib/install/.better-html.yml
@@ -53,7 +73,9 @@ files:
53
73
  - lib/install/.erb-lint.yml
54
74
  - lib/install/.eslintrc.js
55
75
  - lib/install/.fasterer.yml
56
- - lib/install/.github/config.yml
76
+ - lib/install/.gitattributes
77
+ - lib/install/.github/dependabot.yml
78
+ - lib/install/.github/workflows/test.yml
57
79
  - lib/install/.pronto.yml
58
80
  - lib/install/.pronto_eslint_npm.yml
59
81
  - lib/install/.reek.yml
@@ -78,9 +100,11 @@ files:
78
100
  - lib/jt_tools/railtie.rb
79
101
  - lib/jt_tools/version.rb
80
102
  - lib/tasks/install.rake
103
+ - package.json
81
104
  - rejuvenation.rb
82
105
  - shipit.rubygems.yml
83
106
  - template.rb
107
+ - yarn.lock
84
108
  homepage: https://jtway.co
85
109
  licenses:
86
110
  - MIT
@@ -103,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
127
  - !ruby/object:Gem::Version
104
128
  version: '0'
105
129
  requirements: []
106
- rubygems_version: 3.1.4
130
+ rubygems_version: 3.2.4
107
131
  signing_key:
108
132
  specification_version: 4
109
133
  summary: Setup development scripts to manage code base effectively