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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca58ce62c8051fef7f2111b3bdf395730e856c1f9eac7e5a1fa3bd6cb02cfd32
4
- data.tar.gz: 711f84e4d89e020b559c4ab1314f8b694ca241c214cc0f90045a3bfea3aa6e4a
3
+ metadata.gz: bdb04a85894fdfe373769904f9a777fba74b09603f12f742fc97790be268745d
4
+ data.tar.gz: 3c87268fa42ec2ed6f54cc56ca9a256c4d2e9f11da2a23a61ea5f00625de435c
5
5
  SHA512:
6
- metadata.gz: 7e65608ea2fafe9d5801be68214282b649452f50c8b3f058ec87aa0d04c8e86f0b43c1e9ee7631f9a962de383fa59b5396a6f776e43ee2edd8e3bfc2a95b90c0
7
- data.tar.gz: 68079b100b0be3eddf935aedeb994d62a5f852c7a706590bd4a08968749bcad05de69f95cdf225d2365df6e6b430ba6be711eed5d718ce1e6fed9187c89896b8
6
+ metadata.gz: e96e1914b767646c4e1dfa10a32d645f2012ae7902bceefa1b66c70fa1ef8f902ded3f282522e892e34da8be72d9d7c8fb9abca69866efb0b7e3e40117447fb9
7
+ data.tar.gz: 6aba8cac6cf26bd2cc19eeeb317bbf0770cb08c6c244381e3c01096d2fabccd2928c4a1854a1ea60246211936f8b10dc1485c4b926202b39baae0db2cd7c8ad1
@@ -3,11 +3,13 @@ version: 2.1
3
3
  jobs:
4
4
  test:
5
5
  docker:
6
- - image: cimg/ruby:2.7-node
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
- - run: gem install rails -N --update-sources
27
+ - ruby/install-deps:
28
+ key: v1-dependencies
29
+ with-cache: false
30
+ path: /home/circleci/project/vendor/bundle
26
31
 
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
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
- test:
54
+ commit:
46
55
  jobs:
47
- - test
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:
@@ -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
@@ -27,7 +27,7 @@ config/master.key
27
27
  ## Environment normalization:
28
28
  */bin/bundle
29
29
  .bundle
30
- */vendor/bundle
30
+ vendor/bundle
31
31
 
32
32
  # Ignore Byebug command history file.
33
33
  .byebug_history
@@ -0,0 +1,9 @@
1
+ ---
2
+ inherit_from: lib/install/.rubocop.yml
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - 'bin/**/*'
7
+ - 'template.rb'
8
+ - 'vendor/**/*'
9
+ - 'tmp/**/*'
@@ -2,9 +2,13 @@ default_ignores: false
2
2
  #fix: true
3
3
  format: progress
4
4
  parallel: true
5
- ruby_version: 2.7.1
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
- source "https://rubygems.org"
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 "standard"
7
- gem "bump"
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
+ [![GitHub Actions](https://github.com/jetthoughts/jt_tools/workflows/Test/badge.svg?branch=master)](https://github.com/jetthoughts/jt_tools/actions?query=workflow%3ATest)
1
2
  [![CircleCI](https://circleci.com/gh/jetthoughts/jt_tools.svg?style=svg)](https://circleci.com/gh/jetthoughts/jt_tools)
2
3
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjetthoughts%2Fjt_tools.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjetthoughts%2Fjt_tools?ref=badge_shield)
3
4
  [![Gem Version](https://badge.fury.io/rb/jt_tools.svg)](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 "bundler/gem_tasks"
4
- require "rake/testtask"
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
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
@@ -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
@@ -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
@@ -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 "== Yamllint: =="
7
- yamllint --config-file lib/install/.yamllint.yml --strict .*/*.yml
8
- yamllint --config-file lib/install/.yamllint.yml --strict *.yml
9
- yamllint --config-file lib/install/.yamllint.yml --strict lib/**/.*.yml
10
- yamllint --config-file lib/install/.yamllint.yml --strict **/.*/*.yml
12
+ echo "== Lint: =="
13
+ bin/lint
14
+
15
+ target_dir=${1:-$(mktemp -d)}
16
+ template_path="$(pwd)/template.rb"
11
17
 
12
- mkdir -p tmp/
18
+ mkdir -p "$target_dir"
13
19
 
14
- cd tmp
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="../../template.rb"
32
+ bin/rails app:template LOCATION="${template_path}"
26
33
  else
27
- rails new test_tmpl --template ../template.rb --quiet --database postgresql
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
- bin/rubocop --config ../../lib/install/.rubocop.yml --debug --extra-details --display-style-guide --parallel ../../lib
69
- node_modules/.bin/eslint --config ../../lib/install/.eslintrc.js --quiet --no-color ../../lib/**/.*.js
74
+ # For local run only
75
+ if [[ -z "$CIRCLECI" ]]
76
+ then
77
+ circleci local execute --job test --config .circleci/config.yml
78
+ fi
@@ -1,25 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("lib", __dir__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "jt_tools/version"
5
+ require 'jt_tools/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = "jt_tools"
8
+ spec.name = 'jt_tools'
9
9
  spec.version = JtTools::VERSION
10
- spec.authors = ["Paul Keen"]
11
- spec.email = ["pftg@users.noreply.github.com"]
10
+ spec.authors = ['Paul Keen']
11
+ spec.email = ['pftg@users.noreply.github.com']
12
12
 
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"
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["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/"
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 "railties", ">= 4.2"
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 = ["lib"]
31
+ spec.require_paths = ['lib']
31
32
  end