Ruby Rbenv tries to run Zeus from Bundle despite it being a global gem (Using ZSH)
Asked Answered
C

2

5

(Update: Problem caused by zsh, see accepted answer)

Long ago, I followed this great guide to using Rbenv with bundler https://gist.github.com/1384279 and all was well in Ruby Land. (I installed it correctly)

Bundler gem is installed globally for the current ruby version. All gems for each project are bundle installed from their respective gemfiles.

I am attempting to install Zeus globally (like how bundler is installed globally) rather than adding it to the gemfile of each project.

joe@computer:~/some_project
> rbenv versions
  1.9.3-p194
* 1.9.3-p327-perf (set by /Users/joe/some_project/.rbenv-version)

joe@computer:~/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems
> ls -a
.                   method_source-0.7.1 zeus-0.13.1
..                  rake-0.9.2.2
bundler-1.2.0.rc.2  rdoc-3.9.4

I have succeeded, as you can see zeus is installed globally along with bundler... however:

joe@computer:~/some_project
> rbenv rehash

joe@computer:~/some_project
> zeus init
Users/joe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/bundler-1.2.0.rc.2/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': zeus is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/joe/.rbenv/versions/1.9.3-p327-perf/bin/zeus:22:in `<main>'

As far as I can discern, zeus is being sought as if it is bundle installed, but its not bundle installed its globally installed.

How do I get the shell to look at the global gems before the bundled gems?

Conjure answered 19/12, 2012 at 17:12 Comment(2)
I am having this problem too. Bug in bundler perhaps?Podgy
Are you using ZSH by chance?Podgy
P
5

If I got it right and you have the same problem with me and you are also running zsh, then this problem is that oh-my-zsh automatically wraps some commands using bundler if you have the bundler plugin installed.

See: https://github.com/robbyrussell/oh-my-zsh/pull/1507

https://github.com/robbyrussell/oh-my-zsh/pull/1138

https://github.com/heroku/heroku/issues/173

EDIT: This has been fixed in oh-my-zsh

Podgy answered 20/12, 2012 at 5:43 Comment(2)
@juanpastas This didn't work for me, I'm still seeing command not found: zeus. Any suggestions?Rainbow
I don't know which zeus outputs for me: ~/.rvm/gems/ruby-2.0.0-p247/bin/zeus and that path is in my PATH. I hope this give some help.Sax
U
4

If you do have this problem with oh-my-zsh and for whatever reason you haven't updated, you could just prepend zeus with a backslash, for example:

% \zeus start
% \zeus g model Post title content:text
% \zeus rake db:migrate

What the backslash does is runs the command overriding any aliases. See this section on Wikipedia http://en.wikipedia.org/wiki/Alias_(command)#Overriding_aliases

Underfoot answered 5/4, 2013 at 10:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.