jt_tools 0.0.14 → 0.0.19
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 +35 -11
- data/.gitattributes +5 -1
- data/.github/workflows/test.yml +100 -0
- data/.gitignore +1 -1
- data/.rubocop.yml +9 -0
- data/.standard.yml +5 -1
- data/Gemfile +9 -3
- data/README.md +5 -1
- data/Rakefile +5 -5
- data/bin/ci-test +13 -0
- data/bin/lint +12 -0
- data/bin/rubocop +29 -0
- data/bin/test +24 -15
- data/jt_tools.gemspec +15 -14
- data/lib/install/.circleci/config.yml +59 -39
- data/lib/install/.gitattributes +4 -4
- data/lib/install/.github/{config.yml → dependabot.yml} +0 -0
- data/lib/install/.github/workflows/test.yml +147 -0
- data/lib/install/.rubocop.yml +12 -12
- data/lib/install/.simplecov +6 -6
- data/lib/install/Brewfile +11 -11
- data/lib/install/Gemfile.tools +7 -7
- data/lib/install/app.json +1 -1
- data/lib/install/bin/lint-pr +1 -1
- data/lib/install/bin/tools-setup +3 -1
- data/lib/install/bin/tools-upgrade +2 -2
- 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/package.json +5 -0
- data/rejuvenation.rb +6 -4
- data/template.rb +122 -112
- metadata +27 -5
- data/bin/standardrb +0 -29
@@ -7,14 +7,17 @@
|
|
7
7
|
version: 2.1
|
8
8
|
|
9
9
|
orbs:
|
10
|
-
|
11
|
-
node: circleci/node@4
|
10
|
+
browser-tools: circleci/browser-tools@1
|
11
|
+
node: circleci/node@4
|
12
|
+
ruby: circleci/ruby@1
|
12
13
|
|
13
14
|
workflows:
|
14
15
|
version: 2
|
15
|
-
|
16
|
+
commit:
|
16
17
|
jobs:
|
17
|
-
- test
|
18
|
+
- test:
|
19
|
+
requires:
|
20
|
+
- lint
|
18
21
|
- lint:
|
19
22
|
filters:
|
20
23
|
branches:
|
@@ -22,6 +25,15 @@ workflows:
|
|
22
25
|
- master
|
23
26
|
- production
|
24
27
|
- staging
|
28
|
+
merge:
|
29
|
+
jobs:
|
30
|
+
- test:
|
31
|
+
filters:
|
32
|
+
branches:
|
33
|
+
only:
|
34
|
+
- master
|
35
|
+
- production
|
36
|
+
- staging
|
25
37
|
|
26
38
|
auto_upgrade_tools:
|
27
39
|
triggers:
|
@@ -38,7 +50,7 @@ jobs:
|
|
38
50
|
test:
|
39
51
|
docker:
|
40
52
|
# specify the version you desire here
|
41
|
-
- image:
|
53
|
+
- image: cimg/ruby:3.0-browsers
|
42
54
|
environment:
|
43
55
|
BUNDLE_GEMFILE: Gemfile
|
44
56
|
BUNDLE_PATH: vendor/bundle
|
@@ -61,6 +73,8 @@ jobs:
|
|
61
73
|
|
62
74
|
steps:
|
63
75
|
- checkout
|
76
|
+
- browser-tools/install-chrome
|
77
|
+
- browser-tools/install-chromedriver
|
64
78
|
|
65
79
|
- restore_cache:
|
66
80
|
name: Restore Bundler Cache between Branches
|
@@ -74,10 +88,14 @@ jobs:
|
|
74
88
|
with-cache: false
|
75
89
|
path: './vendor/bundle'
|
76
90
|
|
91
|
+
- run: bundle exec bootsnap precompile --gemfile app/ lib/
|
92
|
+
- run: gem install spring
|
93
|
+
|
77
94
|
- save_cache:
|
78
95
|
name: Save Bundler Cache between Branches
|
79
96
|
paths:
|
80
|
-
-
|
97
|
+
- vendor/bundle
|
98
|
+
- tmp/cache/bootsnap-compile-cache
|
81
99
|
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
82
100
|
|
83
101
|
- node/install-packages:
|
@@ -95,54 +113,56 @@ jobs:
|
|
95
113
|
- run:
|
96
114
|
name: Precompile Assets
|
97
115
|
command: |
|
98
|
-
bin/webpack
|
99
116
|
bin/rails assets:precompile
|
100
117
|
|
101
118
|
- save_cache:
|
102
119
|
key: asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ .Environment.CIRCLE_SHA1 }}
|
103
120
|
paths:
|
104
|
-
- public/
|
105
|
-
- public/pack-test
|
121
|
+
- public/packs-test
|
106
122
|
- tmp/cache/assets
|
107
123
|
- tmp/cache/webpacker
|
108
124
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
125
|
+
# Run JS Tests
|
126
|
+
# - restore_cache:
|
127
|
+
# name: Restore Jest Cache
|
128
|
+
# keys:
|
129
|
+
# - jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
130
|
+
# - jest-cache-v1-{{ arch }}-{{ .Branch }}-
|
131
|
+
# - jest-cache-v1-
|
132
|
+
#
|
133
|
+
# - run:
|
134
|
+
# name: JavaScript Unit Tests
|
135
|
+
# command: |
|
136
|
+
# bin/yarn test --ci --no-watchman \
|
137
|
+
# --coverage --coverageDirectory coverage/jest \
|
138
|
+
# --coverageReporters text-summary --coverageReporters html \
|
139
|
+
# --reporters=jest-junit
|
140
|
+
# environment:
|
141
|
+
# JEST_JUNIT_OUTPUT_DIR: tmp/reports/jest-results
|
142
|
+
#
|
143
|
+
# - save_cache:
|
144
|
+
# name: Save Jest Cache
|
145
|
+
# key: jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
146
|
+
# paths:
|
147
|
+
# - tmp/cache/jest
|
148
|
+
|
149
|
+
- run: bin/rails db:test:prepare
|
150
|
+
- run: bin/rails test "test/**/*_test.rb"
|
151
|
+
|
152
|
+
# Collect reports
|
136
153
|
- store_test_results:
|
137
154
|
path: ./tmp/reports/
|
138
155
|
- store_artifacts:
|
139
156
|
path: ./coverage
|
157
|
+
- store_artifacts:
|
158
|
+
path: ./tmp/screenshots
|
140
159
|
lint:
|
141
160
|
docker:
|
142
|
-
- image: cimg/ruby:
|
161
|
+
- image: cimg/ruby:3.0-node
|
143
162
|
environment:
|
144
163
|
DISABLE_SPRING: 1
|
145
164
|
BUNDLE_GEMFILE: Gemfile.tools
|
165
|
+
BUNDLE_PATH: vendor/bundle-tools
|
146
166
|
BUNDLE_JOBS: 4
|
147
167
|
BUNDLE_RETRY: 3
|
148
168
|
|
@@ -162,7 +182,7 @@ jobs:
|
|
162
182
|
|
163
183
|
- run:
|
164
184
|
name: Install Bundle Dependencies
|
165
|
-
command: bin/bundle check
|
185
|
+
command: bin/bundle check || bin/bundle install
|
166
186
|
|
167
187
|
- run:
|
168
188
|
name: Install Node Packages
|
@@ -178,7 +198,7 @@ jobs:
|
|
178
198
|
|
179
199
|
upgrade_tools:
|
180
200
|
docker:
|
181
|
-
- image: cimg/ruby:
|
201
|
+
- image: cimg/ruby:3.0-node
|
182
202
|
environment:
|
183
203
|
DISABLE_SPRING: 1
|
184
204
|
BUNDLE_GEMFILE: Gemfile.tools
|
data/lib/install/.gitattributes
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
*.rb diff=ruby
|
4
4
|
*.js diff=javascript
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
db/schema.rb merge=ours diff=ruby
|
7
|
+
yarn.lock merge=ours
|
8
|
+
Gemfile.lock merge=ours
|
9
9
|
|
10
|
-
|
10
|
+
vendor/* linguist-vendored
|
File without changes
|
@@ -0,0 +1,147 @@
|
|
1
|
+
---
|
2
|
+
name: Test
|
3
|
+
|
4
|
+
# yamllint disable-line rule:truthy
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [$default-branch]
|
8
|
+
pull_request:
|
9
|
+
|
10
|
+
env:
|
11
|
+
CI: true
|
12
|
+
RAILS_ENV: test
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
lint:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
env:
|
18
|
+
BUNDLE_GEMFILE: Gemfile.tools
|
19
|
+
COVERAGE: true
|
20
|
+
DISABLE_SPRING: 1
|
21
|
+
steps:
|
22
|
+
- run: |-
|
23
|
+
sudo apt-get update -qq && \
|
24
|
+
sudo apt-get install -yq --no-install-recommends \
|
25
|
+
cmake yamllint python3-setuptools python3-pkg-resources pkg-config
|
26
|
+
|
27
|
+
- uses: actions/checkout@v2
|
28
|
+
with:
|
29
|
+
fetch-depth: 10
|
30
|
+
|
31
|
+
- name: Set up Ruby
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: 3.0
|
35
|
+
bundler-cache: true
|
36
|
+
|
37
|
+
- name: Use Node.js
|
38
|
+
uses: actions/setup-node@v1
|
39
|
+
with:
|
40
|
+
node-version: 14
|
41
|
+
|
42
|
+
- name: Get yarn cache directory path
|
43
|
+
id: yarn-cache-dir-path
|
44
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
45
|
+
|
46
|
+
- uses: actions/cache@v2
|
47
|
+
with:
|
48
|
+
path: |
|
49
|
+
**/node_modules
|
50
|
+
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
51
|
+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
52
|
+
restore-keys: |
|
53
|
+
${{ runner.os }}-modules-
|
54
|
+
|
55
|
+
- run: bin/yarn check || bin/yarn install
|
56
|
+
|
57
|
+
- run: git fetch origin master --depth 1
|
58
|
+
- run: bin/lint-pr
|
59
|
+
test:
|
60
|
+
needs: [lint]
|
61
|
+
runs-on: ubuntu-latest
|
62
|
+
env:
|
63
|
+
COVERAGE: true
|
64
|
+
DATABASE_URL: postgresql://postgres_user:postgres@localhost:5432/postgres_db
|
65
|
+
|
66
|
+
services:
|
67
|
+
postgres:
|
68
|
+
image: circleci/postgres:alpine-ram
|
69
|
+
env:
|
70
|
+
POSTGRES_DB: postgres_db
|
71
|
+
POSTGRES_USER: postgres_user
|
72
|
+
POSTGRES_PASSWORD: postgres
|
73
|
+
ports:
|
74
|
+
- 5432:5432
|
75
|
+
options: >-
|
76
|
+
--health-cmd pg_isready
|
77
|
+
--health-interval 10s
|
78
|
+
--health-timeout 5s
|
79
|
+
--health-retries 5
|
80
|
+
|
81
|
+
steps:
|
82
|
+
- name: Install PostgreSQL 11 client
|
83
|
+
run: |
|
84
|
+
sudo apt-get -yqq install libpq-dev
|
85
|
+
|
86
|
+
- uses: actions/checkout@v2
|
87
|
+
- name: Set up Ruby
|
88
|
+
uses: ruby/setup-ruby@v1
|
89
|
+
with:
|
90
|
+
ruby-version: 3.0
|
91
|
+
bundler-cache: true
|
92
|
+
|
93
|
+
- name: Setup DB
|
94
|
+
run: bundle exec rake db:test:prepare
|
95
|
+
|
96
|
+
- name: Use Node.js
|
97
|
+
uses: actions/setup-node@v1
|
98
|
+
with:
|
99
|
+
node-version: 14
|
100
|
+
|
101
|
+
- name: Get yarn cache directory path
|
102
|
+
id: yarn-cache-dir-path
|
103
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
104
|
+
|
105
|
+
- uses: actions/cache@v2
|
106
|
+
with:
|
107
|
+
path: |
|
108
|
+
**/node_modules
|
109
|
+
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
110
|
+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
111
|
+
restore-keys: |
|
112
|
+
${{ runner.os }}-modules-
|
113
|
+
|
114
|
+
- run: bin/yarn check || bin/yarn install
|
115
|
+
|
116
|
+
- uses: actions/cache@v2
|
117
|
+
with:
|
118
|
+
path: |
|
119
|
+
public/assets
|
120
|
+
public/packs-test
|
121
|
+
tmp/cache/assets
|
122
|
+
tmp/cache/webpacker
|
123
|
+
key: "${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}\
|
124
|
+
-${{ hashFiles('**/app/assets') }}-${{ hashFiles('**/app/javascript') }}"
|
125
|
+
|
126
|
+
restore-keys: |
|
127
|
+
${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/app/assets') }}
|
128
|
+
${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}
|
129
|
+
${{ runner.os }}-assets-
|
130
|
+
|
131
|
+
- name: Precompile assets
|
132
|
+
run: bundle exec rake assets:precompile
|
133
|
+
|
134
|
+
- name: Run tests
|
135
|
+
run: bin/rails test "test/**/*_test.rb"
|
136
|
+
|
137
|
+
- name: Upload Coverage
|
138
|
+
uses: actions/upload-artifact@v2
|
139
|
+
with:
|
140
|
+
name: coverage
|
141
|
+
path: coverage
|
142
|
+
|
143
|
+
- name: Upload Capybara Screenshots
|
144
|
+
uses: actions/upload-artifact@v2
|
145
|
+
with:
|
146
|
+
name: capybara-screenshots
|
147
|
+
path: tmp/screenshots
|
data/lib/install/.rubocop.yml
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
---
|
2
2
|
require:
|
3
|
-
-
|
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
|
-
|
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,10 @@ Naming/PredicateName:
|
|
63
67
|
Exclude:
|
64
68
|
- 'app/helpers/application_helper.rb'
|
65
69
|
|
70
|
+
Standard/BlockDelimiters:
|
71
|
+
Enabled: true
|
72
|
+
EnforcedStyle: braces_for_chaining
|
73
|
+
|
66
74
|
Style/ClassAndModuleChildren:
|
67
75
|
Exclude:
|
68
76
|
- 'test/**/*.rb'
|
@@ -70,23 +78,15 @@ Style/ClassAndModuleChildren:
|
|
70
78
|
Style/Documentation:
|
71
79
|
Enabled: false
|
72
80
|
|
73
|
-
Style/ExponentialNotation:
|
74
|
-
Enabled: true
|
75
|
-
|
76
81
|
Style/FrozenStringLiteralComment:
|
77
82
|
Enabled: true
|
78
83
|
|
79
84
|
Style/HashEachMethods:
|
80
85
|
Enabled: true
|
81
86
|
|
82
|
-
Style/
|
83
|
-
Enabled: true
|
84
|
-
|
85
|
-
Style/HashTransformValues:
|
86
|
-
Enabled: true
|
87
|
-
|
88
|
-
Style/SlicingWithRange:
|
87
|
+
Style/StringLiterals:
|
89
88
|
Enabled: true
|
89
|
+
EnforcedStyle: single_quotes
|
90
90
|
|
91
91
|
# Rails
|
92
92
|
|
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
|
-
if ENV[
|
14
|
-
require
|
13
|
+
if ENV['CODECOV_TOKEN']
|
14
|
+
require 'codecov'
|
15
15
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
16
16
|
end
|
17
17
|
end
|
data/lib/install/Brewfile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
tap
|
3
|
+
tap 'heroku/brew'
|
4
4
|
|
5
|
-
brew
|
6
|
-
brew
|
7
|
-
brew
|
8
|
-
brew
|
9
|
-
brew
|
10
|
-
brew
|
11
|
-
brew
|
12
|
-
brew
|
13
|
-
brew
|
14
|
-
brew
|
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'
|