ruby-on-railsrubybashubuntuwebhooks

Ubuntu Webhooks is not reading the correct RVM ruby installed


I'm trying to set up webhooks on my system to do some ruby stuff on my machine automatically via running a bash script. The problem is that the ruby used while running the script manually differs from the one running using hooks.

Here is a simple bash script printing ruby values (test-ruby.sh):

#!/bin/sh
echo 'Tetsing...'
ruby -v;
which ruby;
bundle -v;
which bundle;

Below is the output if I run it via sh test-ruby.sh enter image description here

Below is the output from triggering same script via hooks enter image description here

Caveats:


Solution

  • #1 The top of the file should be

    #!/bin/bash
    

    #2 Force loading the rvm env on the top of the script

    [[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # Load RVM into a shell session as a function