jt_tools 0.0.11 → 0.0.16
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 +11 -0
- 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 +2 -1
- data/Rakefile +5 -5
- data/bin/ci-test +13 -0
- data/bin/lint +12 -0
- data/bin/rubocop +29 -0
- data/bin/test +23 -14
- data/jt_tools.gemspec +15 -14
- data/lib/install/.circleci/config.yml +43 -34
- data/lib/install/.fasterer.yml +3 -0
- data/lib/install/.gitattributes +10 -0
- data/lib/install/.github/config.yml +21 -0
- data/lib/install/.rubocop.yml +16 -13
- data/lib/install/.simplecov +6 -6
- data/lib/install/Brewfile +11 -11
- data/lib/install/Gemfile.tools +7 -6
- data/lib/install/app.json +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 +126 -103
- metadata +29 -5
- data/bin/standardrb +0 -29
- data/lib/install/.dependabot/config.yml +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb04a85894fdfe373769904f9a777fba74b09603f12f742fc97790be268745d
|
4
|
+
data.tar.gz: 3c87268fa42ec2ed6f54cc56ca9a256c4d2e9f11da2a23a61ea5f00625de435c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e96e1914b767646c4e1dfa10a32d645f2012ae7902bceefa1b66c70fa1ef8f902ded3f282522e892e34da8be72d9d7c8fb9abca69866efb0b7e3e40117447fb9
|
7
|
+
data.tar.gz: 6aba8cac6cf26bd2cc19eeeb317bbf0770cb08c6c244381e3c01096d2fabccd2928c4a1854a1ea60246211936f8b10dc1485c4b926202b39baae0db2cd7c8ad1
|
data/.circleci/config.yml
CHANGED
@@ -3,11 +3,13 @@ version: 2.1
|
|
3
3
|
jobs:
|
4
4
|
test:
|
5
5
|
docker:
|
6
|
-
- image: cimg/ruby:
|
6
|
+
- image: cimg/ruby:3.0-node
|
7
7
|
environment:
|
8
8
|
DATABASE_URL: postgresql://ubuntu@127.0.0.1/db_test
|
9
|
+
BUNDLE_PATH: /home/circleci/project/vendor/bundle
|
9
10
|
BUNDLE_JOBS: 4
|
10
11
|
BUNDLE_RETRY: 3
|
12
|
+
DEBIAN_FRONTEND: noninteractive
|
11
13
|
|
12
14
|
- image: circleci/postgres:alpine-ram
|
13
15
|
environment:
|
@@ -22,29 +24,51 @@ jobs:
|
|
22
24
|
- rails-v2-{{ arch }}-
|
23
25
|
- rails-v2-
|
24
26
|
|
25
|
-
-
|
27
|
+
- ruby/install-deps:
|
28
|
+
key: v1-dependencies
|
29
|
+
with-cache: false
|
30
|
+
path: /home/circleci/project/vendor/bundle
|
26
31
|
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
|
32
|
+
- node/install-packages:
|
33
|
+
app-dir: .
|
34
|
+
pkg-manager: yarn
|
35
|
+
cache-version: v1
|
32
36
|
|
33
37
|
- run: |
|
34
|
-
[[ $CIRCLE_NODE_INDEX == "0" ]] || bin/test
|
38
|
+
[[ $CIRCLE_NODE_INDEX == "0" ]] || bin/ci-test
|
35
39
|
- run: |
|
36
|
-
[[ $CIRCLE_NODE_INDEX == "1" ]] || TEST_APP_TEMPLATE=true bin/test
|
40
|
+
[[ $CIRCLE_NODE_INDEX == "1" ]] || TEST_APP_TEMPLATE=true bin/ci-test
|
37
41
|
|
38
42
|
- save_cache:
|
39
43
|
key: rails-v2-{{ arch }}-{{ .Revision }}
|
40
44
|
paths:
|
45
|
+
- /home/circleci/project/vendor/bundle
|
41
46
|
- /home/circleci/.rubygems
|
42
47
|
- /home/circleci/.cache
|
43
48
|
|
49
|
+
orbs:
|
50
|
+
node: circleci/node@4
|
51
|
+
ruby: circleci/ruby@1
|
52
|
+
|
44
53
|
workflows:
|
45
|
-
|
54
|
+
commit:
|
46
55
|
jobs:
|
47
|
-
-
|
56
|
+
- hold:
|
57
|
+
type: approval
|
58
|
+
filters:
|
59
|
+
branches:
|
60
|
+
ignore:
|
61
|
+
- master
|
62
|
+
- test:
|
63
|
+
requires:
|
64
|
+
- hold
|
65
|
+
merge:
|
66
|
+
jobs:
|
67
|
+
- test:
|
68
|
+
filters:
|
69
|
+
branches:
|
70
|
+
only:
|
71
|
+
- master
|
48
72
|
|
49
73
|
daily:
|
50
74
|
triggers:
|
data/.gitattributes
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
*.gemspec diff=ruby
|
2
|
+
*.rake diff=ruby
|
3
|
+
*.rb diff=ruby
|
4
|
+
*.js diff=javascript
|
5
|
+
|
6
|
+
db/schema.rb merge=ours diff=ruby linguist-generated
|
7
|
+
yarn.lock merge=ours linguist-generated
|
8
|
+
Gemfile.lock merge=ours linguist-generated
|
9
|
+
|
10
|
+
vendor/* linguist-vendored
|
11
|
+
bin/* linguist-generated
|
@@ -0,0 +1,100 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
pull_request_target:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
|
12
|
+
env:
|
13
|
+
DEBIAN_FRONTEND: noninteractive
|
14
|
+
CIRCLECI: true
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
lint:
|
18
|
+
name: Lint
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- name: Checkout code
|
23
|
+
uses: actions/checkout@v2
|
24
|
+
|
25
|
+
- name: Set up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: '3.0'
|
29
|
+
bundler-cache: true
|
30
|
+
|
31
|
+
- name: Run standard Ruby linter
|
32
|
+
run: bundle exec rubocop -P -c ./.rubocop.yml ./
|
33
|
+
|
34
|
+
test:
|
35
|
+
name: Functional testing
|
36
|
+
env:
|
37
|
+
DATABASE_URL: postgresql://postgres_user:postgres@localhost:5432/postgres_db
|
38
|
+
|
39
|
+
strategy:
|
40
|
+
matrix:
|
41
|
+
os-version: [ 'ubuntu-20.04', 'ubuntu-18.04' ]
|
42
|
+
fail-fast: true
|
43
|
+
|
44
|
+
runs-on: ${{ matrix.os-version }}
|
45
|
+
|
46
|
+
services:
|
47
|
+
postgres:
|
48
|
+
image: postgres # circleci/postgres:alpine-ram
|
49
|
+
env:
|
50
|
+
POSTGRES_DB: postgres_db
|
51
|
+
POSTGRES_USER: postgres_user
|
52
|
+
POSTGRES_PASSWORD: postgres
|
53
|
+
ports:
|
54
|
+
- 5432:5432
|
55
|
+
options: >-
|
56
|
+
--health-cmd pg_isready
|
57
|
+
--health-interval 10s
|
58
|
+
--health-timeout 5s
|
59
|
+
--health-retries 5
|
60
|
+
|
61
|
+
steps:
|
62
|
+
- run: pwd
|
63
|
+
- name: Checkout code
|
64
|
+
uses: actions/checkout@v2
|
65
|
+
|
66
|
+
- name: Install PostgreSQL client
|
67
|
+
run: sudo apt-get -yqq install libpq-dev
|
68
|
+
|
69
|
+
- name: Set up Ruby
|
70
|
+
uses: ruby/setup-ruby@v1
|
71
|
+
with:
|
72
|
+
ruby-version: '3.0'
|
73
|
+
bundler-cache: true
|
74
|
+
|
75
|
+
- name: Use Node.js
|
76
|
+
uses: actions/setup-node@v1
|
77
|
+
with:
|
78
|
+
node-version: 14
|
79
|
+
|
80
|
+
- name: Get yarn cache directory path
|
81
|
+
id: yarn-cache-dir-path
|
82
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
83
|
+
|
84
|
+
- uses: actions/cache@v2
|
85
|
+
with:
|
86
|
+
path: |
|
87
|
+
**/node_modules
|
88
|
+
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
89
|
+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
90
|
+
restore-keys: |
|
91
|
+
${{ runner.os }}-modules-
|
92
|
+
|
93
|
+
- run: yarn install
|
94
|
+
|
95
|
+
- name: Disable Linuxbrew
|
96
|
+
run: |
|
97
|
+
[[ $(uname -s) == "Linux"* ]] && sudo rm -rf $(which brew)
|
98
|
+
|
99
|
+
- name: Run Tests
|
100
|
+
run: bin/ci-test
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.standard.yml
CHANGED
@@ -2,9 +2,13 @@ default_ignores: false
|
|
2
2
|
#fix: true
|
3
3
|
format: progress
|
4
4
|
parallel: true
|
5
|
-
ruby_version:
|
5
|
+
ruby_version: 3.0
|
6
6
|
|
7
7
|
ignore:
|
8
|
+
- '**/*':
|
9
|
+
- Standard/SemanticBlocks
|
10
|
+
- 'db/schema.rb'
|
8
11
|
- 'test/**/*':
|
9
12
|
- Layout/AlignHash
|
10
13
|
- 'tmp/**/*'
|
14
|
+
- 'vendor/**/*'
|
data/Gemfile
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
ruby '3.0.0'
|
2
6
|
|
3
7
|
# Specify your gem's dependencies in jt_tools.gemspec
|
4
8
|
gemspec
|
5
9
|
|
6
|
-
gem
|
7
|
-
gem
|
10
|
+
gem 'rubocop-minitest', require: false
|
11
|
+
gem 'rubocop-performance', require: false
|
12
|
+
gem 'rubocop-rails', require: false
|
13
|
+
gem 'standard', '>= 0.4.7', require: false
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[](https://github.com/jetthoughts/jt_tools/actions?query=workflow%3ATest)
|
1
2
|
[](https://circleci.com/gh/jetthoughts/jt_tools)
|
2
3
|
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fjetthoughts%2Fjt_tools?ref=badge_shield)
|
3
4
|
[](https://badge.fury.io/rb/jt_tools)
|
@@ -20,10 +21,10 @@ Pre-setup for service
|
|
20
21
|
|
21
22
|
* [GitHub](https://github.com)
|
22
23
|
* [Heroku](https://jtway.co/make-master-stable-again-b15c9ff3b129) (Heroku Reviews Apps)
|
24
|
+
* [MemCachier](https://www.memcachier.com/)
|
23
25
|
* [CircleCI](https://circleci.com/)
|
24
26
|
* [Codecov](https://codecov.io/) and [Simplecov](https://github.com/colszowka/simplecov)
|
25
27
|
* [Dependabot](https://dependabot.com/)
|
26
|
-
* [MemCachier](https://www.memcachier.com/)
|
27
28
|
* Code Styles:
|
28
29
|
* [Pronto](https://jtway.co/effortless-code-review-for-pull-request-changes-241206b1cb04)
|
29
30
|
* [Rubocop](https://github.com/rubocop-hq/rubocop)
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
5
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs <<
|
8
|
-
t.libs <<
|
9
|
-
t.test_files = FileList[
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
10
10
|
end
|
11
11
|
|
12
12
|
task default: :test
|
data/bin/ci-test
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -eo pipefail
|
4
|
+
|
5
|
+
gem install rails -N --update-sources
|
6
|
+
|
7
|
+
sudo apt-get update -qq && \
|
8
|
+
sudo apt-get install -yq --no-install-recommends \
|
9
|
+
cmake curl yamllint python3-setuptools python3-pkg-resources pkg-config
|
10
|
+
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash
|
11
|
+
git config --global user.email "you@example.com" && git config --global user.name "Your Name"
|
12
|
+
|
13
|
+
bin/test
|
data/bin/lint
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -eo pipefail
|
4
|
+
|
5
|
+
yamllint --config-file lib/install/.yamllint.yml --strict .*/*.yml
|
6
|
+
yamllint --config-file lib/install/.yamllint.yml --strict ./*.yml
|
7
|
+
yamllint --config-file lib/install/.yamllint.yml --strict lib/**/.*.yml
|
8
|
+
yamllint --config-file lib/install/.yamllint.yml --strict ./**/.*/*.yml
|
9
|
+
|
10
|
+
node_modules/.bin/eslint --config lib/install/.eslintrc.js --quiet --no-color lib/**/.*.js
|
11
|
+
|
12
|
+
bundle exec rubocop --debug --extra-details --display-style-guide --parallel
|
data/bin/rubocop
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
|
+
|
29
|
+
load Gem.bin_path('rubocop', 'rubocop')
|
data/bin/test
CHANGED
@@ -2,29 +2,37 @@
|
|
2
2
|
|
3
3
|
set -eo pipefail
|
4
4
|
|
5
|
+
export BUNDLE_PATH="$(pwd)/vendor/bundle"
|
6
|
+
mkdir -p "$BUNDLE_PATH"
|
7
|
+
|
8
|
+
bundle check || bundle install
|
9
|
+
yarn check || yarn install
|
10
|
+
|
5
11
|
echo ""
|
6
|
-
echo "==
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
echo "== Lint: =="
|
13
|
+
bin/lint
|
14
|
+
|
15
|
+
target_dir=${1:-$(mktemp -d)}
|
16
|
+
template_path="$(pwd)/template.rb"
|
11
17
|
|
12
|
-
mkdir -p
|
18
|
+
mkdir -p "$target_dir"
|
13
19
|
|
14
|
-
cd
|
20
|
+
cd "$target_dir"
|
15
21
|
rm -rf test_tmpl
|
16
22
|
|
17
23
|
# Test installation of missed gems on applying template
|
18
|
-
gem uninstall oj || true
|
24
|
+
gem uninstall --force --silent oj || true
|
19
25
|
|
20
26
|
if [[ "$TEST_APP_TEMPLATE" == "true" ]]
|
21
27
|
then
|
28
|
+
echo "Adds template to existed app"
|
22
29
|
rails new test_tmpl --quiet --database postgresql
|
23
30
|
cd test_tmpl
|
24
31
|
bin/setup
|
25
|
-
bin/rails app:template LOCATION="
|
32
|
+
bin/rails app:template LOCATION="${template_path}"
|
26
33
|
else
|
27
|
-
|
34
|
+
echo "Generate app with template"
|
35
|
+
rails new test_tmpl --template "${template_path}" --quiet --database postgresql
|
28
36
|
cd test_tmpl
|
29
37
|
bin/setup
|
30
38
|
fi
|
@@ -55,8 +63,6 @@ git commit -m 'Adds sample_for_linters'
|
|
55
63
|
bin/rubocop --fail-level F sample_for_linters.rb
|
56
64
|
bin/pronto run -c HEAD~1 --no-exit-code
|
57
65
|
BUNDLE_GEMFILE=Gemfile.tools bin/bundle exec rails_best_practices --without-color --silent --test .
|
58
|
-
# FIXME: https://github.com/Shopify/erb-lint/issues/162
|
59
|
-
# BUNDLE_GEMFILE=Gemfile.tools bin/bundle exec erblint --config ../../lib/install/.erb-lint.yml --autocorrect .
|
60
66
|
|
61
67
|
CIRCLECI=false bin/lint-pr -f text
|
62
68
|
|
@@ -65,5 +71,8 @@ echo "== Run git hooks verifications =="
|
|
65
71
|
bin/git-hooks/post-merge
|
66
72
|
CIRCLECI=false bin/git-hooks/pre-push
|
67
73
|
|
68
|
-
|
69
|
-
|
74
|
+
# For local run only
|
75
|
+
if [[ -z "$CIRCLECI" ]]
|
76
|
+
then
|
77
|
+
circleci local execute --job test --config .circleci/config.yml
|
78
|
+
fi
|
data/jt_tools.gemspec
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require 'jt_tools/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = 'jt_tools'
|
9
9
|
spec.version = JtTools::VERSION
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
10
|
+
spec.authors = ['Paul Keen']
|
11
|
+
spec.email = ['pftg@users.noreply.github.com']
|
12
12
|
|
13
|
-
spec.summary =
|
14
|
-
spec.description =
|
15
|
-
spec.homepage =
|
16
|
-
spec.license =
|
13
|
+
spec.summary = 'Setup development scripts to manage code base effectively'
|
14
|
+
spec.description = 'Helpful scripts to run linters locally and on CI'
|
15
|
+
spec.homepage = 'https://jtway.co'
|
16
|
+
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/jetthoughts/jt-tools/'
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/jetthoughts/jt-tools/'
|
21
21
|
|
22
|
-
spec.add_dependency
|
22
|
+
spec.add_dependency 'railties', '>= 4.2'
|
23
|
+
spec.add_development_dependency 'bump'
|
23
24
|
|
24
25
|
# Specify which files should be added to the gem when it is released.
|
25
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -27,5 +28,5 @@
|
|
27
28
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
29
|
end
|
29
30
|
|
30
|
-
spec.require_paths = [
|
31
|
+
spec.require_paths = ['lib']
|
31
32
|
end
|