review-tools 0.1.4 → 0.1.6

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: 9e8c00d2fda28874469e81b072c8b674551207c15c2cd26b185a44c50939cbfb
4
- data.tar.gz: 1963e00c644ff8464962e32e38cd606ee9925f57b9a2f3dd137546e6798feddf
3
+ metadata.gz: a35696c465254cd6de8c5bac93b7c291f96086e27b2581d07dcd1696353eb4d4
4
+ data.tar.gz: 30c55b1b9b5b40b586140a12ec3576dc35e15d878a8849f0786c914698507599
5
5
  SHA512:
6
- metadata.gz: c68ea3044becaa080e98da48be833c522985495557a5d74a2b7498681e845c03d37882d7ffdc9af58c495791449f45ce73a9aedf0d45a18625f6628d1884c339
7
- data.tar.gz: d79f80afd6b95247ac36ad84a2daf34425005a4ffc0f294538023d560d300abf335c225ad77ef60541c0a055e3bc748ec7a733b86fb8a726e2559617b84e45a1
6
+ metadata.gz: 017dc06a9697b3781fb3aa0e58e61ef2547e0f6102fbfa2d80e30a6b59e51d0a9433c9664d3e43bd7c2a43e530769b98e7602f79015d66a936db5ff22acf41a6
7
+ data.tar.gz: e5275446d2d7a5d8a7c97a879fca69a43d9af27e4c9f6f0d921081d7a65839686e9b47ea295d6f0682bcf2b41cfe8b6cf71bc4e605c4aef6f2c59428a0d61455
data/Gemfile CHANGED
@@ -6,7 +6,9 @@ git_source(:github) do |repo_name|
6
6
  "https://github.com/#{repo_name}.git"
7
7
  end
8
8
 
9
- gem 'nokogiri'
9
+ gemspec
10
+
11
+ gem 'nokogiri', '~> 1.10.4'
10
12
 
11
13
  group :development, :test do
12
14
  gem 'rake', '~> 10.0'
data/Gemfile.lock CHANGED
@@ -1,8 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ review-tools (0.1.6)
5
+ nokogiri (~> 1.10.4)
6
+
1
7
  GEM
2
8
  remote: https://rubygems.org/
3
9
  specs:
4
- addressable (2.6.0)
5
- public_suffix (>= 2.0.2, < 4.0)
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
6
12
  ast (2.4.0)
7
13
  byebug (11.0.1)
8
14
  coderay (1.1.2)
@@ -18,14 +24,14 @@ GEM
18
24
  gitlab (4.12.0)
19
25
  httparty (~> 0.14, >= 0.14.0)
20
26
  terminal-table (~> 1.5, >= 1.5.1)
21
- httparty (0.17.0)
27
+ httparty (0.17.1)
22
28
  mime-types (~> 3.0)
23
29
  multi_xml (>= 0.5.2)
24
30
  jaro_winkler (1.5.3)
25
31
  method_source (0.9.2)
26
- mime-types (3.2.2)
32
+ mime-types (3.3)
27
33
  mime-types-data (~> 3.2015)
28
- mime-types-data (3.2019.0331)
34
+ mime-types-data (3.2019.0904)
29
35
  mini_portile2 (2.4.0)
30
36
  multi_xml (0.6.0)
31
37
  multipart-post (2.1.1)
@@ -34,9 +40,9 @@ GEM
34
40
  octokit (4.14.0)
35
41
  sawyer (~> 0.8.0, >= 0.5.3)
36
42
  parallel (1.17.0)
37
- parser (2.6.3.0)
43
+ parser (2.6.4.1)
38
44
  ast (~> 2.4.0)
39
- path_expander (1.0.4)
45
+ path_expander (1.1.0)
40
46
  pronto (0.10.0)
41
47
  gitlab (~> 4.0, >= 4.0.0)
42
48
  httparty (>= 0.13.7)
@@ -56,7 +62,7 @@ GEM
56
62
  pry-byebug (3.7.0)
57
63
  byebug (~> 11.0)
58
64
  pry (~> 0.10)
59
- public_suffix (3.1.1)
65
+ public_suffix (4.0.1)
60
66
  rainbow (3.0.0)
61
67
  rake (10.5.0)
62
68
  rspec (3.8.0)
@@ -80,13 +86,13 @@ GEM
80
86
  ruby-progressbar (~> 1.7)
81
87
  unicode-display_width (>= 1.4.0, < 1.7)
82
88
  ruby-progressbar (1.10.1)
83
- ruby_parser (3.13.1)
89
+ ruby_parser (3.14.0)
84
90
  sexp_processor (~> 4.9)
85
91
  rugged (0.28.3.1)
86
92
  sawyer (0.8.2)
87
93
  addressable (>= 2.3.5)
88
94
  faraday (> 0.8, < 2.0)
89
- sexp_processor (4.12.1)
95
+ sexp_processor (4.13.0)
90
96
  terminal-table (1.8.0)
91
97
  unicode-display_width (~> 1.1, >= 1.1.1)
92
98
  thor (0.20.3)
@@ -96,13 +102,15 @@ PLATFORMS
96
102
  ruby
97
103
 
98
104
  DEPENDENCIES
105
+ bundler (~> 2.0)
99
106
  byebug
100
- nokogiri
107
+ nokogiri (~> 1.10.4)
101
108
  pronto
102
109
  pronto-flay
103
110
  pronto-rubocop
104
111
  pry-byebug
105
112
  rake (~> 10.0)
113
+ review-tools!
106
114
  rspec
107
115
 
108
116
  BUNDLED WITH
data/README.md CHANGED
@@ -30,9 +30,9 @@ Or install it yourself as:
30
30
  >
31
31
  > **Open** hgwr wants to merge 4 commits into master from dev
32
32
 
33
- 2. Copy `into master from dev` and paste like `run_review.sh into master from dev` to terminal.
33
+ 2. Copy `into master from dev` and paste like `run_review into master from dev` to terminal.
34
34
 
35
- 3. Then, `run_review.sh into master from dev` executes these operaitons.
35
+ 3. Then, Run `run_review into master from dev`. It executes these operaitons.
36
36
 
37
37
  - `git checkout ...`
38
38
  - Preparing environments. (e.g. Database migrations)
@@ -53,7 +53,10 @@ additional_db_preparation: |
53
53
  bundle exec bin/rails db:some:your:task
54
54
 
55
55
  additional_test_tasks: |
56
- eslint app/assets/javascripts/**/*
56
+ if [ ! -z "${do_frontend_tst:-}" ]; then
57
+ npm test
58
+ eslint app/assets/javascripts/**/*
59
+ fi
57
60
  ```
58
61
 
59
62
  ## Contributing
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Usage: check-and-test.sh
3
+ # Usage: check_and_test.sh
4
4
  #
5
5
  # Example of ~/.config/review-tools.yml
6
6
  #
@@ -17,28 +17,28 @@ trap 'echo "Ctrl-C captured and exit."; exit 1' INT
17
17
  trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
18
18
 
19
19
  script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
20
- source "${script_dir}/common-functions.sh"
20
+ source "${script_dir}/common_functions.sh"
21
21
 
22
22
  load_environment_variables test_environment_variables
23
23
 
24
24
  mkdir -p log
25
25
  cp /dev/null log/test.log
26
26
 
27
- if [ `(grep 'pronto' Gemfile || true) | wc -l` -eq "1" ]; then
27
+ if [ `(grep 'pronto' Gemfile || true) | wc -l` -ge "1" ]; then
28
28
  bundle exec pronto run
29
- elif [ `(which pront || true) | wc -l` -eq "1" ]; then
29
+ elif [ `(which pront || true) | wc -l` -ge "1" ]; then
30
30
  pronto run
31
31
  fi
32
32
 
33
- if [ `(grep 'rspec' Gemfile || true) | wc -l` -eq "1" ]; then
33
+ if [ `(grep 'rspec' Gemfile || true) | wc -l` -ge "1" ]; then
34
34
  bundle exec rspec spec
35
35
  else
36
36
  bundle exec rake test
37
37
  fi
38
38
 
39
- if [ `(grep 'rubocop' Gemfile || true) | wc -l` -eq "1" ]; then
39
+ if [ `(grep 'rubocop' Gemfile || true) | wc -l` -ge "1" ]; then
40
40
  bundle exec rubocop
41
- elif [ `(which rubocop || true) | wc -l` -eq "1" ]; then
41
+ elif [ `(which rubocop || true) | wc -l` -ge "1" ]; then
42
42
  rubocop
43
43
  fi
44
44
 
File without changes
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Usage: git-checkout-target-branches.sh into milestone/abc from feature/cde
3
+ # Usage: git_checkout_target_branches.sh into milestone/abc from feature/cde
4
4
  #
5
5
 
6
6
  set -o errexit
@@ -12,7 +12,7 @@ trap 'echo "Ctrl-C captured and exit."; exit 1' INT
12
12
  trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
13
13
 
14
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
15
+ echo "Usage: git_checkout_target_branches into milestone/abc from feature/cde" 1>&2
16
16
  exit 1
17
17
  fi
18
18
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Usage: prepare-rails-and-frontend.sh
3
+ # Usage: prepare_rails_and_frontend.sh
4
4
  #
5
5
  # Example of ~/.config/review-tools.yml
6
6
  #
@@ -20,7 +20,7 @@ trap 'echo "Ctrl-C captured and exit."; exit 1' INT
20
20
  trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
21
21
 
22
22
  script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
23
- source "${script_dir}/common-functions.sh"
23
+ source "${script_dir}/common_functions.sh"
24
24
 
25
25
  if [ ! -d .git ]; then
26
26
  echo "Error: no git repository" 1>&2
data/bin/run_review.sh CHANGED
@@ -9,13 +9,13 @@ set -o nounset
9
9
  set -o xtrace
10
10
 
11
11
  script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
12
- source "${script_dir}/common-functions.sh"
12
+ source "${script_dir}/common_functions.sh"
13
13
 
14
14
  trap 'echo "Ctrl-C captured and exit."; exit 1' INT
15
15
  trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
16
16
 
17
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
18
+ echo "Usage: run_review into milestone/abc from feature/cde" 1>&2
19
19
  exit 1
20
20
  fi
21
21
 
@@ -26,17 +26,17 @@ mkdir -p ~/tmp
26
26
  logifle=~/tmp/run_review_`date +'%Y%m%d-%H%M%S'`.log
27
27
 
28
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
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
31
 
32
- "${script_dir}/prepare-rails-and-frontend.sh" ||
33
- show_notification "run_review.sh" "Failed: prepare-rails-and-frontend.sh" $error_exit
32
+ "${script_dir}/prepare_rails_and_frontend.sh" ||
33
+ show_notification "run_review.sh" "Failed: prepare_rails_and_frontend.sh" $error_exit
34
34
 
35
- "${script_dir}/check-and-test.sh" ||
36
- show_notification "run_review.sh" "Failed: check-and-test.sh" $error_exit
35
+ "${script_dir}/check_and_test.sh" ||
36
+ show_notification "run_review.sh" "Failed: check_and_test.sh" $error_exit
37
37
 
38
38
  if [ -r 'coverage/index.html' ]; then
39
- "${script_dir}/analyze_coverage.rb" into "$dst_branch" from "$src_branch"
39
+ "${script_dir}/analyze_coverage" into "$dst_branch" from "$src_branch"
40
40
  fi
41
41
 
42
42
  ) 2>&1 | tee "$logifle"
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'nokogiri'
4
- # require 'pry'
5
4
 
6
5
  unless File.exist?('coverage/index.html')
7
6
  warn 'Error: coverage/index.html dose not exist.'
@@ -11,7 +10,7 @@ end
11
10
  html_doc = File.open('coverage/index.html') { |f| Nokogiri::HTML(f) }
12
11
 
13
12
  if ARGV.length != 4 || ARGV[0] != 'into' || ARGV[2] != 'from'
14
- warn 'Usage: analyze_coverage.rb into milestone/abc from feature/cde'
13
+ warn 'Usage: analyze_coverage into milestone/abc from feature/cde'
15
14
  exit 1
16
15
  end
17
16
 
@@ -19,14 +18,13 @@ dst_branch = ARGV[1]
19
18
  src_branch = ARGV[3]
20
19
 
21
20
  `git diff --name-only #{dst_branch}..#{src_branch}`.split("\n").each do |file_name|
22
-
23
21
  next unless file_name =~ /\.rb\z/
24
22
 
25
- a_tags = html_doc.css(%Q(a[title="#{file_name}"]))
23
+ a_tags = html_doc.css(%(a[title="#{file_name}"]))
26
24
 
27
25
  puts "\n========== #{file_name} =========="
28
- if a_tags.length == 0
29
- puts " no results"
26
+ if a_tags.length.zero?
27
+ puts ' no results'
30
28
  next
31
29
  end
32
30
 
@@ -41,13 +39,12 @@ src_branch = ARGV[3]
41
39
  linenumber = li['data-linenumber']
42
40
  case li['class']
43
41
  when 'missed'
44
- printf '%05d x ', linenumber
42
+ printf '%06d x ', linenumber
45
43
  when 'covered'
46
- printf '%05d o ', linenumber
44
+ printf '%06d o ', linenumber
47
45
  else
48
- printf '%05d ? ', linenumber
46
+ printf '%06d ? ', linenumber
49
47
  end
50
48
  puts li.css('code').text
51
49
  end
52
-
53
50
  end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ bin_dir = File.expand_path('../bin/', File.dirname(__FILE__))
4
+ shell_script_path = File.join(bin_dir, 'check_and_test.sh')
5
+
6
+ `#{shell_script_path}`
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ bin_dir = File.expand_path('../bin/', File.dirname(__FILE__))
4
+ shell_script_path = File.join(bin_dir, 'git_checkout_target_branches.sh')
5
+
6
+ `#{shell_script_path} #{ARGV.join(' ')}`
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ bin_dir = File.expand_path('../bin/', File.dirname(__FILE__))
4
+ shell_script_path = File.join(bin_dir, 'prepare_rails_and_frontend.sh')
5
+
6
+ `#{shell_script_path}`
data/exe/run_review ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ bin_dir = File.expand_path('../bin/', File.dirname(__FILE__))
4
+ shell_script_path = File.join(bin_dir, 'run_review.sh')
5
+
6
+ `#{shell_script_path} #{ARGV.join(' ')}`
@@ -1,5 +1,5 @@
1
1
  module Review
2
2
  module Tools
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeru Hagiwara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-22 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -70,7 +70,12 @@ description: This is a tool that automates the review of pull requests for Rails
70
70
  on GitHub.
71
71
  email:
72
72
  - hgwrsgr@gmail.com
73
- executables: []
73
+ executables:
74
+ - analyze_coverage
75
+ - check_and_test
76
+ - git_checkout_target_branches
77
+ - prepare_rails_and_frontend
78
+ - run_review
74
79
  extensions: []
75
80
  extra_rdoc_files: []
76
81
  files:
@@ -84,14 +89,18 @@ files:
84
89
  - LICENSE.txt
85
90
  - README.md
86
91
  - Rakefile
87
- - bin/analyze_coverage.rb
88
- - bin/check-and-test.sh
89
- - bin/common-functions.sh
92
+ - bin/check_and_test.sh
93
+ - bin/common_functions.sh
90
94
  - bin/console
91
- - bin/git-checkout-target-branches.sh
92
- - bin/prepare-rails-and-frontend.sh
95
+ - bin/git_checkout_target_branches.sh
96
+ - bin/prepare_rails_and_frontend.sh
93
97
  - bin/run_review.sh
94
98
  - bin/setup
99
+ - exe/analyze_coverage
100
+ - exe/check_and_test
101
+ - exe/git_checkout_target_branches
102
+ - exe/prepare_rails_and_frontend
103
+ - exe/run_review
95
104
  - lib/review/tools.rb
96
105
  - lib/review/tools/version.rb
97
106
  - review-tools.gemspec