-
-
Save brookr/2493622 to your computer and use it in GitHub Desktop.
# From the project root | |
rvm env -- `rvm current` >> .powenv |
The following should work:
export GEM_HOME="$rvm_path/gems/ruby-1.9.3-head@gemset_name"
export MY_RUBY_HOME="$rvm_path/rubies/ruby-1.9.3-head"
I think the reason you couldn't use whoami was because you are using single quotes which will use the literal string.
D'oh, of course! I was focusing on working with the output of rvm current
, didn't even think about changing the quotes. Using $rvm_path
is even better.
Much appreciated!
I used this to create a RVM-hook for switching the .powenv after each rvm use change:
# ~/.rvm/hooks/after_use_update_powrc
for file in `ls ~/.pow/` ; do
POW_LINK_TARGET=`readlink ~/.pow/$file`
if [ `pwd` = $POW_LINK_TARGET ]; then
rvm env -- ``rvm current`` > .powenv
fi
done
Making it executable:
chmod +x ~/.rvm/hooks/after_use_update_powrc
@denro, your solution worked perfectly. Just one needs to remember to not have any real folder in ~/.pow directory, otherwise shell error will appear:
-bash: [: /Users/me/.rvm/hooks: unary operator expected
Dec 23, 2015
NOTE: I ran across the above error because I put into ~/.pow
directory a real folder. But now in the current rvm
version 1.26.11 the above hook is no longer needed.
is there even simpler way? will the next pow release support .ruby-gemset?
At the very least, pow should detect the .ruby-gemset file and issue a warning like it does for a detected .rvmrc file...
Thanks for the script @denro, but it's unfortunate that it's still necessary today.
so pow dont use the ruby-gemset YET?
@jetsgit, do you still need to configure a .powrc
to accept the .ruby-gemset
and .ruby-version
files correctly? Like in this gist: https://gist.github.com/nbibler/5307941 ?
@kWhittington, ---I discovered the solution @denro mentioned is still necessary and still works great.
If you wish to debug using POW and pry-remote, you can do the following:
echo 3000 > ~/.pow/yourapp
However, that will cause an annoying error, e.g.:
/Users/jet/.rvm/hooks/after_use_update_powrc:6: parse error: condition expected: /Users/jet/Rails_Projects/puget-sound-salmon
To fix that, modify the bash script to the following, which will only exec on symlinks:
# ~/.rvm/hooks/after_use_update_powrc
for file in `ls ~/.pow/` ; do
POW_LINK_TARGET=`readlink ~/.pow/$file`
if [ -L "$POW_LINK_TARGET" ]; then
if [ `pwd` = $POW_LINK_TARGET ]; then
rvm env -- ``rvm current`` > .powenv
fi
fi
done
Looks like all I really needed in my .powenv from the full rvm environment is:
Anyone know a way to make that more generic? Embedding
whoami
on the right of the assignment does not work.