rails/heroku migrating from gem to toolbelt - ruby-on-rails

I used to use the heroku gem with a project. Now that the toolbelt is out, I wanted to switch. I removed the gem from the Gemfile and I uninstalled it via gem uninstall heroku. I installed the heroku toolbelt with the pkg from heroku's website.
Now, everywhere on my system it seems that the new toolbelt is available when I do e.g.
heroku version
But inside that one directory where I store my Rails Project, I get an error as it is still looking for the old heroku gem (that has now been uninstalled).
How do I link to the new toolbelt instead of the old gem inside that folder?
BTW: I've also created a new rvm gemset and it did not change the behaviour.

Remove ~/.heroku/client folder and reinstall toolbelt.
Ref: https://stackoverflow.com/a/10988217/429758

Related

Where are Ruby gems located on a server?

My understanding is that the gemfile in a Rails app only provides references to the actual code of these gems on your local computer. So when you're running your app locally, it's pulling the gem code from your local computer. What happens when you deploy though? The server runs your rails code, but does it also hold all the references in your gem file and automatically download them as well?
Yep. If you deploy on Heroku, you can see bundler doing its work and pulling down the gems.
As per the Bundler docs, you can use bundle show --paths to see exactly where your gems are being loaded from.
Additionally, if you aren't using bundler, you can use the command gem environment to see gem paths on the system.
See this existing answer for more info: How can I find where gem files are installed?

Heroku can't find libruby-1.9.1.so.1.9

I'm running through a ruby on rails tutorial, and I just installed the Heroku toolkit.
My problem is that whenever I try "Heroku login", or whatever heroku command, I get :
ruby1.9.1: error while loading shared libraries: libruby-1.9.1.so.1.9: cannot open shared object file: No such file or directory
I remember having cleaned my ruby installations recently, so I wonder if I just miss some libs that I have deleted or something, but I haven't been able to find anything satisfying about that.
Do you have an idea how to get out of this situation, and be able to use Heroku ?
I managed to make heroku work by installing it with gem :
gem install heroku
instead of :
sudo apt-get heroku
It seems like heroku was trying to use a ruby version out of rvm (but i deleted the ruby version which was installed before rvm). Now the gem installation took care of that.

Installing Heroku Toolbelt has broken Taps

I've been hapilly using the Heroku and Taps gems for a while now, regularly doing a heroku db:push to push my database up to production.
This morning I noticed a message that the Heroku gem was deprecated, having been superseded by the Heroku Toolbelt. So I uninstalled the gems and installed the Heroku Toolbelt.
The next time I went to push my database I got the following error:
! Taps Load Error: cannot load such file -- taps/operation
! You may need to install or update the taps gem to use db commands.
! On most systems this will be:
!
! sudo gem install taps
Both Heroku and Taps are correctly installed, but in frustration I've tried following the instructions ('install or update the taps gem to use db commands') without success. The (re)install goes fine but I still get the above error when I try and push the database. Can anyone suggest a fix? I'm using rbenv.
Well I uninstalled the toolbelt using commands from here:
rm -rf /usr/local/heroku
rm -rf /usr/bin/heroku
Then removed the following from my .bash_profile
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
And it works again.
Moral of the story - avoid the Heroku Toolbelt and stick to the gems.
Can you try PG Transfers plugin for Heroku, documentation is on the page itself.
https://github.com/ddollar/heroku-pg-transfer
This seems to be recommended approach now by Heroku.
You don't have to remove toolbelt to use a gem version for one off cases such as broken taps:
% gem install heroku
% $(rbenv root)/shims/heroku version
heroku-gem/2.35.0 (x86_64-darwin12.2.0) ruby/1.9.3
This is using rbenv, but rvm, chruby or the like should be similar.
Well, Heroku suggests using PG Backups add-on. Taps+Heroku combination make problems to many, partially because Taps is designed to produce database-agnostic dumps which is not that easy.
The disadvantage is you got to upload your dump to S3 or something.

How to view what version of gem is installed on heroku through bundler?

I am not sure if I am missing anything here! How do I execute bundle show GEM_NAME for my heroku app?
I wanted to see what version of gem is installed on the running heroku application. I have messed up with my local bundle and now one of the gem is upgraded and its not backword compatible!
Any help?
Assuming you're using Heroku Cedar, you can run:
$ heroku run bundle show GEM_NAME

Rails 3 bundler & rvm: bundled gems don't show up in gem list?

ubuntu 10.04 slimy lynx or whatever it's called is the OS for a production app. I've installed rvm too, and other then being on a mac, the dev and production rubies and gems are the same.
Now, I'm used to seeing all of the bundled gems in gem list... like normal, however when i do gem list in production, I am not shown any bundled gems.
This means i can't use rails c or any other gem.
I've found out that i can do bundle exec rails c or something and use the console that way, but I'm more interested in why this is happening, and how to fix it so gem list has all the gems. it just feels right.
Thoughts?
When in development mode on your mac, the gems still get installed in the default gem path, whereas in production mode, they get installed in a folder specific to your project. Try doing a bundle show rails on each machine and you'll see what I mean.
When you run gem list it looks in the main gem folder, and since your production gems are sitting in a project-specific folder, the global gem command doesn't know to look there. So you will need to do a bundle exec to run any of those project-specific gemscommands on the server. For my purposes, I created a be alias to bundle exec. Also, to list your project's gems, you can do bundle list.
See http://gembundler.com/v1.3/rationale.html#deploying-your-application for the rationale behind this.

Resources