Skip to content

Commit 40c6491

Browse files
committed
Added yarn support
1 parent aafd757 commit 40c6491

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

bin/git_rails

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,25 @@ files_changed=`git diff $old_ref $new_ref --name-status`
7676
# CHECK IF WE NEED TO DO A BUNDLE
7777
bundle_changed=`echo "$files_changed" | grep $'M\tGemfile.lock'`
7878

79+
# CHECK IF WE NEED TO SPIN SOME YARN
80+
yarn_changed=`echo "$files_changed" | grep $'M\tyarn.lock'`
81+
7982
migrations=`git diff --name-status $old_ref $new_ref -- db/migrate | grep '^[AD]'`
8083

8184
if [ "$verbose" -eq 1 ]; then
82-
if [ ! -z "$bundle_changed" ]; then
85+
if [ ! -z "$bundle_changed" -o ! -z "$yarn_changed" ]; then
8386
echo -e "\nPrep needed:"
84-
echo -e "\t- bundle"
87+
if [ ! -z "$bundle_changed" ]; then
88+
echo -e "\t- bundle"
89+
fi
90+
if [ ! -z "$yarn_changed" ]; then
91+
echo -e "\t- yarn"
92+
fi
8593
fi
8694
if [ ! -z "$migrations" ]; then
8795
echo -e "\nMigrations needed:\n${migrations}"
8896
fi
89-
if [ -z "$bundle_changed" -a -z "$migrations" ]; then
97+
if [ -z "$bundle_changed" -a -z "$yarn_changed" -a -z "$migrations" ]; then
9098
echo -e "\nNo changes necessary\n"
9199
exit 0
92100
fi
@@ -105,6 +113,11 @@ if [ ! -z "$bundle_changed" ]; then
105113
bundle
106114
fi
107115

116+
if [ ! -z "$yarn_changed" ]; then
117+
echo "Your yarn.lock has changed, running yarn"
118+
yarn
119+
fi
120+
108121
if [ ! -z "$migrations" ]; then
109122
echo "Running migrations!"
110123
for migration in $migrations

0 commit comments

Comments
 (0)