-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-check-diff-files.sh
46 lines (40 loc) · 1.03 KB
/
git-check-diff-files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
function check-git-diff-files-with-rspec() {
local diff_files=(
$(git diff $(mb_commitid) --name-only spec/**/*_spec.rb)
$(git diff --staged --name-only spec/**/*_spec.rb)
)
if [ ${#diff_files[@]} -eq 0 ]; then
echo "No files detected"
else
set -x
bundle exec rspec --format=progress ${diff_files[@]}
set +x
fi
}
function check-git-diff-files-with-rspec-fail-fast() {
local diff_files=(
$(git diff $(mb_commitid) --name-only spec/**/*_spec.rb)
$(git diff --staged --name-only spec/**/*_spec.rb)
)
if [ ${#diff_files[@]} -eq 0 ]; then
echo "No files detected"
else
set -x
bundle exec rspec --format=progress --fail-fast ${diff_files[@]}
set +x
fi
}
function check-git-diff-files-with-rubocop() {
local diff_files=(
$(git diff $(mb_commitid) --name-only **/*.rb)
$(git diff --staged --name-only **/*.rb)
)
if [ ${#diff_files[@]} -eq 0 ]; then
echo "No files detected"
else
set -x
bundle exec rubocop -A ${diff_files[@]}
set +x
fi
}