I installed ruby using rbenv but after several attempts I don't manage to make the root user see the ruby bin.
I installed rbenv under /var/opt/rbenv
This is the content of /etc/profile.d/rbenv.sh:
export RBENV_ROOT=/var/opt/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
eval "$(rbenv init -)"
As user pi, ruby -v returns ruby 2.2.2p95
But sudo ruby -v or ruby -v as root returns ruby not found.
How can I make root use my rbenv installation?
Should I fallback or RVM instead of rbenv?
Info: I need to run my ruby scripts as root in order to access the GPIOs.
Note: I need ruby >=2 so apt-get install ruby-full is not a solution.