How do I generate documentation using rvm after a reinstall? - documentation

I installed RVM as per the instructions on http://rvm.io. Here's what I've done: rvm list:
rvm rubies
=* ruby-1.9.3-p194 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Followed by a ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
And then a rvm docs generate:
Currently 'rvm docs ...' does not work with non-rvm rubies.
I then tried rvm reinstall 1.9.3 && rvm docs generate. This resulted in the rvm giving me the above error.
How do I generate docs with rvm?

you need to use ruby first:
rvm use 1.9.3

I am using the rvm binary (i.e. I did not build it from sources). See this git issue for more details. Doing a rvm reinstall 1.9.3 --disable-binary will build rvm from source and allow you to generate docs with rvm. (At least for version 1.9.3)

Related

RVM can't set ruby as default

I have no idea why but RVM can't seem to change the default Ruby. I'm using Oh My Zsh and tried everything I've found but nothing seems to work.
➜ Sites rvm use 2.0.0 --default
Using /Users/anahkiasen/.rvm/gems/ruby-2.0.0-p247
➜ Sites rvm list
rvm rubies
=* ruby-2.0.0-p247 [ x86_64 ]
# => - current
# =* - current && default
# * - default
➜ Sites rvm reload && rvm list
RVM reloaded!
rvm rubies
* ruby-2.0.0-p247 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Now the Ruby is set as default but RVM doesn't load it as "current", which means it does not load the gemsets that are affiliated to it.
➜ Sites rvm use 2.0.0
Using /Users/anahkiasen/.rvm/gems/ruby-2.0.0-p247
➜ Sites gem list
*** LOCAL GEMS ***
backports (3.3.3)
bson (1.9.1)
bson_ext (1.9.1)
bundler (1.3.5)
bundler-unload (1.0.1)
eventmachine (1.0.3)
genghisapp (2.3.7)
json (1.8.0)
mongo (1.9.0)
mustache (0.99.4)
rack (1.5.2)
rack-protection (1.5.0)
rack-test (0.6.2)
rake (10.1.0)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)
sass (3.2.10)
sass-globbing (1.1.0)
sinatra (1.4.3)
sinatra-contrib (1.4.0)
sinatra-mustache (0.1.0)
tilt (1.4.1)
vegas (0.1.11)
➜ Sites rvm reload && gem list
RVM reloaded!
*** LOCAL GEMS ***
Nothing.
I have no .bashrc nor .bash_profile. There is no RVM reference in my .zprofile and here is my .zshrc :
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="robbyrussell"
DEFAULT_USER="anahkiasen"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(git bower brew composer gem laravel sublime)
## RVM and Rubygems
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
source $ZSH/oh-my-zsh.sh
I've tried swapping the above two lines, tried moving the RVM loading into .zprofile, nothing. Everytime I open a new instance of the terminal, the default is gone.
It loads the correct ruby, meaning if I do ruby -v I get the version I want, but for RVM it's not loaded and thus I have none of the gemsets.
I've also tried rvm --default use 2.0.0, rvm use 2.0.0#develop --default but same result.
I've reinstalled RVM, I've set recursively the permissions of the .rvm folder to the current user, nothing.
I'm kind of desperate at that point.
As you are using OH-MY-ZSH you might be hitting issue similar to this: https://github.com/robbyrussell/oh-my-zsh/pull/1359
RVM has a "fix" function, run:
rvm get head --auto-dotfiles
It will reorganize your dot files - it is important to read the output and follow instructions.
Make sure to use login shell for best effect.
Ah ha !! I just faced the same problem and resolved it eventually.
Let me reiterate my issue: Everytime i start my terminal, i had to first do a bundle install each time. Then i figured, Its not correct. So i tried sourcing my zshrc.
So everytime i had to do source ~/.zshrc or simply zsh also did the same and my gemset would get identified. Ofcourse assuming RVM and all other dependencies are installed correctly
Finally i figured i needed to do the following:
$ vim ~/.zlogin
The contents of the .zlogin should be
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
zsh #to initiate zsh (you could also replace this with 'source ~/.zshrc')
This resolved my problem. Now everytime i start my terminal, my defaults are all set.
Let me know if this works for you.

Passenger using Ruby system version instead of Ruby from RVM

I'm using RVM (1.19), Passenger (3.0.19), Apache on a Debian environment.
I tried update the ruby version from 1.8.7 to 1.9.3 using RVM. The following steps were executed:
rvm install 1.9.3
rvm rvmrc to .ruby-version (in my Rails app folder)
rvm use 1.9.3 & gem install passenger & rvm passenger-install-apache2-module (to install passenger and apache2-module in my 1.9.3 environment)
updated 'mod_rails.load' file in '/etc/apache2/mods-available/':
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
And finally, I restarted the apache server.
After all, my application is still using Ruby 1.8.7 and Passenger is getting gems from '/var/lib/gems/1.8/gems/'. So I guess Passenger is ignoring the configuration in mod_rails.load.
Does anyone know how resolve this problem?
what does ruby -v output?
if it is 1.8.7 try rvm use 1.9.3 and be sure that 1.9.3 is set as the default.
rvm default 1.9.3
and that your .rvmrc is sourced in your .bash_profile something like:
`[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"`
also what does which rvm return? that should be the start of file path you use to load gems from. its normally something like /Users/local/.rvm

Ruby keeps reverting to an old version

I am having some issues with RVM on Ubuntu. My computer is currently set to dual boot with windows 7 if that matters. I am trying to run the latest version of ruby 1.9.3. Each time I close terminal, it will revert to 1.8.7 despite using rvm use 1.9.3 --default. The following was the steps I was using.
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
michael#michael-Studio-XPS-1640:~$ rvm use 1.9.3
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
michael#michael-Studio-XPS-1640:~$ /bin/bash --login
michael#michael-Studio-XPS-1640:~$ rvm use 1.9.3 --default
Using /home/michael/.rvm/gems/ruby-1.9.3-p286
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
After I close and reopen the terminal I get the following verion info. I also added the rvm list information as well.
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
michael#michael-Studio-XPS-1640:~$ rvm list
rvm rubies
=* ruby-1.9.3-p286 [ i686 ]
# => - current
# =* - current && default
# * - default
Thank you guys in advance.
you missed the displayed instructions:
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

debug rails 3.1.1 application

I'm try to add a debugger to my rails 3.1.1 application which uses ruby 1.9.2. I have added the following to my gemfile:
gem 'ruby-debug19', :require => 'ruby-debug'
and I get the following error:
/.rvm/gems/ruby-1.9.2-p290#rails31/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:55:in `block (2 levels) in initialize': uninitialized constant Debugger::LocalInterface::Readline (NameError)
by the way i have the following:
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
$ rails -v
Rails 3.1.1
$ rvm -v
rvm 1.8.6 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]
What made is work for me is:
sudo gem install ruby-debug19
gem install linecache19
gem install ruby-debug-base19
bundle update
rails server -u
Did you install all the prerequisites listed in rvm notes before you installed Ruby? I'm not positive, but I think readline is a dependency for MRI on Linux.
You may also follow these instructions from the RVM site:
If you have an error when compiling pertaining to readline, you may
need to attempt installing with the procedure defined below.
NOTE: Before you follow the procedure below please be sure to verify
that you have installed any dependencies for the Ruby you are
installing listed by the 'rvm notes' command. If you have not yet done
that do so then run 'rvm remove X ; rvm install X' where X is the Ruby
that you are concerned with.
$ rvm pkg install readline
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

I can't seem to get rails installed on my Mac (10.6.5). Following Ruby on Rails Tutorial 3

I'm trying to get Rails 3 up and running by following the steps outlined in "Ruby on Rails Tutorial" by Michael Hartl (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book).
The details start in section 1.2.2 (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:rubygems). Here you go through the following steps:
Installing Git
Installing Ruby (version 1.9.2) using Ruby Version Manager (RVM)
Creating different gemsets for environments using Ruby 1.8.7 and 1.9.2
Installing RubyGems
and finally, installing Rails.
I run the following command [sudo] gem install rails --version 3.0.7
Everything seemed to install correctly (based on no errors). However, when I type "rails -v", rails cannot be found.
I am a Rails newbie. I'm trying to install Rails on a machine running Mac OS X 10.6.7.
Thanks.
If you are using RVM you probably don't want to use sudo when installing gems. If you have Git installed only steps needed to get Rails are:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.zshrc
# Reload your shell now (open a new terminal for example)
rvm install 1.9.2
rvm 1.9.2 --default
gem install rails --version 3.0.7
hash -r
This skips the gemsets part (you don't need it if you are just starting learning Rails) and assumes that you use Zsh (I think it's Mac OS X default, if you use Bash then you have to alter .bashrc, not .zshrc).
If you want to remove your previous installation and start over use rvm implode.