Moving my RVM project gemset to another patchlevel - rvm

My project has an .rvmrc file with the following: rvm 1.9.2-p180#project_name. However, I just updated my ruby 1.9.2 to the latest patch level (1.9.2-p290). Is there any way to migrate the gems in the project_name gemset to 1.9.2-p290?

You can copy gemsets with the following command:
rvm gemset copy 1.9.2-p180#project_name 1.9.2-p290#project_name

Reference: http://ruby.about.com/od/rubyversionmanager/ss/Upgrading-To-1-9-2-Using-Rvm_6.htm
Alternatively, your gemsets can be migrated (or moved) from one version of Ruby to another. Remember that migrate moves gemsets, not leaving a copy behind. But if you wish to do it this way, you can run the following command.
rvm migrate 1.9.2-p180#project_name 1.9.2-p290#project_name

Related

How do I install same version of ruby as different names with rvm?

After I installed a version of ruby with rvm, I noticed that some minor configuration issue on installation process. So I wanted to try to install with another configuration options, but I don't want to spoil the installed ruby at all.
So I just to attempt to backup the installed ruby before rvm reinstall.
(cd .rvm/rubies && mv ruby-1.9.3-p194 ruby-1.9.3-p194.org)
In my case, reinstallation fixed the issue, I didn't rollback ruby. So, I don't know this can work.
Are there any clean or correct way? Just for future references.
you can install named rubies:
rvm install 1.9.3-test1 [options]
and after it worked set it as default:
rvm use 1.9.3-test1 --default
or reinstall the original 1.9.3, named rubies are useful especially for testing compilation flags or patched rubies:
rvm install 1.9.3-performance --patch falcon
You can also have different gemsets with the same version using
rvm create gemset projectname

RVM see gems in gemset

How do I view a list of all the gems in a given gemset? And is it possible to use multiple gemsets at a time or only one?
You can call gem list and it will display all the gems in your current gemset. You can only use one gemset at a time, but there is a hierarchy of gemsets. You can create a global gemset with (for example) rake and pry in it, and then any gemset you create (using the same version of ruby, of course) will inherit those gems into it.
Usually the current Ruby's #global gemset is included in other gemsets.
To see the contents of a gemset, excluding the #global gemset, first do rvm use 2.0.0#some-gemset --ignore-gemsets (or similar) then gem list.
For the default gemset, do rvm use 2.0.0 --ignore-gemsets then gem list.
Perhaps the simplest way is to query the filesystem. As an example, I had a gemset named yard using Ruby 3.0.3. All the gems installed in that gemset could be found with:
> ls ~/.rvm/gems/ruby-3.0.3#yard/gems
yard-0.9.26
(There was just that one gem.)
So the gemset directory name is:
~/.rvm/gems/#{ruby_version}##{gemset_name}/gems
...where ruby_version is the version rvm uses (i.e. the string output by rvm list).

How to uninstall a gem from Rubymine

I'm a n00b in Rails and Rubymine IDE. The Rubymine Help says to
To uninstall gems, use command line procedure. So doing, the
recommended command format depends on the Ruby gems version you use.
gem uninstall <gem_name>
Could not how to figure out where to run the command and the Help does show this either. Let me know if there are any add'l steps that need to be done, such as unbundling the gem.
Thanks in advance.
Just run in the terminal/console a command:
gem install <gem_name>
In case if you using several RVM sets, then go to File/Setting/Ruby SDK and Gems and check which gem set used by RubyMine. Then check the gemset in terminal by command:
rvm gemset list
You will see the current gem set, you can change it if you need by command:
rvm gemset use <gemset_name>
And then do the uninstalling.

Project broken with Bundler errors after RVM install

I installed RVM and installed 3 different rubies: 1.8.7, ree, and 1.9.2.
I have a Rails 3.0.9 project that uses 1.8.7.
Now when I try to run the 3.0.9 project, I get this error:
Could not find xml-simple-1.1.0 in any of the sources
However, the following command:
bundle show xml-simple
yields:
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/xml-simple-1.1.0
Looks right to me. What am I missing here? The application, when running, is clearly not seeing the right path. Yet Bundler, when run at the command line, sees it just fine. I am not certain where these paths are to be set. I am admittedly new to RVM, I installed it because I want to start a new edge project with 1.9.2.
Thank you for any help you can provide.
I needed to learn how to create a gemset, then switch to that gemset. You can always check your gem and ruby environment with rvm using:
rvm info
That's what clued me in. Once I "use"d the appropriate gemset where the gem was installed, it worked great.

Using RVM, Rails 3.0.7 is messed up after installing Rails 3.1.0 beta1

Using rvm I installed and am using Ruby 1.9.2p180.
I created a gemset called rails3tutorial and, using it, installed Rails 3.0.7, created "sample_app", then used bundle to install. Very nice.
Then I created a new gemset called rails310b1, installed Rails 3.1.0 Beta 1, created an app, and bundle install'd...but it turned out I was not actually switched to the rails310b1 gemset, and so I ended up installing to ruby-1.9.2p180's default gemset (is that #global?...). I then manually deleted all the gems that had been installed!
Then I switched to rails310b1, and bundle install'd, created an app, fired up the app -- golden.
Now I switch back to the rails3tutorial gemset, and cd to the app created using it, and I get errors when running rails commands like...
$ rails generate integration_test layout_links
/Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/rails:19:in `load': no such file to load -- /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/rails-3.1.0.beta1/bin/rails (LoadError)
from /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/rails:19:in `<main>'
It's looking for /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/rails-3.1.0.beta1/bin/rails but why?! $PATH looks fine.
Any suggestions as to what is messed up and how to clean this up, or is it best if I wipe out all my gems/gemsets and start over?...
Thanks!
There is nice screencast with basics of RVM http://screencasts.org/episodes/how-to-use-rvm but it mostly comes to using rubies:
rvm install 1.9.3
cd ~/projects/my-app
touch Gemfile
rvm use --create --rvmrc 1.9.3#rails32
gem install bundler rails
bundle exec rails new .
bundle install
bundle exec rails generate integration_test layout_links
please note you need to prefix most of the commands with bundle exec there is my gem that should save you from this problem rubygems-bundler.
also make sure you use .rvmrc files for every project so when you switch dir in console the proper ruby environment is set, the --rvmrc switch used above will generate one for you.