jt_tools 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -2
  3. data/.github/FUNDING.yml +4 -0
  4. data/README.md +19 -10
  5. data/_config.yml +2 -1
  6. data/bin/test +17 -5
  7. data/jt_tools.gemspec +1 -1
  8. data/lib/install/.circleci/{config.yml.sample → config.yml} +88 -19
  9. data/lib/install/.dependabot/config.yml +3 -3
  10. data/lib/install/.editorconfig +301 -0
  11. data/lib/install/.erb-lint.yml +2 -2
  12. data/lib/install/.eslintrc.js +8 -11
  13. data/lib/install/.pronto.yml +3 -5
  14. data/lib/install/.reek.yml +3 -6
  15. data/lib/install/.rubocop.yml +22 -19
  16. data/lib/install/.simplecov +17 -0
  17. data/lib/install/{.yamllint → .yamllint.yml} +2 -1
  18. data/lib/install/Brewfile +6 -2
  19. data/lib/install/Gemfile.tools +2 -2
  20. data/lib/install/app.json +17 -46
  21. data/lib/install/bin/git-hooks/post-merge.sample +0 -9
  22. data/lib/install/bin/git-hooks/pre-push.sample +1 -1
  23. data/lib/install/bin/heroku-postdeploy +1 -7
  24. data/lib/install/bin/heroku-release +4 -1
  25. data/lib/install/bin/{lint-github-pr → lint-pr} +0 -0
  26. data/lib/install/bin/tools-setup +1 -1
  27. data/lib/install/bin/tools-upgrade +2 -0
  28. data/lib/install/codecov.yml +5 -4
  29. data/lib/install/config/rails_best_practices.yml +43 -0
  30. data/lib/jt_tools/railtie.rb +2 -0
  31. data/lib/{version.rb → jt_tools/version.rb} +1 -1
  32. data/lib/jt_tools.rb +2 -0
  33. data/lib/tasks/install.rake +3 -1
  34. data/template.rb +36 -17
  35. metadata +11 -12
  36. data/_sample/test_erb.html.erb +0 -2
  37. data/_sample/test_eslint.js +0 -1
  38. data/_sample/test_yamlint.yml +0 -1
  39. data/lib/install/.prettierrc.js +0 -4
  40. data/lib/install/lib/test/coverage.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8fb6f06a07bd971f50e67990613d4e54c0d875cd267157a591274c3d0cdf2f8
4
- data.tar.gz: a2e443bb4c2f0c69736104afa340a439d7bb56b63c6c6cb85c3507b62a9ff27b
3
+ metadata.gz: 303aa96abfb07573d5a9eac9a8cbdb411dba30ced323e113b122aafbfda28620
4
+ data.tar.gz: c69d491e99acf660f65a3678f78e5c37e605bffd2479ad2c1da6c4f933bbbec5
5
5
  SHA512:
6
- metadata.gz: fb4f90d8cb5ffb05774500c70e27b8418691aee7cce474ad31d92e223cc98a17555074927d774c94a581e5cf3a8c41051ef34ec9d3bd6ae3bf9adfbdbbaed88c
7
- data.tar.gz: 3709e81ba37922dde45c3851407f4a6b5f5a374277c203fe7697a5785bc8c753dae8e36315c1a881edcdd7b1fe89c4fe0b2bde106223dfa4ef4829cc0077c9b6
6
+ metadata.gz: 02ade8a3a413d0a9f8bbb18296d1ecab40a3ca7be950d87ceabde5591e16fb22ce40ec2078c271766ffead6d91c754fcdc828247ffaaadd31fa6047521f557b5
7
+ data.tar.gz: 76b38e94b17cd308c4a80689a46971b47f2394735f72183522d2a4f8a9580b039915eab3e90b81741089b0c252878ea095313ff2b91f299544624c5c00cecaf3
data/.circleci/config.yml CHANGED
@@ -1,13 +1,23 @@
1
+ ---
1
2
  version: 2.1
2
3
  jobs:
3
4
  test:
4
5
  docker:
5
6
  - image: circleci/ruby:2.6-node
7
+ environment:
8
+ DATABASE_URL: postgresql://ubuntu@127.0.0.1/db_test
9
+ BUNDLE_JOBS: 4
10
+ BUNDLE_RETRY: 3
11
+
12
+ - image: circleci/postgres:alpine-ram
13
+ environment:
14
+ POSTGRES_USER: ubuntu
15
+ POSTGRES_DB: db_test
6
16
  parallelism: 1
7
17
  steps:
8
18
  - checkout
9
19
  - run: gem install rails -N --update-sources
10
- - run: sudo apt-get install cmake curl
20
+ - run: sudo apt-get install cmake curl yamllint python3-setuptools python3-pkg-resources
11
21
  - run: curl -fLSs https://circle.ci/cli | sudo bash
12
22
  - run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
13
23
  - run: bin/test
@@ -19,7 +29,7 @@ workflows:
19
29
  - test
20
30
 
21
31
  daily:
22
- triggers: #use the triggers key to indicate a scheduled build
32
+ triggers:
23
33
  - schedule:
24
34
  cron: "0 0 * * *"
25
35
  filters:
@@ -0,0 +1,4 @@
1
+ ---
2
+ github: [pftg]
3
+ patreon: pftg
4
+ custom: ['https://www.jetthoughts.com', 'https://jtway.co']
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  [![CircleCI](https://circleci.com/gh/jetthoughts/jt_tools.svg?style=svg)](https://circleci.com/gh/jetthoughts/jt_tools)
2
+ [![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)
2
3
 
3
4
  # JetThoughts Tools
4
5
 
5
- Ruby on Rails ecosystem to maintain projects without losing your mind.
6
+ Ruby on Rails Continious Deployemnt ecosystem to maintain projects without losing your mind.
6
7
  Automatization scripts and services integrations which make your product world class level with no effort!
7
8
 
8
9
  More details could be found in such posts:
@@ -10,17 +11,22 @@ More details could be found in such posts:
10
11
  * [How to Setup a Project That Can Host Up to 1000 Users for Free](https://jtway.co/how-to-setup-a-project-that-can-host-up-to-1000-users-for-free-ab59ad3edaf1)
11
12
  * [Our Default Ruby Development Stack](https://jtway.co/our-default-ruby-development-stack-9d7e80ef21df)
12
13
  * [Heroku Reviews Apps prevent delivering bugs on production](https://jtway.co/make-master-stable-again-b15c9ff3b129)
14
+ * [Effortless Code Conventions Review for Pull Request Changes](https://jtway.co/effortless-code-review-for-pull-request-changes-241206b1cb04)
13
15
 
14
16
  # Services and Tools
15
17
 
16
18
  Pre-setup for service
17
19
 
18
- * Heroku
19
- * CircleCI
20
- * Codecov
21
- * Pronto
22
- * Static Code Analysisers: Rubocop, Reek, and etc.
23
- * Dependabot
20
+ * [GitHub](https://github.com)
21
+ * [Heroku](https://jtway.co/make-master-stable-again-b15c9ff3b129) (Heroku Reviews Apps)
22
+ * [CircleCI](https://circleci.com/)
23
+ * [Codecov](https://codecov.io/) and [Simplecov](https://github.com/colszowka/simplecov)
24
+ * [Dependabot](https://dependabot.com/)
25
+ * Code Styles:
26
+ * [Pronto](https://jtway.co/effortless-code-review-for-pull-request-changes-241206b1cb04)
27
+ * [Rubocop](https://github.com/rubocop-hq/rubocop)
28
+ * [ESLint](https://eslint.org/)
29
+ * [EditorConfig](https://editorconfig.org/)
24
30
 
25
31
  ## Installation
26
32
 
@@ -52,13 +58,13 @@ bin/tools-setup
52
58
  bin/tools-upgrade
53
59
  ```
54
60
 
55
- Auto-review on GitHub opened Pull Rquests to follow code consensentcy
61
+ Auto-review on GitHub opened Pull Rquests to follow code consistency
56
62
 
57
63
  ```bash
58
- bin/lint-github-pr
64
+ bin/lint-pr
59
65
  ```
60
66
 
61
- Check localy all problems in the current branch cahnges
67
+ Check locally all problems in the current branch changes
62
68
 
63
69
  ```bash
64
70
  bin/pronto run
@@ -67,3 +73,6 @@ bin/pronto run
67
73
  ## License
68
74
 
69
75
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
76
+
77
+
78
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjetthoughts%2Fjt_tools.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjetthoughts%2Fjt_tools?ref=badge_large)
data/_config.yml CHANGED
@@ -1 +1,2 @@
1
- theme: jekyll-theme-architect
1
+ ---
2
+ theme: jekyll-theme-architect
data/bin/test CHANGED
@@ -1,26 +1,33 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- set -eo pipefail
3
+ set -xeo pipefail
4
+
5
+ echo "=> Yamllint:"
6
+ yamllint --config-file lib/install/.yamllint.yml --strict .*/*.yml
7
+ yamllint --config-file lib/install/.yamllint.yml --strict *.yml
8
+ yamllint --config-file lib/install/.yamllint.yml --strict lib/**/.*.yml
9
+ yamllint --config-file lib/install/.yamllint.yml --strict **/.*/*.yml
4
10
 
5
11
  mkdir -p tmp/
6
12
 
7
13
  cd tmp
8
14
  rm -rf test_tmpl
9
15
 
16
+ # Test installation of missed gems on applying template
10
17
  gem uninstall oj || true
11
18
 
12
19
  if [[ "TEST_APP_TEMPLATE" == "true" ]]
13
20
  then
14
- rails new test_tmpl
21
+ rails new test_tmpl --quiet
15
22
  cd test_tmpl
16
23
  rails app:template LOCATION=../template.rb
17
24
  else
18
- rails new test_tmpl -m ../template.rb
25
+ rails new test_tmpl --template ../template.rb --quiet --database postgresql
19
26
  cd test_tmpl
27
+ bin/setup
20
28
  fi
21
29
 
22
30
  echo " => Verify CircleCI config:"
23
- cp .circleci/config.yml.sample .circleci/config.yml
24
31
  circleci config validate
25
32
 
26
33
  echo " => Verify installation scripts:"
@@ -42,9 +49,14 @@ git commit -m 'Adds sample_for_linters'
42
49
 
43
50
  bin/rubocop --fail-level F sample_for_linters.rb
44
51
  bin/pronto run -c HEAD~1 --no-exit-code
52
+ BUNDLE_GEMFILE=Gemfile.tools bin/bundle exec rails_best_practices --without-color --silent --test .
53
+ BUNDLE_GEMFILE=Gemfile.tools bin/bundle exec erblint --config ../../lib/install/.erb-lint.yml --autocorrect .
45
54
 
46
- CIRCLECI=false bin/lint-github-pr -f text
55
+ CIRCLECI=false bin/lint-pr -f text
47
56
 
48
57
  echo " => Run git hooks verifications"
49
58
  bin/git-hooks/post-merge.sample
50
59
  CIRCLECI=false bin/git-hooks/pre-push.sample
60
+
61
+ bin/rubocop --config ../../lib/install/.rubocop.yml --debug --extra-details --display-style-guide --parallel ../../lib
62
+ node_modules/.bin/eslint --config ../../lib/install/.eslintrc.js --quiet --no-color ../../lib/**/.*.js
data/jt_tools.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'version'
5
+ require 'jt_tools/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'jt_tools'
@@ -10,6 +10,7 @@ workflows:
10
10
  version: 2
11
11
  test:
12
12
  jobs:
13
+ - test
13
14
  - lint:
14
15
  filters:
15
16
  branches:
@@ -35,17 +36,16 @@ jobs:
35
36
  # specify the version you desire here
36
37
  - image: circleci/ruby:2.6-node-browsers
37
38
  environment:
38
- COVERAGE: true
39
39
  BUNDLE_GEMFILE: Gemfile
40
- BUNDLE_WITHOUT: "production:staging:development"
41
- BUNDLE_JOBS: 3
42
- BUNDLE_RETRY: 3
43
40
  BUNDLE_PATH: vendor/bundle
44
- RAILS_ENV: test
41
+ BUNDLE_JOBS: 4
42
+ BUNDLE_RETRY: 3
43
+ BUNDLE_WITHOUT: "production:staging:development"
44
+ COVERAGE: true
45
+ DATABASE_URL: postgresql://ubuntu@localhost/db
46
+ NODE_ENV: test
45
47
  RACK_ENV: test
46
- PGHOST: 127.0.0.1
47
- PGUSER: ubuntu
48
- DATABASE_URL: postgresql:ubuntu@127.0.0.1/db_test
48
+ RAILS_ENV: test
49
49
 
50
50
  # Specify service dependencies here if necessary
51
51
  # CircleCI maintains a library of pre-built images
@@ -53,11 +53,18 @@ jobs:
53
53
  - image: circleci/postgres:alpine-ram
54
54
  environment:
55
55
  POSTGRES_USER: ubuntu
56
- POSTGRES_DB: db_test
56
+ POSTGRES_DB: db
57
57
 
58
58
  steps:
59
59
  - checkout
60
60
 
61
+ - run:
62
+ name: Install Bundler
63
+ command: |
64
+ echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
65
+ source $BASH_ENV
66
+ gem install bundler:$BUNDLER_VERSION
67
+
61
68
  # Download and cache dependencies
62
69
  - restore_cache:
63
70
  name: Restore Bundler Cache
@@ -75,12 +82,75 @@ jobs:
75
82
  - ./vendor/bundle
76
83
  key: v1-dependencies-{{ checksum "Gemfile.lock" }}
77
84
 
78
- - run: bin/rails db:schema:load
79
- - run: bin/rails test
85
+ - restore_cache:
86
+ name: Restore Yarn Cache
87
+ keys:
88
+ - v1-yarn-dependencies-{{ checksum "yarn.lock" }}
89
+ - v1-yarn-dependencies-
90
+
91
+ - run:
92
+ name: Install Yarn Dependencies
93
+ command: bin/yarn check || bin/yarn install
94
+
95
+ - save_cache:
96
+ name: Save Yarn Cache
97
+ paths:
98
+ - ./node_modules
99
+ key: v1-yarn-dependencies-{{ checksum "yarn.lock" }}
100
+
101
+ - restore_cache:
102
+ keys:
103
+ - asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ .Environment.CIRCLE_SHA1 }}
104
+ - asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-
105
+ - asset-cache-v1-{{ arch }}-{{ .Branch }}-
106
+ - asset-cache-v1-
107
+
108
+ - run:
109
+ name: Precompile Assets
110
+ command: |
111
+ bin/webpack
112
+ bin/rails assets:precompile
113
+
114
+ - save_cache:
115
+ key: asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ .Environment.CIRCLE_SHA1 }}
116
+ paths:
117
+ - public/assets
118
+ - public/pack-test
119
+ - tmp/cache/assets
120
+ - tmp/cache/webpacker
121
+
122
+ - restore_cache:
123
+ name: Restore Jest Cache
124
+ keys:
125
+ - jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
126
+ - jest-cache-v1-{{ arch }}-{{ .Branch }}-
127
+ - jest-cache-v1-
128
+
129
+ - run:
130
+ name: JavaScript Unit Tests
131
+ command: |
132
+ bin/yarn test --ci --no-watchman \
133
+ --coverage --coverageDirectory coverage/jest \
134
+ --coverageReporters text-summary --coverageReporters html \
135
+ --reporters=jest-junit
136
+ environment:
137
+ JEST_JUNIT_OUTPUT_DIR: tmp/reports/jest-results
138
+
139
+ - save_cache:
140
+ name: Save Jest Cache
141
+ key: jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
142
+ paths:
143
+ - tmp/cache/jest
144
+
145
+ - run:
146
+ name: RSpec Tests
147
+ command: |
148
+ bin/rails db:schema:load
149
+ bin/rspec --format RspecJunitFormatter --out tmp/reports/rspec-results.xml --format progress
80
150
 
81
151
  # collect reports
82
152
  - store_test_results:
83
- path: ./test/reports/
153
+ path: ./tmp/reports/
84
154
  - store_artifacts:
85
155
  path: ./coverage
86
156
  lint:
@@ -89,7 +159,7 @@ jobs:
89
159
  environment:
90
160
  DISABLE_SPRING: 1
91
161
  BUNDLE_GEMFILE: Gemfile.tools
92
- BUNDLE_JOBS: 3
162
+ BUNDLE_JOBS: 4
93
163
  BUNDLE_RETRY: 3
94
164
 
95
165
  steps:
@@ -102,7 +172,7 @@ jobs:
102
172
 
103
173
  - run:
104
174
  name: Install cmake for building pronto dependencies
105
- command: sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources
175
+ command: sudo apt-get update && sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources
106
176
 
107
177
  - run:
108
178
  name: Install Bundle Dependencies
@@ -110,7 +180,7 @@ jobs:
110
180
 
111
181
  - run:
112
182
  name: Install Node Packages
113
- command: bin/yarn
183
+ command: bin/yarn check || bin/yarn install
114
184
 
115
185
  - save_cache:
116
186
  key: v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }}
@@ -118,7 +188,7 @@ jobs:
118
188
  - ./vendor/bundle-tools
119
189
  - ./node_modules
120
190
 
121
- - run: bin/lint-github-pr
191
+ - run: bin/lint-pr
122
192
 
123
193
  upgrade_tools:
124
194
  docker:
@@ -126,7 +196,7 @@ jobs:
126
196
  environment:
127
197
  DISABLE_SPRING: 1
128
198
  BUNDLE_GEMFILE: Gemfile.tools
129
- BUNDLE_JOBS: 3
199
+ BUNDLE_JOBS: 4
130
200
  BUNDLE_RETRY: 3
131
201
 
132
202
  steps:
@@ -139,10 +209,9 @@ jobs:
139
209
  source $BASH_ENV
140
210
  gem install bundler:$BUNDLER_VERSION
141
211
 
142
- - run: sudo apt-get install cmake
212
+ - run: sudo apt-get update && sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources
143
213
 
144
214
  - run:
145
215
  name: Run Gemfile tools update in separate branch
146
216
  command: |
147
217
  ./bin/circleci-auto_upgrade_tools
148
-
@@ -1,3 +1,4 @@
1
+ ---
1
2
  version: 1
2
3
  update_configs:
3
4
  # Keep package.json (& lockfiles) up to date as soon as
@@ -12,8 +13,7 @@ update_configs:
12
13
  - match:
13
14
  dependency_type: production
14
15
  update_type: security
15
- version_requirement_updates: off
16
- -
16
+ version_requirement_updates: 'off'
17
17
  - package_manager: ruby:bundler
18
18
  directory: /
19
19
  update_schedule: weekly
@@ -29,4 +29,4 @@ update_configs:
29
29
  dependency_name: rspec*
30
30
  - match:
31
31
  dependency_name: capybara*
32
- version_requirement_updates: off
32
+ version_requirement_updates: 'off'