review-tools 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbfe8961b65acc4f5920b497f362e5749d0f249dd3a295377449ca7ca67ee8a8
4
- data.tar.gz: f44f4027a03dc00929c8999cd87ccc8520a873ecf017f146b093b428b835c2c2
3
+ metadata.gz: efa3ef4b9107dd04ee69430903e9dd07f2a6934ac18246ed81b664c7c45e53e2
4
+ data.tar.gz: f1fa973f98c0bd190c977b4f6f3436b9a61dd1a43d7f3698b1f56b91dfc7475a
5
5
  SHA512:
6
- metadata.gz: a7297f1aeded423b0f1bafe0a3b0a22bd1555beec64c9b2bfd334ddcce912c5299cd517735c6a850f8932d92630c09101542dd910cbdf6ad428fc414de39f90a
7
- data.tar.gz: bddc0792968bb7d9b3c6dd57e426fde6a100846320ecf699c86174fcc243ffad75a9b24ab1fa33639d72e6d7e8e52ed92d4c7da9c67e14f0077ad63bad48b4d4
6
+ metadata.gz: 6eedfa1177a7a0935e58670a830613d50b4742b7935ce215007a29b7dea4a556c8732e95dd36262d990d6c63a39f322637622f0b98ce93042ff56ea33a977dfd
7
+ data.tar.gz: aedf8ab202ee8f822448649194c3756918e9c7f33805172b7ca4d4c79b80bb1a934bb6fc084ce3649a5058816720ae9bac64bc8c6344eeeb3e13209a4c64dc08
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- review-tools (0.2.1)
4
+ review-tools (0.2.2)
5
5
  nokogiri (~> 1.10.4)
6
6
 
7
7
  GEM
@@ -1,6 +1,13 @@
1
1
  error_exit=1
2
2
  success=0
3
3
 
4
+ function check_if_git_dir () {
5
+ if [ ! -d .git ]; then
6
+ echo "Error: no git repository" 1>&2
7
+ exit 1
8
+ fi
9
+ }
10
+
4
11
  function run_additional_task () {
5
12
  task_name="$1"
6
13
  if [ -f "${HOME}/.config/review-tools.yml" ]; then
@@ -11,6 +11,9 @@ set -o xtrace
11
11
  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
+ script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
15
+ source "${script_dir}/common_functions.sh"
16
+
14
17
  if [ $# -ne 4 ] || [ "$1" != "into" ] || [ "$3" != "from" ]; then
15
18
  echo "Usage: git_checkout_target_branches into milestone/abc from feature/cde" 1>&2
16
19
  exit 1
@@ -19,10 +22,7 @@ fi
19
22
  dst_branch="$2"
20
23
  src_branch="$4"
21
24
 
22
- if [ ! -d .git ]; then
23
- echo "Error: no git repository" 1>&2
24
- exit 1
25
- fi
25
+ check_if_git_dir
26
26
 
27
27
  git checkout master
28
28
  git fetch -a || true
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Usage: look_changes_of_routes.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
+ script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
15
+ source "${script_dir}/common_functions.sh"
16
+
17
+ if [ $# -ne 4 ] || [ "$1" != "into" ] || [ "$3" != "from" ]; then
18
+ echo "Usage: look_changes_of_routes into milestone/abc from feature/cde" 1>&2
19
+ exit 1
20
+ fi
21
+
22
+ dst_branch="$2"
23
+ src_branch="$4"
24
+
25
+ check_if_git_dir
26
+
27
+ if [ -x bin/rails ]; then
28
+ dst_routes="/tmp/dst_routes_$$.txt"
29
+ src_routes="/tmp/src_routes_$$.txt"
30
+ diff_file="/tmp/changes_of_routes_$$.txt"
31
+
32
+ git checkout "$dst_branch"
33
+ bundle exec bin/rake routes > ${dst_routes}
34
+
35
+ git checkout "$src_branch"
36
+ bundle exec bin/rake routes > ${src_routes}
37
+
38
+ diff -u ${dst_routes} ${src_routes} > ${diff_file}
39
+ if [ -s ${diff_file} ]; then
40
+ echo '========= changes of routes ==========='
41
+ cat ${diff_file}
42
+ echo '======================================='
43
+ else
44
+ echo '========= changes of routes: NO ROUTE CHANGES ==========='
45
+ fi
46
+
47
+ rm -f ${dst_routes} ${src_routes} ${diff_file}
48
+ else
49
+ echo "Warning: no bin/rake command. So skiped looking changes of routes" 1>&2
50
+ fi
@@ -22,10 +22,7 @@ trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
22
22
  script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
23
23
  source "${script_dir}/common_functions.sh"
24
24
 
25
- if [ ! -d .git ]; then
26
- echo "Error: no git repository" 1>&2
27
- exit 1
28
- fi
25
+ check_if_git_dir
29
26
 
30
27
  if [ -f .ruby-version ]; then
31
28
  rbenv local `cat .ruby-version`
@@ -6,7 +6,7 @@
6
6
  set -o errexit
7
7
  set -o pipefail
8
8
  set -o nounset
9
- set -o xtrace
9
+ # set -o xtrace
10
10
 
11
11
  script_dir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
12
12
  source "${script_dir}/common_functions.sh"
@@ -32,6 +32,9 @@ logifle=~/tmp/run_review_`date +'%Y%m%d-%H%M%S'`.log
32
32
  "${script_dir}/prepare_rails_and_frontend.sh" ||
33
33
  show_notification "run_review.sh" "Failed: prepare_rails_and_frontend.sh" $error_exit
34
34
 
35
+ "${script_dir}/look_changes_of_routes.sh" ||
36
+ show_notification "run_review.sh" "Failed: look_changes_of_routes.sh" $error_exit
37
+
35
38
  if [ -z ${RUN_REVIEW_WITH_NO_TEST:-} ]; then
36
39
  "${script_dir}/check_and_test.sh" ||
37
40
  show_notification "run_review.sh" "Failed: check_and_test.sh" $error_exit
@@ -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, 'look_changes_of_routes.sh')
5
+
6
+ exec(shell_script_path)
@@ -1,5 +1,5 @@
1
1
  module Review
2
2
  module Tools
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
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.2.1
4
+ version: 0.2.2
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-10-11 00:00:00.000000000 Z
11
+ date: 2019-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -74,6 +74,7 @@ executables:
74
74
  - analyze_coverage
75
75
  - check_and_test
76
76
  - git_checkout_target_branches
77
+ - look_changes_of_routes
77
78
  - prepare_rails_and_frontend
78
79
  - run_review
79
80
  extensions: []
@@ -94,12 +95,14 @@ files:
94
95
  - bin/common_functions.sh
95
96
  - bin/console
96
97
  - bin/git_checkout_target_branches.sh
98
+ - bin/look_changes_of_routes.sh
97
99
  - bin/prepare_rails_and_frontend.sh
98
100
  - bin/run_review.sh
99
101
  - bin/setup
100
102
  - exe/analyze_coverage
101
103
  - exe/check_and_test
102
104
  - exe/git_checkout_target_branches
105
+ - exe/look_changes_of_routes
103
106
  - exe/prepare_rails_and_frontend
104
107
  - exe/run_review
105
108
  - lib/review/tools.rb