Skip to content

Commit 42497ce

Browse files
committed
[FIX] Kamal: now works with images which need a gem user install
1 parent 43edcfb commit 42497ce

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ tags
4747
[._]*.un~
4848

4949
/output
50+
/temp

src/kamal/install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ gem_install() {
2828

2929
case $RUBY_ENV in
3030
ruby)
31-
su $USERNAME -c "gem install $PARAMS"
31+
if [ "$GEM_HOME" != "" ] && ([ -d $GEM_HOME ] && [ -w $GEM_HOME ] || [ -d `dirname $GEM_HOME` ] && [ -w `dirname $GEM_HOME` ]); then
32+
su $USERNAME -c "gem install $PARAMS"
33+
else
34+
su $USERNAME -c "gem install --user-install $PARAMS"
35+
fi
3236
;;
3337
mise)
3438
su $USERNAME -c "mise exec -- gem install $PARAMS"

test/kamal/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
set -e
33

4+
export PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
5+
46
sudo apt-get update -y > /dev/null
57
sudo apt-get install -y curl jq ca-certificates > /dev/null
68

0 commit comments

Comments
 (0)