review-tools 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +107 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/analyze_coverage.rb +53 -0
- data/bin/check-and-test.sh +45 -0
- data/bin/common-functions.sh +28 -0
- data/bin/console +14 -0
- data/bin/git-checkout-target-branches.sh +35 -0
- data/bin/prepare-rails-and-frontend.sh +47 -0
- data/bin/run_review.sh +46 -0
- data/bin/setup +8 -0
- data/lib/review/tools.rb +8 -0
- data/lib/review/tools/version.rb +5 -0
- data/review-tools.gemspec +34 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f1a468178442d00ccf5df1326e87ae3f0313c86cd6ab348d081f5e7e471ddbb
|
4
|
+
data.tar.gz: '084a80737a9d32e9065232c6c987d53f0292d2b934187cfc28b35078e96a5c71'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75014be81e4f4025f41310ccc68f70e39963a1d26e93cfb947749aa6620da71a401892a213b989d4031d8d5f699b3b44dfd7f6abed0cee425f009f6a887cf1d1
|
7
|
+
data.tar.gz: 9df1bb2d29e007ecb42781e951d86a1243604e036b84045141c7341b9b1867d88b49698513961623069d3c1073ef788b80b006b32e856d5f97b10d4bd7903d5e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at hgwrsgr@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
source "https://rubygems.org"
|
3
|
+
|
4
|
+
git_source(:github) do |repo_name|
|
5
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
6
|
+
"https://github.com/#{repo_name}.git"
|
7
|
+
end
|
8
|
+
|
9
|
+
gem 'nokogiri'
|
10
|
+
|
11
|
+
group :development, :test do
|
12
|
+
gem 'byebug', platform: :mri
|
13
|
+
gem 'pry-byebug'
|
14
|
+
gem 'pronto'
|
15
|
+
gem 'pronto-flay', require: false
|
16
|
+
gem 'pronto-rubocop', require: false
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.6.0)
|
5
|
+
public_suffix (>= 2.0.2, < 4.0)
|
6
|
+
ast (2.4.0)
|
7
|
+
byebug (11.0.1)
|
8
|
+
coderay (1.1.2)
|
9
|
+
diff-lcs (1.3)
|
10
|
+
erubis (2.7.0)
|
11
|
+
faraday (0.15.4)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
flay (2.12.0)
|
14
|
+
erubis (~> 2.7.0)
|
15
|
+
path_expander (~> 1.0)
|
16
|
+
ruby_parser (~> 3.0)
|
17
|
+
sexp_processor (~> 4.0)
|
18
|
+
gitlab (4.12.0)
|
19
|
+
httparty (~> 0.14, >= 0.14.0)
|
20
|
+
terminal-table (~> 1.5, >= 1.5.1)
|
21
|
+
httparty (0.17.0)
|
22
|
+
mime-types (~> 3.0)
|
23
|
+
multi_xml (>= 0.5.2)
|
24
|
+
jaro_winkler (1.5.3)
|
25
|
+
method_source (0.9.2)
|
26
|
+
mime-types (3.2.2)
|
27
|
+
mime-types-data (~> 3.2015)
|
28
|
+
mime-types-data (3.2019.0331)
|
29
|
+
mini_portile2 (2.4.0)
|
30
|
+
multi_xml (0.6.0)
|
31
|
+
multipart-post (2.1.1)
|
32
|
+
nokogiri (1.10.4)
|
33
|
+
mini_portile2 (~> 2.4.0)
|
34
|
+
octokit (4.14.0)
|
35
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
36
|
+
parallel (1.17.0)
|
37
|
+
parser (2.6.3.0)
|
38
|
+
ast (~> 2.4.0)
|
39
|
+
path_expander (1.0.4)
|
40
|
+
pronto (0.10.0)
|
41
|
+
gitlab (~> 4.0, >= 4.0.0)
|
42
|
+
httparty (>= 0.13.7)
|
43
|
+
octokit (~> 4.7, >= 4.7.0)
|
44
|
+
rainbow (>= 2.2, < 4.0)
|
45
|
+
rugged (~> 0.24, >= 0.23.0)
|
46
|
+
thor (~> 0.20.0)
|
47
|
+
pronto-flay (0.10.0)
|
48
|
+
flay (~> 2.8)
|
49
|
+
pronto (~> 0.10.0)
|
50
|
+
pronto-rubocop (0.10.0)
|
51
|
+
pronto (~> 0.10.0)
|
52
|
+
rubocop (~> 0.50, >= 0.49.1)
|
53
|
+
pry (0.12.2)
|
54
|
+
coderay (~> 1.1.0)
|
55
|
+
method_source (~> 0.9.0)
|
56
|
+
pry-byebug (3.7.0)
|
57
|
+
byebug (~> 11.0)
|
58
|
+
pry (~> 0.10)
|
59
|
+
public_suffix (3.1.1)
|
60
|
+
rainbow (3.0.0)
|
61
|
+
rspec (3.8.0)
|
62
|
+
rspec-core (~> 3.8.0)
|
63
|
+
rspec-expectations (~> 3.8.0)
|
64
|
+
rspec-mocks (~> 3.8.0)
|
65
|
+
rspec-core (3.8.2)
|
66
|
+
rspec-support (~> 3.8.0)
|
67
|
+
rspec-expectations (3.8.4)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.8.0)
|
70
|
+
rspec-mocks (3.8.1)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.8.0)
|
73
|
+
rspec-support (3.8.2)
|
74
|
+
rubocop (0.74.0)
|
75
|
+
jaro_winkler (~> 1.5.1)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 2.6)
|
78
|
+
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
ruby-progressbar (~> 1.7)
|
80
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
81
|
+
ruby-progressbar (1.10.1)
|
82
|
+
ruby_parser (3.13.1)
|
83
|
+
sexp_processor (~> 4.9)
|
84
|
+
rugged (0.28.3.1)
|
85
|
+
sawyer (0.8.2)
|
86
|
+
addressable (>= 2.3.5)
|
87
|
+
faraday (> 0.8, < 2.0)
|
88
|
+
sexp_processor (4.12.1)
|
89
|
+
terminal-table (1.8.0)
|
90
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
91
|
+
thor (0.20.3)
|
92
|
+
unicode-display_width (1.6.0)
|
93
|
+
|
94
|
+
PLATFORMS
|
95
|
+
ruby
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
byebug
|
99
|
+
nokogiri
|
100
|
+
pronto
|
101
|
+
pronto-flay
|
102
|
+
pronto-rubocop
|
103
|
+
pry-byebug
|
104
|
+
rspec
|
105
|
+
|
106
|
+
BUNDLED WITH
|
107
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Shigeru Hagiwara
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Review::Tools
|
2
|
+
|
3
|
+
This is a tool that automates the review of pull requests for Rails project on GitHub.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'review-tools', require: false, group: :development
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install review-tools
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
1. See the pull request page on GitHub. You will see like these lines.
|
24
|
+
|
25
|
+
> ### add some cool features #2
|
26
|
+
>
|
27
|
+
> **Open** hgwr wants to merge 4 commits into master from dev
|
28
|
+
|
29
|
+
2. Copy `into master from dev` and paste like `run_review.sh into master from dev` to terminal.
|
30
|
+
|
31
|
+
3. Then, `run_review.sh into master from dev` executes these operaitons.
|
32
|
+
|
33
|
+
- `git checkout ...`
|
34
|
+
- Preparing environments. (e.g. Database migrations)
|
35
|
+
- Run tests
|
36
|
+
- If you are using simplecov, you can see coverages of modified files.
|
37
|
+
|
38
|
+
## Customization
|
39
|
+
|
40
|
+
You can put custom shell scripts in `~/.config/review-tools.yml`.
|
41
|
+
|
42
|
+
For example:
|
43
|
+
|
44
|
+
```
|
45
|
+
additional_preparation: |
|
46
|
+
rm -rf node_modules && yarn
|
47
|
+
|
48
|
+
additional_db_preparation: |
|
49
|
+
bundle exec bin/rails db:some:your:task
|
50
|
+
|
51
|
+
additional_test_tasks: |
|
52
|
+
eslint app/assets/javascripts/**/*
|
53
|
+
```
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hgwr/review-tools.
|
58
|
+
This project is intended to be a safe, welcoming space for collaboration,
|
59
|
+
and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
64
|
+
|
65
|
+
## Code of Conduct
|
66
|
+
|
67
|
+
Everyone interacting in the Review::Tools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hgwr/review-tools/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
# require 'pry'
|
5
|
+
|
6
|
+
unless File.exist?('coverage/index.html')
|
7
|
+
warn 'Error: coverage/index.html dose not exist.'
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
html_doc = File.open('coverage/index.html') { |f| Nokogiri::HTML(f) }
|
12
|
+
|
13
|
+
if ARGV.length != 4 || ARGV[0] != 'into' || ARGV[2] != 'from'
|
14
|
+
warn 'Usage: analyze_coverage.rb into milestone/abc from feature/cde'
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
dst_branch = ARGV[1]
|
19
|
+
src_branch = ARGV[3]
|
20
|
+
|
21
|
+
`git diff --name-only #{dst_branch}..#{src_branch}`.split("\n").each do |file_name|
|
22
|
+
|
23
|
+
next unless file_name =~ /\.rb\z/
|
24
|
+
|
25
|
+
a_tags = html_doc.css(%Q(a[title="#{file_name}"]))
|
26
|
+
|
27
|
+
puts "\n========== #{file_name} =========="
|
28
|
+
if a_tags.length == 0
|
29
|
+
puts " no results"
|
30
|
+
next
|
31
|
+
end
|
32
|
+
|
33
|
+
file_id = a_tags.first['href'].sub(/^#/, '')
|
34
|
+
|
35
|
+
source_tables = html_doc.css("div.source_table\##{file_id}")
|
36
|
+
|
37
|
+
coverage_rate = source_tables.css('div.header h4 span').text.strip
|
38
|
+
puts "rate #{coverage_rate}"
|
39
|
+
|
40
|
+
source_tables.css('li').each do |li|
|
41
|
+
linenumber = li['data-linenumber']
|
42
|
+
case li['class']
|
43
|
+
when 'missed'
|
44
|
+
printf '%05d x ', linenumber
|
45
|
+
when 'covered'
|
46
|
+
printf '%05d o ', linenumber
|
47
|
+
else
|
48
|
+
printf '%05d ? ', linenumber
|
49
|
+
end
|
50
|
+
puts li.css('code').text
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Usage: check-and-test.sh
|
4
|
+
#
|
5
|
+
# Example of ~/.config/review-tools.yml
|
6
|
+
#
|
7
|
+
# additional_test_tasks: |
|
8
|
+
# eslint app/assets/javascripts/**/*
|
9
|
+
#
|
10
|
+
|
11
|
+
set -o errexit
|
12
|
+
set -o pipefail
|
13
|
+
set -o nounset
|
14
|
+
set -o xtrace
|
15
|
+
|
16
|
+
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
|
17
|
+
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
|
18
|
+
|
19
|
+
script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
20
|
+
source "${script_dir}/common-functions.sh"
|
21
|
+
|
22
|
+
load_environment_variables test_environment_variables
|
23
|
+
|
24
|
+
mkdir -p log
|
25
|
+
cp /dev/null log/test.log
|
26
|
+
|
27
|
+
if [ `(grep 'pronto' Gemfile || true) | wc -l` -eq "1" ]; then
|
28
|
+
bundle exec pronto run
|
29
|
+
elif [ `(which pront || true) | wc -l` -eq "1" ]; then
|
30
|
+
pronto run
|
31
|
+
fi
|
32
|
+
|
33
|
+
if [ `(grep 'rspec' Gemfile || true) | wc -l` -eq "1" ]; then
|
34
|
+
bundle exec rspec spec
|
35
|
+
else
|
36
|
+
bundle exec rake test
|
37
|
+
fi
|
38
|
+
|
39
|
+
if [ `(grep 'rubocop' Gemfile || true) | wc -l` -eq "1" ]; then
|
40
|
+
bundle exec rubocop
|
41
|
+
elif [ `(which rubocop || true) | wc -l` -eq "1" ]; then
|
42
|
+
rubocop
|
43
|
+
fi
|
44
|
+
|
45
|
+
run_additional_task test_tasks
|
@@ -0,0 +1,28 @@
|
|
1
|
+
error_exit=1
|
2
|
+
success=0
|
3
|
+
|
4
|
+
function run_additional_task () {
|
5
|
+
task_name="$1"
|
6
|
+
if [ -f "${HOME}/.config/review-tools.yml" ]; then
|
7
|
+
additional_task=$(ruby -ryaml -e "conf = YAML.load_file(%Q(#{ENV['HOME']}/.config/review-tools.yml)); puts conf['$task_name']")
|
8
|
+
if [ "$additional_task" != "" ]; then
|
9
|
+
eval "$additional_task" || true
|
10
|
+
fi
|
11
|
+
fi
|
12
|
+
}
|
13
|
+
|
14
|
+
function load_environment_variables () {
|
15
|
+
run_additional_task "$1"
|
16
|
+
}
|
17
|
+
|
18
|
+
function show_notification () {
|
19
|
+
if [ -x /usr/bin/osascript ]; then
|
20
|
+
/usr/bin/osascript -e "display notification \"$2\" with title \"$1\""
|
21
|
+
else
|
22
|
+
echo "Notification: $1: $2" 1>&2
|
23
|
+
fi
|
24
|
+
|
25
|
+
if [ "$3" -gt "0" ]; then
|
26
|
+
exit $3
|
27
|
+
fi
|
28
|
+
}
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "review/tools"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Usage: git-checkout-target-branches.sh into milestone/abc from feature/cde
|
4
|
+
#
|
5
|
+
|
6
|
+
set -o errexit
|
7
|
+
set -o pipefail
|
8
|
+
set -o nounset
|
9
|
+
set -o xtrace
|
10
|
+
|
11
|
+
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
|
12
|
+
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
|
13
|
+
|
14
|
+
if [ $# -ne 4 ] || [ "$1" != "into" ] || [ "$3" != "from" ]; then
|
15
|
+
echo "Usage: git-checkout-target-branches.sh into milestone/abc from feature/cde" 1>&2
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
dst_branch="$2"
|
20
|
+
src_branch="$4"
|
21
|
+
|
22
|
+
if [ ! -d .git ]; then
|
23
|
+
echo "Error: no git repository" 1>&2
|
24
|
+
exit 1
|
25
|
+
fi
|
26
|
+
|
27
|
+
git checkout master
|
28
|
+
git fetch -a || true
|
29
|
+
git pull origin master
|
30
|
+
|
31
|
+
git checkout "$dst_branch"
|
32
|
+
git pull origin "$dst_branch"
|
33
|
+
|
34
|
+
git checkout "$src_branch"
|
35
|
+
git pull origin "$src_branch"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Usage: prepare-rails-and-frontend.sh
|
4
|
+
#
|
5
|
+
# Example of ~/.config/review-tools.yml
|
6
|
+
#
|
7
|
+
# additional_preparation: |
|
8
|
+
# rm -rf node_modules && yarn
|
9
|
+
#
|
10
|
+
# additional_db_preparation: |
|
11
|
+
# bundle exec bin/rails db:task:you:made
|
12
|
+
#
|
13
|
+
|
14
|
+
set -o errexit
|
15
|
+
set -o pipefail
|
16
|
+
set -o nounset
|
17
|
+
set -o xtrace
|
18
|
+
|
19
|
+
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
|
20
|
+
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
|
21
|
+
|
22
|
+
script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
23
|
+
source "${script_dir}/common-functions.sh"
|
24
|
+
|
25
|
+
if [ ! -d .git ]; then
|
26
|
+
echo "Error: no git repository" 1>&2
|
27
|
+
exit 1
|
28
|
+
fi
|
29
|
+
|
30
|
+
if [ -f .ruby-version ]; then
|
31
|
+
rbenv local `cat .ruby-version`
|
32
|
+
fi
|
33
|
+
bundle install --path vendor/bundle --jobs=4 --retry=3
|
34
|
+
|
35
|
+
run_additional_task preparation
|
36
|
+
|
37
|
+
if [ -x bin/rails ]; then
|
38
|
+
bundle exec bin/rails db:create
|
39
|
+
bundle exec bin/rails db:migrate
|
40
|
+
|
41
|
+
RAILS_ENV=test bundle exec bin/rails db:create
|
42
|
+
RAILS_ENV=test bundle exec bin/rails db:migrate
|
43
|
+
else
|
44
|
+
echo "Warning: no bin/rails command. So skiped db:migrate" 1>&2
|
45
|
+
fi
|
46
|
+
|
47
|
+
run_additional_task db_preparation
|
data/bin/run_review.sh
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Usage: run_review.sh into milestone/abc from feature/cde
|
4
|
+
#
|
5
|
+
|
6
|
+
set -o errexit
|
7
|
+
set -o pipefail
|
8
|
+
set -o nounset
|
9
|
+
set -o xtrace
|
10
|
+
|
11
|
+
script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
12
|
+
source "${script_dir}/common-functions.sh"
|
13
|
+
|
14
|
+
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
|
15
|
+
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
|
16
|
+
|
17
|
+
if [ $# -ne 4 ] || [ "$1" != "into" ] || [ "$3" != "from" ]; then
|
18
|
+
echo "Usage: git-checkout-target-branches.sh into milestone/abc from feature/cde" 1>&2
|
19
|
+
exit 1
|
20
|
+
fi
|
21
|
+
|
22
|
+
dst_branch="$2"
|
23
|
+
src_branch="$4"
|
24
|
+
|
25
|
+
mkdir -p ~/tmp
|
26
|
+
logifle=~/tmp/run_review_`date +'%Y%m%d-%H%M%S'`.log
|
27
|
+
|
28
|
+
(
|
29
|
+
"${script_dir}/git-checkout-target-branches.sh" into "$dst_branch" from "$src_branch" ||
|
30
|
+
show_notification "run_review.sh" "Failed: git-checkout-target-branches.sh" $error_exit
|
31
|
+
|
32
|
+
"${script_dir}/prepare-rails-and-frontend.sh" ||
|
33
|
+
show_notification "run_review.sh" "Failed: prepare-rails-and-frontend.sh" $error_exit
|
34
|
+
|
35
|
+
"${script_dir}/check-and-test.sh" ||
|
36
|
+
show_notification "run_review.sh" "Failed: check-and-test.sh" $error_exit
|
37
|
+
|
38
|
+
if [ -r 'coverage/index.html' ]; then
|
39
|
+
"${script_dir}/analyze_coverage.rb" into "$dst_branch" from "$src_branch"
|
40
|
+
fi
|
41
|
+
|
42
|
+
) 2>&1 | tee "$logifle"
|
43
|
+
|
44
|
+
show_notification "run_review.sh" "All tasks completed." $success
|
45
|
+
|
46
|
+
/usr/bin/less -R $logifle
|
data/bin/setup
ADDED
data/lib/review/tools.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'review/tools/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'review-tools'
|
7
|
+
spec.version = Review::Tools::VERSION
|
8
|
+
spec.authors = ['Shigeru Hagiwara']
|
9
|
+
spec.email = ['hgwrsgr@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = %q(This is a tool that automates the review of pull requests for Rails project on GitHub.)
|
12
|
+
spec.description = %q(This is a tool that automates the review of pull requests for Rails project on GitHub.)
|
13
|
+
spec.homepage = 'https://rubygems.org/gems/review-tools'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/hgwr/review-tools/'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/hgwr/review-tools/'
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = %w(lib)
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.10.4'
|
30
|
+
|
31
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: review-tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shigeru Hagiwara
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.10.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.10.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: This is a tool that automates the review of pull requests for Rails project
|
70
|
+
on GitHub.
|
71
|
+
email:
|
72
|
+
- hgwrsgr@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".ruby-version"
|
80
|
+
- ".travis.yml"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- Gemfile.lock
|
84
|
+
- LICENSE.txt
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- bin/analyze_coverage.rb
|
88
|
+
- bin/check-and-test.sh
|
89
|
+
- bin/common-functions.sh
|
90
|
+
- bin/console
|
91
|
+
- bin/git-checkout-target-branches.sh
|
92
|
+
- bin/prepare-rails-and-frontend.sh
|
93
|
+
- bin/run_review.sh
|
94
|
+
- bin/setup
|
95
|
+
- lib/review/tools.rb
|
96
|
+
- lib/review/tools/version.rb
|
97
|
+
- review-tools.gemspec
|
98
|
+
homepage: https://rubygems.org/gems/review-tools
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata:
|
102
|
+
homepage_uri: https://rubygems.org/gems/review-tools
|
103
|
+
source_code_uri: https://github.com/hgwr/review-tools/
|
104
|
+
changelog_uri: https://github.com/hgwr/review-tools/
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubygems_version: 3.0.3
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: This is a tool that automates the review of pull requests for Rails project
|
124
|
+
on GitHub.
|
125
|
+
test_files: []
|