jt_tools 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +30 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/custom.md +10 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +3 -19
- data/README.md +39 -10
- data/_config.yml +1 -0
- data/bin/test +50 -0
- data/lib/install/.circleci/config.yml.sample +148 -0
- data/lib/install/.dependabot/config.yml +32 -0
- data/lib/install/.prettierrc.js +4 -0
- data/lib/install/.reek.yml +30 -0
- data/lib/install/.rubocop.yml +9 -9
- data/lib/install/Brewfile +12 -0
- data/lib/install/Gemfile.tools +3 -4
- data/lib/install/app.json +1 -1
- data/lib/install/bin/circleci-auto_upgrade_tools +30 -0
- data/lib/install/bin/git-hooks/post-merge.sample +29 -0
- data/lib/install/bin/git-hooks/pre-push.sample +8 -0
- data/lib/install/bin/lint-github-pr +2 -3
- data/lib/install/bin/tools-setup +8 -3
- data/lib/install/bin/tools-upgrade +6 -2
- data/lib/install/codecov.yml +8 -0
- data/lib/install/lib/test/coverage.rb +14 -0
- data/lib/jt_tools.rb +2 -0
- data/lib/tasks/install.rake +1 -1
- data/lib/version.rb +1 -1
- data/rejuvenation.rb +19 -0
- data/template.rb +129 -0
- metadata +21 -12
- data/.better-html.yml +0 -1
- data/.erb-lint.yml +0 -1
- data/.pronto.yml +0 -1
- data/.pronto_eslint_npm.yml +0 -1
- data/.rubocop.yml +0 -1
- data/.yamllint +0 -1
- data/lib/install/.prettierrc +0 -5
- data/lib/install/template.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8fb6f06a07bd971f50e67990613d4e54c0d875cd267157a591274c3d0cdf2f8
|
4
|
+
data.tar.gz: a2e443bb4c2f0c69736104afa340a439d7bb56b63c6c6cb85c3507b62a9ff27b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4f90d8cb5ffb05774500c70e27b8418691aee7cce474ad31d92e223cc98a17555074927d774c94a581e5cf3a8c41051ef34ec9d3bd6ae3bf9adfbdbbaed88c
|
7
|
+
data.tar.gz: 3709e81ba37922dde45c3851407f4a6b5f5a374277c203fe7697a5785bc8c753dae8e36315c1a881edcdd7b1fe89c4fe0b2bde106223dfa4ef4829cc0077c9b6
|
@@ -0,0 +1,30 @@
|
|
1
|
+
version: 2.1
|
2
|
+
jobs:
|
3
|
+
test:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.6-node
|
6
|
+
parallelism: 1
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- run: gem install rails -N --update-sources
|
10
|
+
- run: sudo apt-get install cmake curl
|
11
|
+
- run: curl -fLSs https://circle.ci/cli | sudo bash
|
12
|
+
- run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
|
13
|
+
- run: bin/test
|
14
|
+
- run: TEST_APP_TEMPLATE=true bin/test
|
15
|
+
|
16
|
+
workflows:
|
17
|
+
test:
|
18
|
+
jobs:
|
19
|
+
- test
|
20
|
+
|
21
|
+
daily:
|
22
|
+
triggers: #use the triggers key to indicate a scheduled build
|
23
|
+
- schedule:
|
24
|
+
cron: "0 0 * * *"
|
25
|
+
filters:
|
26
|
+
branches:
|
27
|
+
only:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
- test
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
A clear and concise description of what the bug is.
|
12
|
+
|
13
|
+
**To Reproduce**
|
14
|
+
Steps to reproduce the behavior:
|
15
|
+
1. Go to '...'
|
16
|
+
2. Click on '....'
|
17
|
+
3. Scroll down to '....'
|
18
|
+
4. See error
|
19
|
+
|
20
|
+
**Expected behavior**
|
21
|
+
A clear and concise description of what you expected to happen.
|
22
|
+
|
23
|
+
**Screenshots**
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
25
|
+
|
26
|
+
**Desktop (please complete the following information):**
|
27
|
+
- OS: [e.g. iOS]
|
28
|
+
- Browser [e.g. chrome, safari]
|
29
|
+
- Version [e.g. 22]
|
30
|
+
|
31
|
+
**Smartphone (please complete the following information):**
|
32
|
+
- Device: [e.g. iPhone6]
|
33
|
+
- OS: [e.g. iOS8.1]
|
34
|
+
- Browser [e.g. stock browser, safari]
|
35
|
+
- Version [e.g. 22]
|
36
|
+
|
37
|
+
**Additional context**
|
38
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.gitignore
CHANGED
@@ -29,29 +29,13 @@ config/master.key
|
|
29
29
|
.bundle
|
30
30
|
*/vendor/bundle
|
31
31
|
|
32
|
-
# these should all be checked in to normalize the environment:
|
33
|
-
# Gemfile.lock, .ruby-version, .ruby-gemset
|
34
|
-
|
35
|
-
Gemfile.tools.lock
|
36
|
-
|
37
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
38
|
-
.rvmrc
|
39
|
-
|
40
|
-
# if using bower-rails ignore default bower_components path bower.json files
|
41
|
-
/vendor/assets/bower_components
|
42
|
-
*.bowerrc
|
43
|
-
bower.json
|
44
|
-
|
45
|
-
# Ignore pow environment settings
|
46
|
-
.powenv
|
47
|
-
|
48
32
|
# Ignore Byebug command history file.
|
49
33
|
.byebug_history
|
50
34
|
|
51
35
|
# Ignore node_modules
|
52
36
|
node_modules/
|
53
37
|
|
54
|
-
.circleci/
|
55
|
-
lib/install/.bundle/
|
56
|
-
|
57
38
|
pkg
|
39
|
+
|
40
|
+
# Temp files
|
41
|
+
/tmp/
|
data/README.md
CHANGED
@@ -1,7 +1,35 @@
|
|
1
|
-
|
1
|
+
[![CircleCI](https://circleci.com/gh/jetthoughts/jt_tools.svg?style=svg)](https://circleci.com/gh/jetthoughts/jt_tools)
|
2
|
+
|
3
|
+
# JetThoughts Tools
|
4
|
+
|
5
|
+
Ruby on Rails ecosystem to maintain projects without losing your mind.
|
6
|
+
Automatization scripts and services integrations which make your product world class level with no effort!
|
7
|
+
|
8
|
+
More details could be found in such posts:
|
9
|
+
|
10
|
+
* [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
|
+
* [Our Default Ruby Development Stack](https://jtway.co/our-default-ruby-development-stack-9d7e80ef21df)
|
12
|
+
* [Heroku Reviews Apps prevent delivering bugs on production](https://jtway.co/make-master-stable-again-b15c9ff3b129)
|
13
|
+
|
14
|
+
# Services and Tools
|
15
|
+
|
16
|
+
Pre-setup for service
|
17
|
+
|
18
|
+
* Heroku
|
19
|
+
* CircleCI
|
20
|
+
* Codecov
|
21
|
+
* Pronto
|
22
|
+
* Static Code Analysisers: Rubocop, Reek, and etc.
|
23
|
+
* Dependabot
|
2
24
|
|
3
25
|
## Installation
|
4
26
|
|
27
|
+
To install remotely:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
rails app:template LOCATION=https://raw.githubusercontent.com/jetthoughts/jt_tools/master/template.rb
|
31
|
+
```
|
32
|
+
|
5
33
|
Add this line to your application's Gemfile:
|
6
34
|
|
7
35
|
```ruby
|
@@ -13,28 +41,29 @@ And then execute:
|
|
13
41
|
$ bundle
|
14
42
|
$ bin/rails jt_tools:install
|
15
43
|
|
16
|
-
## Usage
|
17
44
|
|
18
|
-
|
19
|
-
bin/pronto run
|
20
|
-
```
|
45
|
+
## Usage
|
21
46
|
|
22
|
-
|
23
|
-
bin/rubocop
|
24
|
-
```
|
47
|
+
Setup and update all tools required to maintain static code analysis
|
25
48
|
|
26
49
|
```bash
|
27
50
|
bin/tools-setup
|
28
|
-
```
|
29
51
|
|
30
|
-
```bash
|
31
52
|
bin/tools-upgrade
|
32
53
|
```
|
33
54
|
|
55
|
+
Auto-review on GitHub opened Pull Rquests to follow code consensentcy
|
56
|
+
|
34
57
|
```bash
|
35
58
|
bin/lint-github-pr
|
36
59
|
```
|
37
60
|
|
61
|
+
Check localy all problems in the current branch cahnges
|
62
|
+
|
63
|
+
```bash
|
64
|
+
bin/pronto run
|
65
|
+
```
|
66
|
+
|
38
67
|
## License
|
39
68
|
|
40
69
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-architect
|
data/bin/test
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -eo pipefail
|
4
|
+
|
5
|
+
mkdir -p tmp/
|
6
|
+
|
7
|
+
cd tmp
|
8
|
+
rm -rf test_tmpl
|
9
|
+
|
10
|
+
gem uninstall oj || true
|
11
|
+
|
12
|
+
if [[ "TEST_APP_TEMPLATE" == "true" ]]
|
13
|
+
then
|
14
|
+
rails new test_tmpl
|
15
|
+
cd test_tmpl
|
16
|
+
rails app:template LOCATION=../template.rb
|
17
|
+
else
|
18
|
+
rails new test_tmpl -m ../template.rb
|
19
|
+
cd test_tmpl
|
20
|
+
fi
|
21
|
+
|
22
|
+
echo " => Verify CircleCI config:"
|
23
|
+
cp .circleci/config.yml.sample .circleci/config.yml
|
24
|
+
circleci config validate
|
25
|
+
|
26
|
+
echo " => Verify installation scripts:"
|
27
|
+
bin/tools-setup
|
28
|
+
bin/tools-upgrade
|
29
|
+
|
30
|
+
echo " => Verify linters setup:"
|
31
|
+
|
32
|
+
git add .
|
33
|
+
git commit -m 'Initial Commit'
|
34
|
+
git checkout -b origin/master
|
35
|
+
|
36
|
+
git checkout -b test_pr
|
37
|
+
|
38
|
+
echo " => class SampleForLinters;end" > sample_for_linters.rb
|
39
|
+
|
40
|
+
git add .
|
41
|
+
git commit -m 'Adds sample_for_linters'
|
42
|
+
|
43
|
+
bin/rubocop --fail-level F sample_for_linters.rb
|
44
|
+
bin/pronto run -c HEAD~1 --no-exit-code
|
45
|
+
|
46
|
+
CIRCLECI=false bin/lint-github-pr -f text
|
47
|
+
|
48
|
+
echo " => Run git hooks verifications"
|
49
|
+
bin/git-hooks/post-merge.sample
|
50
|
+
CIRCLECI=false bin/git-hooks/pre-push.sample
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
---
|
6
|
+
|
7
|
+
version: 2.1
|
8
|
+
|
9
|
+
workflows:
|
10
|
+
version: 2
|
11
|
+
test:
|
12
|
+
jobs:
|
13
|
+
- lint:
|
14
|
+
filters:
|
15
|
+
branches:
|
16
|
+
ignore:
|
17
|
+
- master
|
18
|
+
- production
|
19
|
+
- staging
|
20
|
+
|
21
|
+
auto_upgrade_tools:
|
22
|
+
triggers:
|
23
|
+
- schedule:
|
24
|
+
cron: "0 10 1 * *"
|
25
|
+
filters:
|
26
|
+
branches:
|
27
|
+
only:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
- upgrade_tools
|
31
|
+
|
32
|
+
jobs:
|
33
|
+
test:
|
34
|
+
docker:
|
35
|
+
# specify the version you desire here
|
36
|
+
- image: circleci/ruby:2.6-node-browsers
|
37
|
+
environment:
|
38
|
+
COVERAGE: true
|
39
|
+
BUNDLE_GEMFILE: Gemfile
|
40
|
+
BUNDLE_WITHOUT: "production:staging:development"
|
41
|
+
BUNDLE_JOBS: 3
|
42
|
+
BUNDLE_RETRY: 3
|
43
|
+
BUNDLE_PATH: vendor/bundle
|
44
|
+
RAILS_ENV: test
|
45
|
+
RACK_ENV: test
|
46
|
+
PGHOST: 127.0.0.1
|
47
|
+
PGUSER: ubuntu
|
48
|
+
DATABASE_URL: postgresql:ubuntu@127.0.0.1/db_test
|
49
|
+
|
50
|
+
# Specify service dependencies here if necessary
|
51
|
+
# CircleCI maintains a library of pre-built images
|
52
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
53
|
+
- image: circleci/postgres:alpine-ram
|
54
|
+
environment:
|
55
|
+
POSTGRES_USER: ubuntu
|
56
|
+
POSTGRES_DB: db_test
|
57
|
+
|
58
|
+
steps:
|
59
|
+
- checkout
|
60
|
+
|
61
|
+
# Download and cache dependencies
|
62
|
+
- restore_cache:
|
63
|
+
name: Restore Bundler Cache
|
64
|
+
keys:
|
65
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
66
|
+
- v1-dependencies-
|
67
|
+
|
68
|
+
- run:
|
69
|
+
name: Install Bundler Dependencies
|
70
|
+
command: bin/bundle check --path vendor/bundle || bin/bundle install --deployment
|
71
|
+
|
72
|
+
- save_cache:
|
73
|
+
name: Save Bundler Cache
|
74
|
+
paths:
|
75
|
+
- ./vendor/bundle
|
76
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
77
|
+
|
78
|
+
- run: bin/rails db:schema:load
|
79
|
+
- run: bin/rails test
|
80
|
+
|
81
|
+
# collect reports
|
82
|
+
- store_test_results:
|
83
|
+
path: ./test/reports/
|
84
|
+
- store_artifacts:
|
85
|
+
path: ./coverage
|
86
|
+
lint:
|
87
|
+
docker:
|
88
|
+
- image: circleci/ruby:2.6-stretch-node
|
89
|
+
environment:
|
90
|
+
DISABLE_SPRING: 1
|
91
|
+
BUNDLE_GEMFILE: Gemfile.tools
|
92
|
+
BUNDLE_JOBS: 3
|
93
|
+
BUNDLE_RETRY: 3
|
94
|
+
|
95
|
+
steps:
|
96
|
+
- checkout
|
97
|
+
|
98
|
+
- restore_cache:
|
99
|
+
keys:
|
100
|
+
- v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }}
|
101
|
+
- v1-tools-dependencies-
|
102
|
+
|
103
|
+
- run:
|
104
|
+
name: Install cmake for building pronto dependencies
|
105
|
+
command: sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources
|
106
|
+
|
107
|
+
- run:
|
108
|
+
name: Install Bundle Dependencies
|
109
|
+
command: bin/bundle check --path vendor/bundle-tools || bin/bundle install --path vendor/bundle-tools
|
110
|
+
|
111
|
+
- run:
|
112
|
+
name: Install Node Packages
|
113
|
+
command: bin/yarn
|
114
|
+
|
115
|
+
- save_cache:
|
116
|
+
key: v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }}
|
117
|
+
paths:
|
118
|
+
- ./vendor/bundle-tools
|
119
|
+
- ./node_modules
|
120
|
+
|
121
|
+
- run: bin/lint-github-pr
|
122
|
+
|
123
|
+
upgrade_tools:
|
124
|
+
docker:
|
125
|
+
- image: circleci/ruby:2.6-stretch-node
|
126
|
+
environment:
|
127
|
+
DISABLE_SPRING: 1
|
128
|
+
BUNDLE_GEMFILE: Gemfile.tools
|
129
|
+
BUNDLE_JOBS: 3
|
130
|
+
BUNDLE_RETRY: 3
|
131
|
+
|
132
|
+
steps:
|
133
|
+
- checkout
|
134
|
+
|
135
|
+
- run:
|
136
|
+
name: Install Bundler
|
137
|
+
command: |
|
138
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.tools.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
139
|
+
source $BASH_ENV
|
140
|
+
gem install bundler:$BUNDLER_VERSION
|
141
|
+
|
142
|
+
- run: sudo apt-get install cmake
|
143
|
+
|
144
|
+
- run:
|
145
|
+
name: Run Gemfile tools update in separate branch
|
146
|
+
command: |
|
147
|
+
./bin/circleci-auto_upgrade_tools
|
148
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
version: 1
|
2
|
+
update_configs:
|
3
|
+
# Keep package.json (& lockfiles) up to date as soon as
|
4
|
+
# new versions are published to the npm registry
|
5
|
+
- package_manager: javascript
|
6
|
+
directory: /
|
7
|
+
update_schedule: weekly
|
8
|
+
allowed_updates:
|
9
|
+
- match:
|
10
|
+
dependency_type: development
|
11
|
+
update_type: all
|
12
|
+
- match:
|
13
|
+
dependency_type: production
|
14
|
+
update_type: security
|
15
|
+
version_requirement_updates: off
|
16
|
+
-
|
17
|
+
- package_manager: ruby:bundler
|
18
|
+
directory: /
|
19
|
+
update_schedule: weekly
|
20
|
+
allowed_updates:
|
21
|
+
- match:
|
22
|
+
dependency_type: all
|
23
|
+
update_type: all
|
24
|
+
automerged_updates:
|
25
|
+
- match:
|
26
|
+
dependency_name: puma
|
27
|
+
update_type: semver:minor
|
28
|
+
- match:
|
29
|
+
dependency_name: rspec*
|
30
|
+
- match:
|
31
|
+
dependency_name: capybara*
|
32
|
+
version_requirement_updates: off
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
detectors:
|
3
|
+
IrresponsibleModule:
|
4
|
+
enabled: false
|
5
|
+
UncommunicativeVariableName:
|
6
|
+
accept:
|
7
|
+
- e
|
8
|
+
NestedIterators:
|
9
|
+
exclude:
|
10
|
+
- "ActiveJob::TestHelper#enqueued_jobs_for"
|
11
|
+
UnusedPrivateMethod:
|
12
|
+
enabled: false
|
13
|
+
DuplicateMethodCall:
|
14
|
+
max_calls: 4
|
15
|
+
|
16
|
+
directories:
|
17
|
+
"**/app/controllers/**":
|
18
|
+
InstanceVariableAssumption:
|
19
|
+
enabled: false
|
20
|
+
UtilityFunction:
|
21
|
+
enabled: false
|
22
|
+
"**/app/jobs":
|
23
|
+
UtilityFunction:
|
24
|
+
enabled: false
|
25
|
+
"**/app/helpers":
|
26
|
+
UtilityFunction:
|
27
|
+
enabled: false
|
28
|
+
"**/spec":
|
29
|
+
UtilityFunction:
|
30
|
+
enabled: false
|
data/lib/install/.rubocop.yml
CHANGED
@@ -4,23 +4,20 @@ require:
|
|
4
4
|
- rubocop-rails
|
5
5
|
|
6
6
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.6
|
7
|
+
TargetRubyVersion: 2.6
|
8
8
|
Exclude:
|
9
9
|
- 'db/schema.rb'
|
10
10
|
- 'db/migrate/**/*'
|
11
11
|
|
12
|
-
Layout/AlignHash:
|
13
|
-
EnforcedHashRocketStyle: key
|
14
|
-
EnforcedColonStyle: key
|
15
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
16
|
-
|
17
|
-
Layout/AlignParameters:
|
18
|
-
EnforcedStyle: with_fixed_indentation
|
19
|
-
|
20
12
|
Layout/EmptyLinesAroundBlockBody:
|
21
13
|
Exclude:
|
22
14
|
- 'db/schema.rb'
|
23
15
|
|
16
|
+
Layout/HashAlignment:
|
17
|
+
EnforcedHashRocketStyle: key
|
18
|
+
EnforcedColonStyle: key
|
19
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
20
|
+
|
24
21
|
Layout/MultilineOperationIndentation:
|
25
22
|
EnforcedStyle: indented
|
26
23
|
|
@@ -33,6 +30,9 @@ Layout/MultilineMethodCallBraceLayout:
|
|
33
30
|
Layout/SpaceInLambdaLiteral:
|
34
31
|
EnforcedStyle: require_space
|
35
32
|
|
33
|
+
Layout/ParameterAlignment:
|
34
|
+
EnforcedStyle: with_fixed_indentation
|
35
|
+
|
36
36
|
Naming/PredicateName:
|
37
37
|
Exclude:
|
38
38
|
- 'app/helpers/application_helper.rb'
|
data/lib/install/Gemfile.tools
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
git_source(:github) do |repo_name|
|
4
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?(
|
6
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
5
7
|
"https://github.com/#{repo_name}.git"
|
6
8
|
end
|
7
9
|
|
8
|
-
gem 'hub', require: false
|
9
10
|
gem 'oj', require: false
|
10
11
|
|
11
12
|
group :tools do
|
@@ -21,6 +22,4 @@ group :tools do
|
|
21
22
|
|
22
23
|
gem 'rubocop-rails', require: false
|
23
24
|
gem 'rubocop-performance', require: false
|
24
|
-
|
25
|
-
gem 'rugged', '0.28.2'
|
26
25
|
end
|
data/lib/install/app.json
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
echo "-----Create and switch to new branch-----"
|
6
|
+
|
7
|
+
current_date=`date +"%Y%m%d%H%M"`
|
8
|
+
new_branch_name="auto-upgrade-tools-dependencies-${current_date}"
|
9
|
+
git checkout -b $new_branch_name
|
10
|
+
|
11
|
+
echo "-----Run Gemfile.tools update-----"
|
12
|
+
|
13
|
+
if bin/tools-upgrade; then
|
14
|
+
echo 'Updated successfully'
|
15
|
+
|
16
|
+
git config user.name "jt-tools-deployments"
|
17
|
+
git config user.email "circleci.bot@example.com"
|
18
|
+
|
19
|
+
git commit -am "Upgrades Gemfile.tools dependencies"
|
20
|
+
git push https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git -f
|
21
|
+
|
22
|
+
curl -X POST \
|
23
|
+
-H "Authorization: token ${GITHUB_TOKEN}" \
|
24
|
+
-d '{"title":"Upgrade tools dependencies","base":"master","head":"'$CIRCLE_PROJECT_USERNAME':'$new_branch_name'"}' \
|
25
|
+
https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls
|
26
|
+
exit 0
|
27
|
+
else
|
28
|
+
echo 'Failed to update\n'
|
29
|
+
exit 1
|
30
|
+
fi
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Run updates on new changes
|
4
|
+
branch_name=$(git branch | grep "*" | sed "s/\* //")
|
5
|
+
reflog_message=$(git reflog -1)
|
6
|
+
merged_branch_name=$(echo $reflog_message | cut -d" " -f 4 | sed "s/://")
|
7
|
+
|
8
|
+
# if the merge was caused by a "git pull", we can safely ignore it
|
9
|
+
if [[ $reflog_message =~ "merge" ]]; then
|
10
|
+
echo "We support only pull"
|
11
|
+
exit 0
|
12
|
+
fi
|
13
|
+
|
14
|
+
if [[ $branch_name == "master" ]]; then
|
15
|
+
bin/update
|
16
|
+
bin/rake db:reset
|
17
|
+
|
18
|
+
# For crystalball gem usage
|
19
|
+
# file=tmp/crystalball_data.yml
|
20
|
+
# find $file -mtime +5 -exec rm {} \;
|
21
|
+
#
|
22
|
+
# if [ ! -f "$file" ]; then
|
23
|
+
# echo "Generete crystall ball index"
|
24
|
+
# DISABLE_SPRING=1 CRYSTALBALL=true bin/rspec
|
25
|
+
# fi
|
26
|
+
|
27
|
+
echo "Removing merged branches..."
|
28
|
+
git branch --merged master | grep -v "\*" | grep -v master | xargs -n 1 git branch -d
|
29
|
+
fi
|
@@ -7,8 +7,7 @@ reporters_opt=""
|
|
7
7
|
if [[ "$CIRCLECI" == "true" ]]
|
8
8
|
then
|
9
9
|
git fetch origin master
|
10
|
-
reporters_opt="-f github_status github_pr_review
|
10
|
+
reporters_opt="-f github_status github_pr_review"
|
11
11
|
fi
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
bin/pronto run -c origin/master $reporters_opt --exit-code $@
|
data/lib/install/bin/tools-setup
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
set -e
|
4
|
+
|
5
|
+
export BUNDLE_GEMFILE=Gemfile.tools
|
6
|
+
|
7
|
+
bundle check || bundle install --jobs=4 --retry=3
|
8
|
+
|
9
|
+
yarn install --link-duplicates --non-interactive
|
data/lib/jt_tools.rb
CHANGED
data/lib/tasks/install.rake
CHANGED
data/lib/version.rb
CHANGED
data/rejuvenation.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
EXTRACT_DEPENDENCY_NAME = /"?(.+?)@.+?"?(?:,\s+|\Z)/.freeze
|
5
|
+
EXTRACT_DEPENDENCY_DETAILS = /(^((?!= ).*?):\n.*?(?:\n\n|\Z))/m.freeze
|
6
|
+
|
7
|
+
def direct_dependencies_names
|
8
|
+
package_json = JSON.parse(File.open('package.json').read)
|
9
|
+
direct_dependencies = package_json.fetch_values('dependencies', 'devDependencies', 'peerDependencies') { }
|
10
|
+
direct_dependencies.compact.inject([]) { |memo, v| memo.concat(v.keys) }
|
11
|
+
end
|
12
|
+
|
13
|
+
@dependencies = direct_dependencies_names
|
14
|
+
|
15
|
+
yarn_lock_content = File.open('yarn.lock').read
|
16
|
+
yarn_lock_content.scan(EXTRACT_DEPENDENCY_DETAILS).each do |dependency_block|
|
17
|
+
direct_dep = @dependencies.include?(dependency_block[1].match(EXTRACT_DEPENDENCY_NAME).to_a[1])
|
18
|
+
puts dependency_block[0] if direct_dep
|
19
|
+
end
|
data/template.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copied from: https://github.com/mattbrictson/rails-template
|
4
|
+
# Add this template directory to source_paths so that Thor actions like
|
5
|
+
# copy_file and template resolve against our source files. If this file was
|
6
|
+
# invoked remotely via HTTP, that means the files are not present locally.
|
7
|
+
# In that case, use `git clone` to download them to a local temporary dir.
|
8
|
+
def add_template_repository_to_source_path
|
9
|
+
if __FILE__.match?(%r{\Ahttps?://})
|
10
|
+
require 'shellwords'
|
11
|
+
require 'tmpdir'
|
12
|
+
|
13
|
+
source_paths.unshift(temp_dir = Dir.mktmpdir('jt_tools-'))
|
14
|
+
at_exit { FileUtils.remove_entry(temp_dir) }
|
15
|
+
git clone: [
|
16
|
+
'--quiet',
|
17
|
+
'https://github.com/jetthoughts/jt_tools.git',
|
18
|
+
temp_dir
|
19
|
+
].map { |args| Shellwords.escape(args) }
|
20
|
+
.join(' ')
|
21
|
+
|
22
|
+
if (branch = __FILE__[%r{jt_tools/(.+)/template.rb}, 1])
|
23
|
+
Dir.chdir(temp_dir) { git checkout: branch }
|
24
|
+
end
|
25
|
+
else
|
26
|
+
source_paths.unshift(__dir__)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
add_template_repository_to_source_path
|
31
|
+
|
32
|
+
say '=> Copying binstubs'
|
33
|
+
directory 'lib/install/bin', 'bin'
|
34
|
+
|
35
|
+
chmod 'bin', 0o755 & ~File.umask, verbose: false
|
36
|
+
|
37
|
+
say '=> Copying tools gemfile'
|
38
|
+
copy_file 'lib/install/Gemfile.tools', 'Gemfile.tools'
|
39
|
+
|
40
|
+
run 'yarn add -D eslint eslint-config-airbnb-base \
|
41
|
+
eslint-config-prettier eslint-plugin-import eslint-plugin-prettier prettier'
|
42
|
+
|
43
|
+
say 'Copying lint configurations'
|
44
|
+
copy_file 'lib/install/.better-html.yml', '.better-html.yml'
|
45
|
+
copy_file 'lib/install/.erb-lint.yml', '.erb-lint.yml'
|
46
|
+
copy_file 'lib/install/.eslintrc.js', '.eslintrc.js'
|
47
|
+
copy_file 'lib/install/.prettierrc.js', '.prettierrc.js'
|
48
|
+
copy_file 'lib/install/.pronto.yml', '.pronto.yml'
|
49
|
+
copy_file 'lib/install/.pronto_eslint_npm.yml', '.pronto_eslint_npm.yml'
|
50
|
+
copy_file 'lib/install/.rubocop.yml', '.rubocop.yml'
|
51
|
+
copy_file 'lib/install/.yamllint', '.yamllint'
|
52
|
+
copy_file 'lib/install/.reek.yml', '.reek.yml'
|
53
|
+
|
54
|
+
say '=> Copying services configuration'
|
55
|
+
gem 'simplecov', require: false, group: :test
|
56
|
+
|
57
|
+
copy_file 'lib/install/codecov.yml', 'codecov.yml'
|
58
|
+
gem 'codecov', require: false, group: :test
|
59
|
+
|
60
|
+
directory 'lib/install/.circleci', '.circleci'
|
61
|
+
|
62
|
+
# Add helpers to setup Simplecov and codecov loading for tests
|
63
|
+
directory 'lib/install/lib/test', 'lib/test'
|
64
|
+
|
65
|
+
if File.read('Gemfile').include? 'rspec'
|
66
|
+
gem 'rspec_junit_formatter', require: false, group: :test
|
67
|
+
insert_into_file(
|
68
|
+
'spec/spec_helper.rb',
|
69
|
+
"require 'test/coverage'\n",
|
70
|
+
after: /\A/
|
71
|
+
)
|
72
|
+
else
|
73
|
+
gem 'minitest-ci', require: false, group: :test
|
74
|
+
insert_into_file(
|
75
|
+
'test/test_helper.rb',
|
76
|
+
"require 'test/coverage'\n",
|
77
|
+
after: /\A/
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
directory 'lib/install/.dependabot', '.dependabot'
|
82
|
+
|
83
|
+
say '=> Copying heroku configuration'
|
84
|
+
copy_file 'lib/install/app.json', 'app.json'
|
85
|
+
copy_file 'lib/install/Procfile', 'Procfile'
|
86
|
+
|
87
|
+
say '=> Install Brew dependencies'
|
88
|
+
copy_file 'lib/install/Brewfile', 'Brewfile'
|
89
|
+
|
90
|
+
say 'Setup git hooks'
|
91
|
+
directory 'lib/install/bin/git-hooks', 'bin/git-hooks'
|
92
|
+
|
93
|
+
require 'bundler'
|
94
|
+
Bundler.with_original_env do
|
95
|
+
say '=> Install tools'
|
96
|
+
run 'bin/tools-setup'
|
97
|
+
|
98
|
+
say '=> Generate binstubs for linters'
|
99
|
+
run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub pronto'
|
100
|
+
run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub rubocop'
|
101
|
+
end
|
102
|
+
|
103
|
+
say '=> Set git hooks'
|
104
|
+
run 'git config core.hooksPath ./bin/git-hooks'
|
105
|
+
|
106
|
+
say '=> Install all new dependencies'
|
107
|
+
run <<~BREW_INSTALL
|
108
|
+
hash brew 2> /dev/null \
|
109
|
+
&& (brew bundle check || brew bundle install) \
|
110
|
+
|| echo "Please install Homebrew: https://brew.sh/"
|
111
|
+
BREW_INSTALL
|
112
|
+
|
113
|
+
after_bundle do
|
114
|
+
say '=> Setup default bundle config'
|
115
|
+
run 'bundle config jobs 4'
|
116
|
+
run 'bundle config retry 3'
|
117
|
+
end
|
118
|
+
|
119
|
+
say '**************************************************************************'
|
120
|
+
say '**************************************************************************'
|
121
|
+
say ''
|
122
|
+
say 'For code coverage report aggregator, running code static analysis'
|
123
|
+
say 'and auto-update of the tools.'
|
124
|
+
say ''
|
125
|
+
say 'Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
|
126
|
+
say 'environment variables in CircleCI and your local env'
|
127
|
+
say ''
|
128
|
+
say '**************************************************************************'
|
129
|
+
say '**************************************************************************'
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Keen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -31,44 +31,53 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- ".
|
35
|
-
- ".
|
34
|
+
- ".circleci/config.yml"
|
35
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
36
|
+
- ".github/ISSUE_TEMPLATE/custom.md"
|
37
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
36
38
|
- ".gitignore"
|
37
|
-
- ".pronto.yml"
|
38
|
-
- ".pronto_eslint_npm.yml"
|
39
|
-
- ".rubocop.yml"
|
40
|
-
- ".yamllint"
|
41
39
|
- Gemfile
|
42
40
|
- LICENSE
|
43
41
|
- LICENSE.txt
|
44
42
|
- README.md
|
45
43
|
- Rakefile
|
44
|
+
- _config.yml
|
46
45
|
- _sample/test_erb.html.erb
|
47
46
|
- _sample/test_eslint.js
|
48
47
|
- _sample/test_yamlint.yml
|
48
|
+
- bin/test
|
49
49
|
- jt_tools.gemspec
|
50
50
|
- lib/install/.better-html.yml
|
51
|
-
- lib/install/.circleci/config.yml
|
51
|
+
- lib/install/.circleci/config.yml.sample
|
52
|
+
- lib/install/.dependabot/config.yml
|
52
53
|
- lib/install/.erb-lint.yml
|
53
54
|
- lib/install/.eslintrc.js
|
54
|
-
- lib/install/.prettierrc
|
55
|
+
- lib/install/.prettierrc.js
|
55
56
|
- lib/install/.pronto.yml
|
56
57
|
- lib/install/.pronto_eslint_npm.yml
|
58
|
+
- lib/install/.reek.yml
|
57
59
|
- lib/install/.rubocop.yml
|
58
60
|
- lib/install/.yamllint
|
61
|
+
- lib/install/Brewfile
|
59
62
|
- lib/install/Gemfile.tools
|
60
63
|
- lib/install/Procfile
|
61
64
|
- lib/install/app.json
|
65
|
+
- lib/install/bin/circleci-auto_upgrade_tools
|
66
|
+
- lib/install/bin/git-hooks/post-merge.sample
|
67
|
+
- lib/install/bin/git-hooks/pre-push.sample
|
62
68
|
- lib/install/bin/heroku-postdeploy
|
63
69
|
- lib/install/bin/heroku-release
|
64
70
|
- lib/install/bin/lint-github-pr
|
65
71
|
- lib/install/bin/tools-setup
|
66
72
|
- lib/install/bin/tools-upgrade
|
67
|
-
- lib/install/
|
73
|
+
- lib/install/codecov.yml
|
74
|
+
- lib/install/lib/test/coverage.rb
|
68
75
|
- lib/jt_tools.rb
|
69
76
|
- lib/jt_tools/railtie.rb
|
70
77
|
- lib/tasks/install.rake
|
71
78
|
- lib/version.rb
|
79
|
+
- rejuvenation.rb
|
80
|
+
- template.rb
|
72
81
|
homepage: https://jtway.co
|
73
82
|
licenses:
|
74
83
|
- MIT
|
@@ -91,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
100
|
- !ruby/object:Gem::Version
|
92
101
|
version: '0'
|
93
102
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.1.1
|
95
104
|
signing_key:
|
96
105
|
specification_version: 4
|
97
106
|
summary: Setup development scripts to manage code base effectively
|
data/.better-html.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.better-html.yml
|
data/.erb-lint.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.erb-lint.yml
|
data/.pronto.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.pronto.yml
|
data/.pronto_eslint_npm.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.pronto_eslint_npm.yml
|
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.rubocop.yml
|
data/.yamllint
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./lib/install/.yamllint
|
data/lib/install/.prettierrc
DELETED
data/lib/install/template.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
say 'Copying binstubs'
|
4
|
-
directory "#{__dir__}/bin", 'bin'
|
5
|
-
|
6
|
-
chmod 'bin', 0o755 & ~File.umask, verbose: false
|
7
|
-
|
8
|
-
say 'Setup default bundle parallel jobs to 4'
|
9
|
-
run 'bundle config jobs 4'
|
10
|
-
|
11
|
-
say 'Copying tools gemfile'
|
12
|
-
copy_file "#{__dir__}/Gemfile.tools", 'Gemfile.tools'
|
13
|
-
|
14
|
-
run 'yarn add -D eslint eslint-config-airbnb-base \
|
15
|
-
eslint-config-prettier eslint-plugin-import eslint-plugin-prettier prettier'
|
16
|
-
|
17
|
-
run 'bin/tools-setup'
|
18
|
-
|
19
|
-
run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub pronto'
|
20
|
-
run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub rubocop'
|
21
|
-
|
22
|
-
say 'Copying lint configurations'
|
23
|
-
|
24
|
-
copy_file "#{__dir__}/.better-html.yml", '.better-html.yml'
|
25
|
-
copy_file "#{__dir__}/.erb-lint.yml", '.erb-lint.yml'
|
26
|
-
copy_file "#{__dir__}/.eslintrc.js", '.eslintrc.js'
|
27
|
-
copy_file "#{__dir__}/.prettierrc", '.prettierrc'
|
28
|
-
copy_file "#{__dir__}/.pronto.yml", '.pronto.yml'
|
29
|
-
copy_file "#{__dir__}/.pronto_eslint_npm.yml", '.pronto_eslint_npm.yml'
|
30
|
-
copy_file "#{__dir__}/.rubocop.yml", '.rubocop.yml'
|
31
|
-
copy_file "#{__dir__}/.yamllint", '.yamllint'
|
32
|
-
|
33
|
-
say 'Copying circleci configuration'
|
34
|
-
directory "#{__dir__}/.circleci", '.circleci'
|
35
|
-
|
36
|
-
say 'Copying heroku configuration'
|
37
|
-
copy_file "#{__dir__}/app.json", 'app.json'
|
38
|
-
copy_file "#{__dir__}/Procfile", 'Procfile'
|