`rbenv rehash` not generating shims (using rbenv-gemset plugin) - rbenv

I'm using rbenv and rbenv-gemset to manage the gems for a middleman project.
Even though I've run the rbenv rehash command, the shim for middleman does not exist:
→ middleman git:(master) × rbenv which middleman
rbenv: middleman: command not found
You can see here that I do have the middleman gem installed though:
→ middleman git:(master) × gem list middleman
*** LOCAL GEMS ***
middleman (3.1.5)
middleman-core (3.1.5)
middleman-more (3.1.5)
middleman-sprockets (3.1.4)
And here it is in my rbenv-gemset directory:
→ middleman git:(master) × ls .gems/gems
middleman-3.1.5
middleman-core-3.1.5
middleman-more-3.1.5
middleman-sprockets-3.1.4
And here you can also see there is a middleman command in the rbenv-gemsets directory:
→ middleman git:(master) × ls .gems/bin/
bundle erubis kramdown padrino rails rake2thor ri sass-convert sprockets tilt
compass haml middleman rackup rake rdoc sass scss thor tt
Yet running rbenv rehash does not generate the middleman shim (among others) :
→ middleman git:(master) × ls ~/.rbenv/shims
bundle dnsimple.rb gem rackup rdoc sass sdoc testrb tt update_rubygems
compass erb httparty rails ri sass-convert sdoc-merge thor unicorn
dnsimple erubis irb rake ruby scss sprockets tilt unicorn_rails
Here is my gem environment:
→ middleman git:(master) × gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.7
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /Users/asgeo1/Projects/myproj/middleman/.gems
- RUBY EXECUTABLE: /Users/asgeo1/.rbenv/versions/1.9.3-p448/bin/ruby
- EXECUTABLE DIRECTORY: /Users/asgeo1/Projects/myproj/middleman/.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/asgeo1/Projects/myproj/middleman/.gems
- /Users/asgeo1/.rbenv/versions/1.9.3-p448/gemsets/global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
What could be going wrong? Is this an issue with rbenv or rbenv-gemset?

funnily enough, somebody reported the exact same problem just a few days ago - and with middleman too. The problem has now been fixed (see https://github.com/jf/rbenv-gemset/issues/48). The problem in this case was rbenv-gemset. Sorry about that!
You can upgrade to the latest version of rbenv-gemset to get the fix (are you using git? or homebrew?)
EDIT #asgeo1, you might want to "accept" that answer, so that others who come by will be helped as well. Thanks.

Related

How to configure rvm with netbeans

I have installed ruby 1.9.2-p1890 in my rvm and the gem directory is
/Users/abhay/.rvm/gems/ruby-1.9.2-p180
My netbeans detected the rvm and the ruby installed but when i right click the project properies->manage
gem home is - /Users/abhay/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1
gem path is - /Users/abhay/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1
gem tool is - /Users/abhay/.rvm/rubies/ruby-1.9.2-p180/bin/gem (1.8.24)
interpreter - /Users/abhay/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
and when I run my project, I get this error
/Users/abhay/.rvm/rubies/ruby-1.9.2-p180/bin/ruby: No such file or directory -- script/server (LoadError)

Gem::LoadError: Could not find rubygems-bundler (>= 0) amongst []

I'm running rvm with ruby 1.9.3. I've ran bundle install and it worked fine. But when I run bundle install --deployment I get this:
volunteer-app ➜ bundle install --deployment
Fetching gem metadata from http://rubygems.org/.......
Installing rake (0.9.2.2)
Gem::LoadError: Could not find rubygems-bundler (>= 0) amongst []
An error occured while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.
After this is ran I look in the vendor/bundle/ruby directory and it shows 1.9.1. So it looks like bundle install --deployment isn't recognizing my gems in from rvm's default ruby version 1.9.3.
Any thoughts on what I could be missing.
Edit
Here's my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/sosl/.rvm/gems/ruby-1.9.3-p194#teer
- RUBY EXECUTABLE: /home/sosl/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/sosl/.rvm/gems/ruby-1.9.3-p194#teer/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/sosl/.rvm/gems/ruby-1.9.3-p194#teer
- /home/sosl/.rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
It's a bug in both rubygems-bundler and bundler, I have already fixed it for rubygems-bundler and a fix for bundler is waiting for merge.
Fastest way to fix is to update rubygems-bundler:
gem update rubygems-bundler
For reference here is pull request for bundler:
https://github.com/carlhuda/bundler/pull/1925
I really feel for you as I just went though something simular last night. While I am certainly not an expert (I am just a student of RoR as you are) can I make some suggestions?
After you use RVM to change into your RUBY version, run a "local" gem list to see what gems are installed locally. Do you have the gem installed in your local gems?
Sometimes gem files get "Jumbled" and stop working altogether. Have you tried to uninstall and then reinstall the gems? The command is simple. In your console type "gem uninstall (the name and version number of the gem you wish to uninstall). It may reply that the gem you wish to uninstall has dependencies on other gems you have installed. Don't worry once you reinstall those gems the dependencies will be satisfied.
I don't know if Bundler is installed automatically or not. Is it listed in your "Local" gems or in your gemfile.lock?
Best of luck in correcting this.

ruby - heroku: command not found

this question has been posted befour, but the answers haven't worked. I should proberley mention that i am completely new to ruby. i incountered the error while doing a tutorial here are the steps:
[first_app (master)]$ gem install heroku
I get
Successfully installed heroku-2.24.0
but when i try
[first_app (master)]$ heroku keys:add
I get
-bash: heroku: command not found
i then tried a bunch uninstalling the gem updating bundle reinstalling it but that hasn't helped
$ bundle exec heroku
/Users/vng/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': heroku is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/vng/.rbenv/versions/1.9.3-p125/bin/heroku:18:in'`
echo $PATH
/Users/vng/.rbenv/shims:/Users/vng/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
my gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86_64-darwin11.3.0]
- INSTALLATION DIRECTORY: /Users/vng/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /Users/vng/.rbenv/versions/1.9.3-p125/bin/ruby
- EXECUTABLE DIRECTORY: /Users/vng/.rbenv/versions/1.9.3-p125/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/vng/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1
- /Users/vng/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
help is greatly appreciated
When you install gems that have binaries (executables) you must run
rbenv rehash
to add the executables to your path.

annotate cannot find rake executable

I'm using ctran/annotate_models to annotate my models and route files. I'm now getting an error:
$ annotate -r
$ROOT/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:151:in `block in cripple_rubygems': can't find executable rake (Gem::Exception)
from $ROOT/usr/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'
Route file annotated.
...with the result that annotate adds the comment block to config/routes.db, but the comment is empty. The message suggests that annotate can't find rake, but rake is certainly there:
$ which rake
$ROOT/usr/bin/rake
and here's what rake says about the current configuration:
$ rake about
About your application's environment
Ruby version 1.9.2 (x86_64-darwin10.6.0)
RubyGems version 1.3.7
Rack version 1.2
Rails version 3.0.5
Active Record version 3.0.5
Action Pack version 3.0.5
Active Resource version 3.0.5
Action Mailer version 3.0.5
Active Support version 3.0.5
Application root .../myapp
Environment development
The only things that's slightly odd in my Gemfile is that I am specifying a previous version of rake:
# file: Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'rake', '0.8.7' # workaround "uninitialized constant Rake::DSL" bug
...
gem 'annotate', '2.4.0'
Any ideas of what's wrong?
Try using bundle exec rake instead.

rails 3: gems installed successfully, but cannot use them in my app

I did a clean install of rails 3.0.6. My app is running fine, except that I cannot use all the gems that didn't come with rails 3. All of them are in gem list. I also have them in Gemfile and have ran bundle install and bundle update.
For example, with matthuhiggins-foreigner:
upon rake db:migrate, it complains
that add_foreign_key is not defined.
I have the same problem with less:
no .css generated from .less)
geokit-rails3:
Unknown key(s): origin, within
gem which geokit-rails3 returns:
/Library/Ruby/Gems/1.8/gems/geokit-rails3-0.1.3/lib/geokit-rails3.rb
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 1.5.0
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/administrator/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I have looked into this problem for a long time. Please help!
Thanks!
Rails 3 does not load any gems that are not listed in your Gemfile, even if they are installed on your system. You need to explicitly list them there first.
The typical workflow in R3 is not to install your gems and then use them, but to write entries in the Gemfile and then install them by installing bundler with "gem install bundle" and getting all the remaining gems with "bundle install". Bundle install will install any required gems you do not already have, but will use the ones you do have.
(Bundle update, suggested by another user, will bump all your gems to the most recent available version that matches your requirements as laid out in the Gemfile, even if the ones already installed satisfy the requirements). i.e. if you need foo_gem >= 1.0 and you have foo_gem 1.0.1 installed, "bundle install" won't change it but "bundle update" will install foo_gem 1.0.3 if it's available.
If you are working on multiple applications that have conflicting (or potentially conflicting) gems, then I recommend learning about RVM and creating a gemset for each project. This is especially valuable if you are still working on any Rails 2.x projects alongside your R3 projects.
Try this:
Update gem by running gem update --system
Make sure your gemfile lists the gems
Run bundle update to update all your gems in the gemfile
Hopefully that should do the trick.
I came back to this problem after a few days and I fixed all the issues!
matthuggins-foreigner gem is called foreigner, so I added this to Gemfile:
gem 'foreigner'
With geokit, I simply followed the instructions here:
https://github.com/jlecour/geokit-rails3
With less, I installed the less gem and the more plugin, then restarted the server:
https://github.com/cloudhead/more