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.
@@ -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
@@ -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
- DuplicateMethodCall:
11
- max_calls: 4
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
@@ -1,28 +1,29 @@
1
1
  ---
2
2
  require:
3
- - rubocop-performance
3
+ - standard
4
4
  - rubocop-rails
5
5
 
6
+ inherit_gem:
7
+ standard: config/base.yml
8
+
6
9
  AllCops:
7
- TargetRubyVersion: 2.6
10
+ TargetRubyVersion: 2.7
11
+
8
12
  Exclude:
9
13
  - 'db/migrate/**/*'
10
14
  - 'db/schema.rb'
15
+ - 'vendor/**/*'
11
16
 
12
- Layout/EmptyLinesAroundAttributeAccessor:
17
+ Bundler/InsecureProtocolSource:
13
18
  Enabled: true
19
+ Include:
20
+ - '**/*.gemfile'
21
+ - '**/Gemfile'
22
+ - '**/Gemfile.tools'
23
+ - '**/gems.rb'
14
24
 
15
- Layout/EmptyLinesAroundBlockBody:
16
- Exclude:
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:
@@ -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'
15
- # SimpleCov.formatter = SimpleCov::Formatter::Codecov
16
- # end
13
+ if ENV["CODECOV_TOKEN"]
14
+ require "codecov"
15
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
16
+ end
17
17
  end
@@ -1,16 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- tap 'caskroom/cask'
4
- cask_args appdir: '/Applications'
3
+ tap "heroku/brew"
5
4
 
6
- tap 'heroku/brew'
7
-
8
- # brew 'circleci'
9
- brew 'graphicsmagick'
10
- brew 'heroku'
11
- brew 'hub'
12
- brew 'rbenv'
13
- brew 'ruby-build'
14
- brew 'vips'
15
- brew 'yamllint'
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"
@@ -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-performance', require: false
24
+ # gem 'rubocop-minitest', require: false
24
25
  gem 'rubocop-rails', require: false
25
- gem 'better_html', '< 1.0.15'
26
+ # gem 'rubocop-rspec', require: false
27
+ gem 'standard', '>= 0.4.7', require: false
26
28
  end
@@ -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=`date +"%Y%m%d%H%M"`
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":"Upgrade tools dependencies","base":"master","head":"'$CIRCLE_PROJECT_USERNAME':'$new_branch_name'"}' \
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
@@ -12,7 +12,11 @@ if [[ $reflog_message =~ "merge" ]]; then
12
12
  fi
13
13
 
14
14
  if [[ $branch_name == "master" ]]; then
15
- bin/update
15
+ bin/spring stop; pkill "spring";
16
+ rm -rf tmp/cache
17
+
18
+ bin/setup
19
+
16
20
  bin/rake db:reset
17
21
 
18
22
  echo "Removing merged branches..."
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -eo pipefail
4
4
 
5
- bin/lint-pr
5
+ bin/lint-pr --no-staged
6
6
 
7
7
  # bin/rspec --tag critical
8
8
  # bin/rails test
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  echo "== Preparing database =="
4
- bin/rails db:prepare db:seed
4
+ bin/rails db:prepare
@@ -4,7 +4,7 @@ set -eo pipefail
4
4
 
5
5
  reporters_opt=""
6
6
 
7
- if [[ "$CIRCLECI" == "true" ]]
7
+ if [[ -n "$PRONTO_GITHUB_ACCESS_TOKEN" && "$CIRCLECI" == "true" ]]
8
8
  then
9
9
  git fetch origin master
10
10
  reporters_opt="-f github_status github_pr_review"
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- set -e
3
+ set -eo pipefail
4
+
5
+ ([[ (-x "$(command -v brew)") ]] && brew bundle check || brew bundle --no-lock) \
6
+ || (echo "*** Please install manually system dependencies: ***" && cat Brewfile)
4
7
 
5
8
  export BUNDLE_GEMFILE=Gemfile.tools
6
9
 
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- set -e
3
+ set -eo pipefail
4
+
5
+ ([[ (-x "$(command -v brew)") ]] && brew bundle check || brew bundle --no-lock) \
6
+ || (echo "*** Please upgrade manually system dependencies: ***" && cat Brewfile)
4
7
 
5
8
  export BUNDLE_GEMFILE=Gemfile.tools
6
9
 
@@ -11,11 +11,11 @@ KeepFindersOnTheirOwnModelCheck: {}
11
11
  LawOfDemeterCheck: {}
12
12
  # LongLineCheck: { max_line_length: 80 }
13
13
  MoveCodeIntoControllerCheck: {}
14
- MoveCodeIntoHelperCheck: { array_count: 3 }
15
- MoveCodeIntoModelCheck: { use_count: 2 }
14
+ MoveCodeIntoHelperCheck: { array_count: 10 }
15
+ MoveCodeIntoModelCheck: { use_count: 10 }
16
16
  MoveFinderToNamedScopeCheck: {}
17
- MoveModelLogicIntoModelCheck: { use_count: 4 }
18
- NeedlessDeepNestingCheck: { nested_count: 2 }
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: 2 }
30
+ ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 5 }
31
31
  ReplaceInstanceVariableWithLocalVariableCheck: {}
32
32
  RestrictAutoGeneratedRoutesCheck: {}
33
33
  SimplifyRenderInControllersCheck: {}
@@ -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.5'
4
+ VERSION = "0.0.10"
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
@@ -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('package.json').read)
9
- direct_dependencies = package_json.fetch_values('dependencies', 'devDependencies', 'peerDependencies') { }
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('yarn.lock').read
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