Only install new Ruby deps if the Gemfile has changed
- ID
2e7b773- date
2025-05-05 10:00:37+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
3447e46- message
Only install new Ruby deps if the Gemfile has changed- changed files
Changed files
git/gm (1447) → git/gm (1659)
diff --git a/git/gm b/git/gm
index 4a61577..9c025d3 100755
--- a/git/gm
+++ b/git/gm
@@ -25,30 +25,35 @@ echo ""
cleanup_branches
+# If we're in one of my Jekyll repositories, and the Gemfile has changed,
+# I need to update my local Ruby installation.
if [[ $(groot) = ~/repos/alexwlchan.net ]] || \
[[ $(groot) = ~/repos/books.alexwlchan.net ]]
then
- echo ""
-
- print_info "-> Updating Ruby dependencies"
-
- echo ""
-
- print_info "-> bundle install"
- bundle install \
- | grep -v Using \
- | grep -v "to see where a bundled gem is installed." \
- | grep -v "you directly depend on are looking for funding." \
- | grep -v "you directly depend on is looking for funding." \
- | grep -v "bundle fund"
-
- echo ""
-
- print_info "-> BUNDLE_WITH=lint bundle install"
- BUNDLE_WITH=lint bundle install \
- | grep -v Using \
- | grep -v "to see where a bundled gem is installed." \
- | grep -v "you directly depend on are looking for funding." \
- | grep -v "you directly depend on is looking for funding." \
- | grep -v "bundle fund"
+ if grep -q 'Gemfile' .git/names_diff.txt
+ then
+ echo ""
+
+ print_info "-> Updating Ruby dependencies"
+
+ echo ""
+
+ print_info "-> bundle install"
+ bundle install \
+ | grep -v Using \
+ | grep -v "to see where a bundled gem is installed." \
+ | grep -v "you directly depend on are looking for funding." \
+ | grep -v "you directly depend on is looking for funding." \
+ | grep -v "bundle fund"
+
+ echo ""
+
+ print_info "-> BUNDLE_WITH=lint bundle install"
+ BUNDLE_WITH=lint bundle install \
+ | grep -v Using \
+ | grep -v "to see where a bundled gem is installed." \
+ | grep -v "you directly depend on are looking for funding." \
+ | grep -v "you directly depend on is looking for funding." \
+ | grep -v "bundle fund"
+ fi
fi
git/gp (484) → git/gp (781)
diff --git a/git/gp b/git/gp
index 9873484..97c18e5 100755
--- a/git/gp
+++ b/git/gp
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Pull any changes from the remote Git server.
+#
+# This writes a list of files that will be changed to `.git/names_diff.txt`,
+# which can be used by upstream scripts to customise their behaviour.
set -o errexit
set -o nounset
@@ -14,6 +17,9 @@ $(dirname "$0")/gf
echo ""
+# Log a list of files which will be changed to .git/names_diff.txt
+git diff --name-status "$HEAD" "origin/$HEAD" > .git/names_diff.txt 2>/dev/null
+
if [[ "${1:-}" == "--rebase" ]]
then
print_info "-> git rebase origin/$HEAD"