jt_tools 0.0.5 → 0.0.10
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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +24 -6
- data/.gitignore +1 -0
- data/.standard.yml +10 -0
- data/Gemfile +4 -1
- data/README.md +1 -0
- data/Rakefile +5 -5
- data/bin/standardrb +29 -0
- data/bin/test +20 -13
- data/jt_tools.gemspec +14 -14
- data/lib/install/.circleci/config.yml +31 -15
- data/lib/install/.editorconfig +1 -232
- data/lib/install/.erb-lint.yml +6 -6
- data/lib/install/.reek.yml +8 -13
- data/lib/install/.rubocop.yml +15 -45
- data/lib/install/.simplecov +8 -8
- data/lib/install/Brewfile +11 -13
- data/lib/install/Gemfile.tools +4 -2
- data/lib/install/app.json +19 -13
- data/lib/install/bin/circleci-auto_upgrade_tools +3 -3
- data/lib/install/bin/git-hooks/{post-merge.sample → post-merge} +5 -1
- data/lib/install/bin/git-hooks/{pre-push.sample → pre-push} +1 -1
- data/lib/install/bin/heroku-postdeploy +1 -1
- data/lib/install/bin/lint-pr +1 -1
- data/lib/install/bin/tools-setup +4 -1
- data/lib/install/bin/tools-upgrade +4 -1
- data/lib/install/config/rails_best_practices.yml +5 -5
- data/lib/jt_tools.rb +2 -2
- data/lib/jt_tools/railtie.rb +2 -2
- data/lib/jt_tools/version.rb +1 -1
- data/lib/tasks/install.rake +3 -3
- data/rejuvenation.rb +4 -5
- data/shipit.rubygems.yml +1 -0
- data/template.rb +120 -94
- metadata +11 -8
data/lib/install/.erb-lint.yml
CHANGED
@@ -10,17 +10,17 @@ linters:
|
|
10
10
|
- .rubocop.yml
|
11
11
|
Layout/InitialIndentation:
|
12
12
|
Enabled: false
|
13
|
+
Layout/LineLength:
|
14
|
+
Enabled: false
|
13
15
|
Layout/TrailingEmptyLines:
|
14
16
|
Enabled: false
|
15
17
|
Layout/TrailingWhitespace:
|
16
18
|
Enabled: false
|
17
|
-
Naming/FileName:
|
18
|
-
Enabled: false
|
19
|
-
Style/FrozenStringLiteralComment:
|
20
|
-
Enabled: false
|
21
|
-
Layout/LineLength:
|
22
|
-
Enabled: false
|
23
19
|
Lint/UselessAssignment:
|
24
20
|
Enabled: false
|
21
|
+
Naming/FileName:
|
22
|
+
Enabled: false
|
25
23
|
Rails/OutputSafety:
|
26
24
|
Enabled: false
|
25
|
+
Style/FrozenStringLiteralComment:
|
26
|
+
Enabled: false
|
data/lib/install/.reek.yml
CHANGED
@@ -2,26 +2,21 @@
|
|
2
2
|
detectors:
|
3
3
|
IrresponsibleModule:
|
4
4
|
enabled: false
|
5
|
+
DuplicateMethodCall:
|
6
|
+
max_calls: 4
|
7
|
+
FeatureEnvy:
|
8
|
+
enabled: false
|
5
9
|
UncommunicativeVariableName:
|
6
10
|
accept:
|
7
11
|
- e
|
12
|
+
- i
|
13
|
+
- v
|
8
14
|
UnusedPrivateMethod:
|
9
15
|
enabled: false
|
10
|
-
|
11
|
-
|
16
|
+
UtilityFunction:
|
17
|
+
enabled: false
|
12
18
|
|
13
19
|
directories:
|
14
20
|
"**/app/controllers/**":
|
15
21
|
InstanceVariableAssumption:
|
16
22
|
enabled: false
|
17
|
-
UtilityFunction:
|
18
|
-
enabled: false
|
19
|
-
"**/app/jobs/**":
|
20
|
-
UtilityFunction:
|
21
|
-
enabled: false
|
22
|
-
"**/app/helpers/**":
|
23
|
-
UtilityFunction:
|
24
|
-
enabled: false
|
25
|
-
"**/spec/**":
|
26
|
-
UtilityFunction:
|
27
|
-
enabled: false
|
data/lib/install/.rubocop.yml
CHANGED
@@ -1,28 +1,29 @@
|
|
1
1
|
---
|
2
2
|
require:
|
3
|
-
-
|
3
|
+
- standard
|
4
4
|
- rubocop-rails
|
5
5
|
|
6
|
+
inherit_gem:
|
7
|
+
standard: config/base.yml
|
8
|
+
|
6
9
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.
|
10
|
+
TargetRubyVersion: 2.7
|
11
|
+
|
8
12
|
Exclude:
|
9
13
|
- 'db/migrate/**/*'
|
10
14
|
- 'db/schema.rb'
|
15
|
+
- 'vendor/**/*'
|
11
16
|
|
12
|
-
|
17
|
+
Bundler/InsecureProtocolSource:
|
13
18
|
Enabled: true
|
19
|
+
Include:
|
20
|
+
- '**/*.gemfile'
|
21
|
+
- '**/Gemfile'
|
22
|
+
- '**/Gemfile.tools'
|
23
|
+
- '**/gems.rb'
|
14
24
|
|
15
|
-
Layout/
|
16
|
-
|
17
|
-
- 'db/schema.rb'
|
18
|
-
|
19
|
-
Layout/FirstHashElementIndentation:
|
20
|
-
EnforcedStyle: consistent
|
21
|
-
|
22
|
-
Layout/HashAlignment:
|
23
|
-
EnforcedHashRocketStyle: table
|
24
|
-
EnforcedColonStyle: table
|
25
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
25
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
26
|
+
Enabled: true
|
26
27
|
|
27
28
|
Layout/LineLength:
|
28
29
|
Max: 113
|
@@ -30,27 +31,9 @@ Layout/LineLength:
|
|
30
31
|
Layout/MultilineMethodArgumentLineBreaks:
|
31
32
|
Enabled: true
|
32
33
|
|
33
|
-
Layout/MultilineMethodCallBraceLayout:
|
34
|
-
EnforcedStyle: symmetrical
|
35
|
-
|
36
|
-
Layout/MultilineMethodCallIndentation:
|
37
|
-
EnforcedStyle: indented
|
38
|
-
|
39
|
-
Layout/MultilineOperationIndentation:
|
40
|
-
EnforcedStyle: indented
|
41
|
-
|
42
|
-
Layout/ParameterAlignment:
|
43
|
-
EnforcedStyle: with_fixed_indentation
|
44
|
-
|
45
|
-
Layout/SpaceAroundMethodCallOperator:
|
46
|
-
Enabled: true
|
47
|
-
|
48
34
|
Layout/SpaceInLambdaLiteral:
|
49
35
|
EnforcedStyle: require_space
|
50
36
|
|
51
|
-
Lint/RaiseException:
|
52
|
-
Enabled: true
|
53
|
-
|
54
37
|
Lint/StructNewOverride:
|
55
38
|
Enabled: true
|
56
39
|
|
@@ -102,22 +85,9 @@ Style/HashTransformKeys:
|
|
102
85
|
Style/HashTransformValues:
|
103
86
|
Enabled: true
|
104
87
|
|
105
|
-
Style/SafeNavigation:
|
106
|
-
Enabled: false
|
107
|
-
|
108
88
|
Style/SlicingWithRange:
|
109
89
|
Enabled: true
|
110
90
|
|
111
|
-
Style/StabbyLambdaParentheses:
|
112
|
-
EnforcedStyle: require_no_parentheses
|
113
|
-
|
114
|
-
Style/StringLiterals:
|
115
|
-
Exclude:
|
116
|
-
- 'db/schema.rb'
|
117
|
-
|
118
|
-
Style/TrailingCommaInHashLiteral:
|
119
|
-
EnforcedStyleForMultiline: consistent_comma
|
120
|
-
|
121
91
|
# Rails
|
122
92
|
|
123
93
|
Rails:
|
data/lib/install/.simplecov
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
if defined?(Spring) && ENV[
|
4
|
-
puts
|
5
|
-
puts
|
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
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
if ENV["CODECOV_TOKEN"]
|
14
|
+
require "codecov"
|
15
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
16
|
+
end
|
17
17
|
end
|
data/lib/install/Brewfile
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
tap
|
4
|
-
cask_args appdir: '/Applications'
|
3
|
+
tap "heroku/brew"
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
brew
|
10
|
-
brew
|
11
|
-
brew
|
12
|
-
brew
|
13
|
-
brew
|
14
|
-
brew
|
15
|
-
brew
|
16
|
-
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"
|
data/lib/install/Gemfile.tools
CHANGED
@@ -18,9 +18,11 @@ group :tools do
|
|
18
18
|
gem 'pronto-rails_best_practices', require: false
|
19
19
|
gem 'pronto-reek', require: false
|
20
20
|
gem 'pronto-rubocop', require: false
|
21
|
+
# gem 'pronto-standardrb', require: false
|
21
22
|
gem 'pronto-yamllint', require: false
|
22
23
|
|
23
|
-
gem 'rubocop-
|
24
|
+
# gem 'rubocop-minitest', require: false
|
24
25
|
gem 'rubocop-rails', require: false
|
25
|
-
gem '
|
26
|
+
# gem 'rubocop-rspec', require: false
|
27
|
+
gem 'standard', '>= 0.4.7', require: false
|
26
28
|
end
|
data/lib/install/app.json
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
{
|
2
|
-
"name": "APP NAME",
|
3
2
|
"scripts": {
|
4
3
|
"postdeploy": "bin/heroku-postdeploy"
|
5
4
|
},
|
6
5
|
"env": {
|
7
|
-
"RAILS_MASTER_KEY": {
|
8
|
-
"required": true
|
9
|
-
},
|
10
|
-
"ROLLBAR_ACCESS_TOKEN": {
|
11
|
-
"required": true
|
12
|
-
},
|
13
|
-
"ROLLBAR_ENDPOINT": {
|
14
|
-
"required": true
|
15
|
-
},
|
16
|
-
"SECRET_KEY_BASE": {
|
17
|
-
"generator": "secret"
|
18
|
-
},
|
19
6
|
"BUNDLE_WITHOUT": "development:test:production",
|
20
7
|
"DISABLE_DATABASE_ENVIRONMENT_CHECK": "1",
|
8
|
+
"JEMALLOC_ENABLED": "true",
|
21
9
|
"LANG": "en_US.UTF-8",
|
22
10
|
"MALLOC_ARENA_MAX": "2",
|
23
11
|
"NODE_ENV": "production",
|
24
12
|
"RACK_ENV": "staging",
|
25
13
|
"RAILS_ENV": "staging",
|
26
14
|
"RAILS_LOG_TO_STDOUT": "enabled",
|
15
|
+
"RAILS_MASTER_KEY": {
|
16
|
+
"required": true
|
17
|
+
},
|
27
18
|
"RAILS_MAX_THREADS": "5",
|
28
19
|
"RAILS_SERVE_STATIC_FILES": "enabled",
|
29
20
|
"REDIS_PROVIDER": "REDISTOGO_URL",
|
21
|
+
"ROLLBAR_ACCESS_TOKEN": {
|
22
|
+
"required": true
|
23
|
+
},
|
24
|
+
"ROLLBAR_ENDPOINT": {
|
25
|
+
"required": true
|
26
|
+
},
|
30
27
|
"ROLLBAR_ENV": "staging",
|
28
|
+
"SECRET_KEY_BASE": {
|
29
|
+
"generator": "secret"
|
30
|
+
},
|
31
31
|
"SIDEKIQ_CONCURRENCY": "5",
|
32
32
|
"WEB_CONCURRENCY": "2"
|
33
33
|
},
|
@@ -38,6 +38,12 @@
|
|
38
38
|
"redistogo:nano"
|
39
39
|
],
|
40
40
|
"buildpacks": [
|
41
|
+
{
|
42
|
+
"url": "https://github.com/gaffneyc/heroku-buildpack-jemalloc.git"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"url": "heroku/nodejs"
|
46
|
+
},
|
41
47
|
{
|
42
48
|
"url": "heroku/ruby"
|
43
49
|
}
|
@@ -4,7 +4,7 @@ set -e
|
|
4
4
|
|
5
5
|
echo "-----Create and switch to new branch-----"
|
6
6
|
|
7
|
-
current_date
|
7
|
+
current_date=$(date +"%Y%m%d%H%M")
|
8
8
|
new_branch_name="auto-upgrade-tools-dependencies-${current_date}"
|
9
9
|
git checkout -b $new_branch_name
|
10
10
|
|
@@ -17,11 +17,11 @@ if bin/tools-upgrade; then
|
|
17
17
|
git config user.email "circleci.bot@example.com"
|
18
18
|
|
19
19
|
git commit -am "Upgrades Gemfile.tools dependencies"
|
20
|
-
git push https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git -f
|
20
|
+
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" -f
|
21
21
|
|
22
22
|
curl -X POST \
|
23
23
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
24
|
-
-d '{"title":"
|
24
|
+
-d '{"title":"Upgrades tools dependencies","base":"master","head":"'$CIRCLE_PROJECT_USERNAME':'$new_branch_name'"}' \
|
25
25
|
https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls
|
26
26
|
exit 0
|
27
27
|
else
|
data/lib/install/bin/lint-pr
CHANGED
data/lib/install/bin/tools-setup
CHANGED
@@ -11,11 +11,11 @@ KeepFindersOnTheirOwnModelCheck: {}
|
|
11
11
|
LawOfDemeterCheck: {}
|
12
12
|
# LongLineCheck: { max_line_length: 80 }
|
13
13
|
MoveCodeIntoControllerCheck: {}
|
14
|
-
MoveCodeIntoHelperCheck: { array_count:
|
15
|
-
MoveCodeIntoModelCheck: { use_count:
|
14
|
+
MoveCodeIntoHelperCheck: { array_count: 10 }
|
15
|
+
MoveCodeIntoModelCheck: { use_count: 10 }
|
16
16
|
MoveFinderToNamedScopeCheck: {}
|
17
|
-
MoveModelLogicIntoModelCheck: { use_count:
|
18
|
-
NeedlessDeepNestingCheck: { nested_count:
|
17
|
+
MoveModelLogicIntoModelCheck: { use_count: 10 }
|
18
|
+
NeedlessDeepNestingCheck: { nested_count: 5 }
|
19
19
|
NotRescueExceptionCheck: {}
|
20
20
|
NotUseDefaultRouteCheck: {}
|
21
21
|
NotUseTimeAgoInWordsCheck: {}
|
@@ -27,7 +27,7 @@ RemoveTrailingWhitespaceCheck: {}
|
|
27
27
|
# RemoveUnusedMethodsInControllersCheck: { except_methods: [] }
|
28
28
|
# RemoveUnusedMethodsInHelpersCheck: { except_methods: [] }
|
29
29
|
# RemoveUnusedMethodsInModelsCheck: { except_methods: [] }
|
30
|
-
ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count:
|
30
|
+
ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 5 }
|
31
31
|
ReplaceInstanceVariableWithLocalVariableCheck: {}
|
32
32
|
RestrictAutoGeneratedRoutesCheck: {}
|
33
33
|
SimplifyRenderInControllersCheck: {}
|
data/lib/jt_tools.rb
CHANGED
data/lib/jt_tools/railtie.rb
CHANGED
data/lib/jt_tools/version.rb
CHANGED
data/lib/tasks/install.rake
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
install_template_path = File.expand_path(
|
4
|
-
bin_path = ENV[
|
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
|
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
|
data/rejuvenation.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
-
|
2
|
-
require 'json'
|
1
|
+
require "json"
|
3
2
|
|
4
3
|
EXTRACT_DEPENDENCY_NAME = /"?(.+?)@.+?"?(?:,\s+|\Z)/.freeze
|
5
4
|
EXTRACT_DEPENDENCY_DETAILS = /(^((?!= ).*?):\n.*?(?:\n\n|\Z))/m.freeze
|
6
5
|
|
7
6
|
def direct_dependencies_names
|
8
|
-
package_json = JSON.parse(File.open(
|
9
|
-
direct_dependencies = package_json.fetch_values(
|
7
|
+
package_json = JSON.parse(File.open("package.json").read)
|
8
|
+
direct_dependencies = package_json.fetch_values("dependencies", "devDependencies", "peerDependencies") {}
|
10
9
|
direct_dependencies.compact.inject([]) { |memo, v| memo.concat(v.keys) }
|
11
10
|
end
|
12
11
|
|
13
12
|
@dependencies = direct_dependencies_names
|
14
13
|
|
15
|
-
yarn_lock_content = File.open(
|
14
|
+
yarn_lock_content = File.open("yarn.lock").read
|
16
15
|
yarn_lock_content.scan(EXTRACT_DEPENDENCY_DETAILS).each do |dependency_block|
|
17
16
|
direct_dep = @dependencies.include?(dependency_block[1].match(EXTRACT_DEPENDENCY_NAME).to_a[1])
|
18
17
|
puts dependency_block[0] if direct_dep
|