jt_tools 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79f6a271c87b4eca2f49f215466e6c2973d9c205b146b4c9f80e2d1967ea15ac
4
- data.tar.gz: 53ff1177b284378248aeefc76863a190fdf9621c98c15650cef5e238414ba9d5
3
+ metadata.gz: 4927652633d2fd267f1f2406edc65c94f2dce1f5df0f5114d6a535a50a24cd43
4
+ data.tar.gz: 4cdfbc258f01edf7c8c68b6d9e8dc8afe08e83927e1100077bbec7944d99a444
5
5
  SHA512:
6
- metadata.gz: 58a52a3c2c8a4b6f2e3cbf2edde9494354196e23d76ce93f00a93b5587c7b349cf000734f6a9977dcd579820336601a2e6718b1a94ad59f4a0775e5ee9c5d88e
7
- data.tar.gz: 64d6138dff8145ed8415713fee0e42e68c833f7798c6455e41420df25a30e73e6f98197ef36c09d03b58ea5cf3977f5216ad114a367299b9c010739ee4008bcf
6
+ metadata.gz: 7ba9a726ab53e969414f0005f8ccf42fe682f127958a4a39047444830020f481015131cd3b5bbe63d99da13581fb77174ae894f92b54e8d2e932a1e3805adabb
7
+ data.tar.gz: 67679d017e44950d99ab4bc819edef9983088de1ebb3483e825dc69108fe6b6bbdb403f76f750ab9a98e0dc15c18a8d5b9689965112d943acfdeff4a4a567901
data/.circleci/config.yml CHANGED
@@ -3,7 +3,7 @@ version: 2.1
3
3
  jobs:
4
4
  test:
5
5
  docker:
6
- - image: circleci/ruby:2.6-node
6
+ - image: cimg/ruby:2.7-node
7
7
  environment:
8
8
  DATABASE_URL: postgresql://ubuntu@127.0.0.1/db_test
9
9
  BUNDLE_JOBS: 4
@@ -13,15 +13,33 @@ jobs:
13
13
  environment:
14
14
  POSTGRES_USER: ubuntu
15
15
  POSTGRES_DB: db_test
16
- parallelism: 1
16
+ parallelism: 2
17
17
  steps:
18
18
  - checkout
19
+ - restore_cache:
20
+ keys:
21
+ - rails-v2-{{ arch }}-{{ .Revision }}
22
+ - rails-v2-{{ arch }}-
23
+ - rails-v2-
24
+
19
25
  - run: gem install rails -N --update-sources
20
- - run: sudo apt-get install cmake curl yamllint python3-setuptools python3-pkg-resources
21
- - run: curl -fLSs https://circle.ci/cli | sudo bash
26
+
27
+ - run: sudo apt-get update -qq && sudo apt-get install -yq --no-install-recommends
28
+ cmake curl yamllint python3-setuptools python3-pkg-resources pkg-config
29
+ - run: curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh |
30
+ sudo bash
22
31
  - run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
23
- - run: bin/test
24
- - run: TEST_APP_TEMPLATE=true bin/test
32
+
33
+ - run: |
34
+ [[ $CIRCLE_NODE_INDEX == "0" ]] || bin/test
35
+ - run: |
36
+ [[ $CIRCLE_NODE_INDEX == "1" ]] || TEST_APP_TEMPLATE=true bin/test
37
+
38
+ - save_cache:
39
+ key: rails-v2-{{ arch }}-{{ .Revision }}
40
+ paths:
41
+ - /home/circleci/.rubygems
42
+ - /home/circleci/.cache
25
43
 
26
44
  workflows:
27
45
  test:
data/bin/test CHANGED
@@ -18,7 +18,7 @@ gem uninstall oj || true
18
18
 
19
19
  if [[ "TEST_APP_TEMPLATE" == "true" ]]
20
20
  then
21
- rails new test_tmpl --quiet
21
+ rails new test_tmpl --quiet --database postgresql
22
22
  cd test_tmpl
23
23
  rails app:template LOCATION=../template.rb
24
24
  else
@@ -55,8 +55,8 @@ BUNDLE_GEMFILE=Gemfile.tools bin/bundle exec erblint --config ../../lib/install/
55
55
  CIRCLECI=false bin/lint-pr -f text
56
56
 
57
57
  echo " => Run git hooks verifications"
58
- bin/git-hooks/post-merge.sample
59
- CIRCLECI=false bin/git-hooks/pre-push.sample
58
+ bin/git-hooks/post-merge
59
+ CIRCLECI=false bin/git-hooks/pre-push
60
60
 
61
61
  bin/rubocop --config ../../lib/install/.rubocop.yml --debug --extra-details --display-style-guide --parallel ../../lib
62
62
  node_modules/.bin/eslint --config ../../lib/install/.eslintrc.js --quiet --no-color ../../lib/**/.*.js
@@ -64,6 +64,8 @@ jobs:
64
64
  - ruby/install-deps:
65
65
  bundler-version: '`cat Gemfile.lock | tail -1 | tr -d " "`'
66
66
  key: v1-dependencies
67
+ - node/install:
68
+ node-version: latest
67
69
  - node/install-packages:
68
70
  app-dir: .
69
71
  pkg-manager: yarn
@@ -114,11 +116,8 @@ jobs:
114
116
  paths:
115
117
  - tmp/cache/jest
116
118
 
117
- - run:
118
- name: RSpec Tests
119
- command: |
120
- bin/rails db:schema:load
121
- bin/rspec --format RspecJunitFormatter --out tmp/reports/rspec-results.xml --format progress
119
+ - run: bin/rails db:schema:load
120
+ # rails test
122
121
 
123
122
  # collect reports
124
123
  - store_test_results:
@@ -127,7 +126,7 @@ jobs:
127
126
  path: ./coverage
128
127
  lint:
129
128
  docker:
130
- - image: circleci/ruby:2.7-stretch-node
129
+ - image: cimg/ruby:2.7-node
131
130
  environment:
132
131
  DISABLE_SPRING: 1
133
132
  BUNDLE_GEMFILE: Gemfile.tools
@@ -144,7 +143,9 @@ jobs:
144
143
 
145
144
  - run:
146
145
  name: Install cmake for building pronto dependencies
147
- command: sudo apt-get update && sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources
146
+ command: sudo apt-get update -qq &&
147
+ sudo apt-get install -yq --no-install-recommends
148
+ cmake yamllint python3-setuptools python3-pkg-resources pkg-config
148
149
 
149
150
  - run:
150
151
  name: Install Bundle Dependencies
@@ -164,7 +165,7 @@ jobs:
164
165
 
165
166
  upgrade_tools:
166
167
  docker:
167
- - image: circleci/ruby:2.7-stretch-node
168
+ - image: cimg/ruby:2.7-node
168
169
  environment:
169
170
  DISABLE_SPRING: 1
170
171
  BUNDLE_GEMFILE: Gemfile.tools
@@ -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
@@ -4,7 +4,7 @@ require:
4
4
  - rubocop-rails
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 2.7
8
8
  Exclude:
9
9
  - 'db/migrate/**/*'
10
10
  - 'db/schema.rb'
@@ -48,6 +48,9 @@ Layout/SpaceAroundMethodCallOperator:
48
48
  Layout/SpaceInLambdaLiteral:
49
49
  EnforcedStyle: require_space
50
50
 
51
+ Lint/DeprecatedOpenSSLConstant:
52
+ Enabled: true
53
+
51
54
  Lint/RaiseException:
52
55
  Enabled: true
53
56
 
@@ -10,8 +10,8 @@ else
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
data/lib/install/Brewfile CHANGED
@@ -5,12 +5,13 @@ cask_args appdir: '/Applications'
5
5
 
6
6
  tap 'heroku/brew'
7
7
 
8
- # brew 'circleci'
9
- brew 'graphicsmagick'
8
+ brew 'circleci'
9
+ brew 'graphicsmagick' # For ActiveStorage
10
10
  brew 'heroku'
11
- brew 'hub'
11
+ brew 'hub' # For creating Pull Request from CLI
12
+ brew 'postgresql'
12
13
  brew 'rbenv'
13
14
  brew 'ruby-build'
14
- brew 'vips'
15
- brew 'yamllint'
15
+ brew 'vips' # For ActiveStorage
16
+ brew 'yamllint' # For Linters
16
17
  brew 'yarn'
@@ -22,5 +22,4 @@ group :tools do
22
22
 
23
23
  gem 'rubocop-performance', require: false
24
24
  gem 'rubocop-rails', require: false
25
- gem 'better_html', '< 1.0.15'
26
25
  end
data/lib/install/app.json CHANGED
@@ -4,18 +4,6 @@
4
4
  "postdeploy": "bin/heroku-postdeploy"
5
5
  },
6
6
  "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
7
  "BUNDLE_WITHOUT": "development:test:production",
20
8
  "DISABLE_DATABASE_ENVIRONMENT_CHECK": "1",
21
9
  "LANG": "en_US.UTF-8",
@@ -24,10 +12,22 @@
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,9 @@
38
38
  "redistogo:nano"
39
39
  ],
40
40
  "buildpacks": [
41
+ {
42
+ "url": "heroku/nodejs"
43
+ },
41
44
  {
42
45
  "url": "heroku/ruby"
43
46
  }
@@ -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..."
@@ -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
@@ -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
3
  module JtTools
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
data/template.rb CHANGED
@@ -37,7 +37,7 @@ chmod 'bin', 0o755 & ~File.umask, verbose: false
37
37
  say '=> Copying tools gemfile'
38
38
  copy_file 'lib/install/Gemfile.tools', 'Gemfile.tools'
39
39
 
40
- run 'yarn add -D eslint'
40
+ run 'yarn add -D eslint jest-junit'
41
41
 
42
42
  say 'Copying lint configurations'
43
43
  copy_file 'lib/install/.better-html.yml', '.better-html.yml'
@@ -80,6 +80,11 @@ if File.read('Gemfile').include? 'rspec'
80
80
  "require 'simplecov' if ENV['COVERAGE']\n",
81
81
  after: /\A/
82
82
  )
83
+ insert_into_file(
84
+ '.circleci/config.yml',
85
+ "\n" + ' - run: bin/rspec --format RspecJunitFormatter --out tmp/reports/rspec-results.xml --format progress',
86
+ after: '# rails test'
87
+ )
83
88
  else
84
89
  gem 'minitest-ci', require: false, group: :test
85
90
  insert_into_file(
@@ -87,6 +92,11 @@ else
87
92
  "require 'simplecov' if ENV['COVERAGE']\n",
88
93
  after: /\A/
89
94
  )
95
+ insert_into_file(
96
+ '.circleci/config.yml',
97
+ "\n" + ' - run: bin/rails test "test/**/*_test.rb"',
98
+ after: '# rails test'
99
+ )
90
100
  end
91
101
 
92
102
  directory 'lib/install/.dependabot', '.dependabot'
@@ -141,6 +151,8 @@ if File.exist?('config/environments/staging.rb')
141
151
  environment(r7insight_config, env: 'staging')
142
152
  end
143
153
 
154
+ gem 'connection_pool'
155
+
144
156
  say '=> Set up Memcachier'
145
157
  memcachier_config = <<-CODE
146
158
  if ENV["MEMCACHIER_SERVERS"]
@@ -154,7 +166,9 @@ memcachier_config = <<-CODE
154
166
 
155
167
  CODE
156
168
  environment(memcachier_config, env: 'production')
157
- environment(memcachier_config, env: 'staging') if File.exist?('config/environments/staging.rb')
169
+ if File.exist?('config/environments/staging.rb')
170
+ environment(memcachier_config, env: 'staging')
171
+ end
158
172
 
159
173
 
160
174
  after_bundle do
@@ -168,9 +182,8 @@ say '**************************************************************************'
168
182
  say ''
169
183
  say '1. Recommended Heroku Addons: Mailtrap, Rollbar, Cloudinary'
170
184
  say ''
171
- say '2. Setup Git Hooks to auto-check code and cleanup staled branches'
172
- say '$ `cp bin/git-hooks/pre-push.sample bin/git-hooks/pre-push`'
173
- say '$ `cp bin/git-hooks/post-merge.sample bin/git-hooks/post-merge`'
185
+ say '2. Setup Git Hooks to auto-check code and cleanup staled branches:'
186
+ say '$ `git config core.hooksPath bin/git-hooks`'
174
187
  say ''
175
188
  say '3. Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
176
189
  say 'environment variables in CircleCI and your local env'
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.5
4
+ version: 0.0.6
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-05-21 00:00:00.000000000 Z
11
+ date: 2020-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -62,8 +62,8 @@ files:
62
62
  - lib/install/Procfile
63
63
  - lib/install/app.json
64
64
  - lib/install/bin/circleci-auto_upgrade_tools
65
- - lib/install/bin/git-hooks/post-merge.sample
66
- - lib/install/bin/git-hooks/pre-push.sample
65
+ - lib/install/bin/git-hooks/post-merge
66
+ - lib/install/bin/git-hooks/pre-push
67
67
  - lib/install/bin/heroku-postdeploy
68
68
  - lib/install/bin/heroku-release
69
69
  - lib/install/bin/lint-pr