Closed michaelrkn closed 9 years ago
bump
@marcosdsanchez This appears to be a Bundler issue. Typically with a Rails app you'd bundle
then run in the context of that bundle by prefixing bundle exec
to Rails commands. The #rubyonrails or or #bundler channels on IRC would be good places to get quick feedback. Or the #ruby and #ruby-lang channels are well populated and can usually point you in the right direction.
Thanks for the reply, @havenwood. Are you familiar with the new feature introduced in RubyGems 2.2.0 that removes the need for bundle exec
?
RubyGems can check for gem dependencies files (gem.deps.rb or Gemfile) when rubygems executables are started and uses the found dependencies. This means rake will work similar to bundle exec rake. To enable this set the RUBYGEMS_GEMDEPS environment variable to the location of your dependencies file.
To globally enable this new feature, you can add export RUBYGEMS_GEMDEPS=-
to your .bash_profile
.
Something in the way auto.sh
works seems to not be playing nicely with RUBYGEMS_GEMDEPS
, at least in some circumstances. If I remove auto.sh
from my .bash_profile
, I can run:
chruby 2.1
cd textbook/
And there are no errors. This makes me suspect the problem is something with auto.sh, but I can't figure out what it could be.
@havenwood, I guess you don't want me involved here and you mistyped my username :) .
@marcosdsanchez Oops, my Github autocompletion fail! Sorry about that.
@michaelrkn I wasn't up to speed on export RUBYGEMS_GEMDEPS=-
and misunderstood your intentions. Thanks for the explanation, I see what you mean now!
I'm able to reproduce the issue with bash and zsh, with or without sourcing auto.sh
. It appears to be triggered when chruby_use()
evals ruby to set RUBY_ENGINE
, RUBY_VERSION
and GEM_ROOT
.
Great! Let me know if there's anything else I can do to help sort the problem out.
Checkout @havenwood's solution. We agreed that using typeset unset
within the function to temporarily unset RUBYGEM_GEMDEPS
was the safest solution.
Hooray! Thanks :)
While typeset unset
or local unset
both work as expected on bash 3 and zsh it appears upon further testing that unfortunately neither is portable to bash 4.
Hello! I'm using chruby 0.3.8 and rubygems 2.4.4. My
.bash_profile
looks like:If I run:
I get:
Running
gem install -g
doesn't make the error go away.But, deleting my
.ruby-version
file, or removingauto.sh
from my.bash_profile
, and manually switching to the correct version of Ruby, does make the error go away.If this problem is really with rubygems, I can open an issue there.
Let me know if there's anything I can do help track down what's going on here!