Ruby version potential conflicts for Heroku toolbelt - ruby

Currently, my installation of heroku toolbelt creates a ruby version of 1.9.2
But having installed via railsinstaller, my ruby version is 1.9.3.
When I deploy using heroku, will there be potential conflicts, and how can I prevent/manage/bypass them?

The heroku command line tool is built in Ruby. Apparently they have done all of their testing on ruby-1.9.2.
This will not cause any compatibility issues with your application. If when you push to heroku, you notice that the application is using a different version other than ruby-1.9.3, add a .ruby-version file to the root of your application. That file should only have ruby-1.9.3 in it.

Related

Multiple Rails apps and Ruby versions with rbenv

I have multiple Rails apps from 3.2.14 to 3.2.18 in my development environment. I'm using Ruby 1.9.3 (yes, I know) for these apps and it's installed and managed via rbenv. I'm about to build a couple of new apps with Rails 4.1 and Ruby 2.1. My question is, what is the best way to handle installing multiple versions of Ruby using rbenv. Currently 1.9.3 is set to global, but I want different Rails apps (4.1) to use Ruby 2.1.
I guess I'm a bit behind the curve with Ruby management so I could use a hand here. Again, looking to have multiple Rails apps (different versions 3.2.14-4.1.x) and multiple Ruby instances to support each app.
I appreciate the help in advance.
Create a .ruby-version file in your application root directory and specify the ruby version you want. For instance, if you want one application to use 1.9.3 and the other 2.1.0, you'll have a .ruby-version file each in those two applications, specifying the version:
/application1/.ruby-version
1.9.3
/application2/.ruby-version
2.1.0
Update
For every installed version of ruby, you'll have a shims directory which will house all your gems for that particular version. When you switch between ruby versions, rbenv will simply set the environment variables to the one you select.
In the example above, I set the local ruby version for the directory ruby_cookbook to 2.1.2 and a gem list will only show gems installed for 2.1.2.
I also created a .ruby-version with ruby version 1.9.3-p547 in my try_stuff directory. As you can see, gem list only shows gems installed for 1.9.3.
The gems you install are specific to the current version of ruby.
If your project root has a .ruby-version file, your environment will automatically set the current ruby version to the one specified. So, yes, your production environment will need the version you mention in your .ruby-version. If you use git for source control, you can add that file to your .git-ignore and you won't see it in your prod version.

Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update

Well, I have to admit, that I'm down today. I've updated my Ubuntu and that rendered Redmine 2.1.2 completely dead. Any suggestions as of to what should I update or reconfigure? I'm trying not to use Ruby/Rails/Passenger blindly but it's tough as it's not my expertise. I'd like to USE Redmine instead.
Top of the Passenger error log is below, but feel free to check whole page at http://redmine.teacloud.net:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
Is this app supposed to be run as the nobody user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find rake-10.3.2 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/1.8/gems/bundler-1.3.4/lib/bundler/spec_set.rb:92:in `block in materialize'
• I have no idea, what user should this app supposed to be run as. Everything else uses www-data by default, however the redmine application folder in filesystem is owner by root.
• Everything was working for two years on ruby 1.8 that is not on my system now. I've managed to install lowest version 1.8.7, latest 2.1.2... and I have no idea where does the 1.9.1 get from.
• I don't understand how 'bundle install' and 'bundle update' is related to current ruby version switched to using rvm.
• I am not sure, at what point will my Redmine MySQL database be migrated or destroyed if I'll need to upgrade Redmine (so I have backup).
• bundle install didn't help, Apache runs ruby 1.9.1
Solution was simply as follows (whole failure path is documented here http://www.redmine.orgenter code here/boards/2/topics/43500?r=43514):
• Everything happens in the Redmine's installation folder:
• Went to GitHub (https://github.com/redmine/redmine/blob/master/Gemfile) and copied fresh database section to Redmine's Gemfile (ignoring the fact that I have Redmine 2.1.2 and Gemfile is far newer)
$ rvm use system
$ bundle install

Changing Ruby version during deploy

I have a box with 3 Rails apps on it. I wan't to upgrade one of the apps so that it uses Ruby 2.0.0, while leaving the others running on 1.9.3-p394. I have both those Rubies installed via Rvm.
I'm trying to control the Ruby version that each app uses via it's Gemfile.
# Gemfile
ruby '2.0.0'
So, I changed the version number in the Gemfile locally, made sure it all worked, committed and now I'm trying to deploy the change to the server.
However, the cap deploy fails at this point
bundle install --gemfile [path to release Gemfile] --path [path to app bundle] --deployment --quiet --without development test
because
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
This is correct technically, my Gemfile does specify 2.0.0 and the app is currently running on 1.9.3. I'm trying to make it change versions before bundling though. How do I do that?
Your PATH is not set up correctly. You probably don't have bin: as the first entry in your path. That would lead to this error.
Even if you're not using Heroku it's worth reading this page on troubleshooting that issue: https://devcenter.heroku.com/articles/ruby-versions
Here is a link to an answer which will explain how to change your PATH on the server: Capistrano: Can I set an environment variable for the whole cap session?
If you have rvm maybe you can try to do
rvm use 2.0.0
before your bundler call.
If you're using rvm set the default to ruby 2.0.0 on your server
rvm --default use 2.0.0
Resolved the problem for me deploying to an AWS server from my mac - but I guess if I need to update my older sites I'll have to set the default back to 1.9.3 before deploying.

Installing heroku client only, and not the other things

I am using RVM for my Ruby installations.
I recently encountered a problem installing the heroku toolbelt with it installing Ruby 1.9.1 on my actual system, which then rewriting environment variables, and breaking my ruby cli. I had to delete everything, reinstall RVM, reinstall gems, ect ect..
The point is, I wish to be able to use the heroku client, and possibly foreman, but I don't want the toolbelt trying to install git, and ruby 1.9.1 on my system.
I tried to do the gem install version, but it states that the gem is depreciated, and for me to install the toolbelt.
Any help will be greatly appreciated.
Thank you for all thoughtful answers.
Go to the Heroku CLI on github and download the tarball from the other setup. Extract the Tarball and move the resulting files under /usr/local/heroku. Add /usr/local/heroku/bin to your PATH. Ensure that Heroku gem is removed from any project gem files. Reload your terminal and the Heroku CLI should be working.
You can run which heroku from your project directory and you should get /usr/local/heroku/bin/heroku.
As it is self updating you should only need to do this once.
If you want Foreman just use the Gem version.
Git and Ruby will not be installed using this process.
Update: Heroku now have an install script for a standalone install of the Heroku Client without Foreman and Git.
On Windows, the Heroku Toolbelt installer offers a choice between Full Installation and Custom Installation. If you choose Custom, you can select which components you want to install.

does every gem have its own rake?

Does every gem have its own rake? Because I was doing android development and I created app using the z$ rhogen app z. and then i did $rake run:android and the android emulator came up. But when I create an app using $rhosync app <appname> then migrate to the root of the app folder and do $rake:dtach install then the rake uses my older version of Ruby 1.8 where as my new and active Ruby version is Ruby 1.9.2. I dont know where to change the config file of the app or gem I am not sure to make Ruby 1.9.2 as my default ruby when I do $rake dtach:install.
As Alex said, rake tasks are not needed in order to have a gem.
What environment are you working on? RVM is a nice way to manage you ruby environments and manage multiple versions of ruby on unix based systems (OS X/ubuntu/debian). Have a look here http://beginrescueend.com/
No, not all gems have rake tasks.

Resources