RubyMine, Vagrant, RVM - rvm

I'm on OS X host where I have RubyMine (7) and last Vagrant installed. I've prepared shell script for provision my vagrant box with RVM, ruby (2.1.2), bundle my project, run all tests, manually start server. Everything seems fine.
Now I want to make RubyMine works with RVM ruby from vagrant guest (run server, specs with debugging). I've added remote ruby SDK, point them to RVM ruby binary (http://prntscr.com/5i6g1f). But when I try to start development server, I've receive message that no rails installed in SDK. But it is installed via bundle, I can run server manually from guest.
Please, advice me how can I tell RubyMine where to find gems inside Vagrant with RVM?
Thanks :)

When using RVM, the path to remote SDK should not point to the binary but rather to the ruby gems directory.
In your case, for instance, the correct path should be:
/home/vagrant/.rvm/gems/ruby-2.1.2
Note that it should point to the DIRECTORY not the executable!
To find the directory simply run:
$ rvm gemdir
Then copy and paste the result.

change the path to ruby
from: /path/to/rvm/rubies/ruby-version/bin/ruby
to: /path/to/rvm/wrappers/ruby-version/ruby

Same problem if any rbenv user face then type "which ruby" without quotes in terminal it will point to the shims folder of rbenv but select versions folder and select irb instead of ruby as rubymine need irb (ruby interpreter) instead of ruby binary.

Related

How do I `bundle install` with Chef?

I am using Chef to provision a CentOS 6.5 box and install my Rails 4.0.4 app.
I installed RVM and Ruby 2.1.1
When I cd my_website, RVM will set the correct ruby version (gemset).
How do I tell Chef to bundle with the correct ruby version
currently I am using this:
execute "bundle-install" do
user "my_user"
cwd "/home/my_user/website/"
command "bundle install"
action :run
end
But that is not enougth, it's still trying to use ruby 1.9.3
RVM is a shell-based Ruby version manager. Since the Chef Client runs as root, it probably isn't executing the login shell. So things like .rvmrc and the actual loading of RVM are ignored. Handling this with Chef is a bit complicated. I would recommend looking at Fletcher's chef-rvm cookbook.

RVM is not a function in Raspbian RVM Installation

I'm looking for a solution to the "RVM is not a function" issue when installing RVM on Raspbian using LXTerminal. The following thread discusses workarounds for this issue:
rvm installation not working: "RVM is not a function"
One solution would be to start the terminal in "login mode" by doing /bin/bash --login, but this does not help on Raspbian because it uses LXTerminal. Other people have suggested putting the following line at the end of your .bash_rc file:
source ~/.rvm/scripts/rvm
...which seems to work. Just wondering if (a) the above workaround is legit and will not screw anything up and (b) if anybody has found a more elegant solution for RVM on Raspbian.
It looks like the best solution is to run it with:
lxterminal -e "bash -li"
It will make the terminal use an login and interactive shell.
I tried this but when in the root application directory for a ruby on rails application it stopped working, I added this 'source /usr/local/rvm/scripts/rvm' to my .bashrc file which worked in the /home/user/ folder and the root ruby on rails application folder

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.

RVM error with deploying Rails app via Capistrano

History:
Read into Deploying Rails3 app to a
Mediatemple DV server.
Installed RVM on the server, ruby, and essential gems.
Site works fine if I FTP it up.
All good.
I then decided to do a proper deployment and setup for GIT/cap deploy as per "Agile Web Development with Rails".
Attempted deploy with cap, but had errors with gems not available to the production site.
Read around and realised I should probably go for a system wide RVM install.
Removed all gems and RVM.
Installed RVM system wide.
Error on cap deploy "bash: /home/foo/.rvm/bin/rvm-shell: No such file or directory", which makes sense - there is no .rvm/ in the home directory.
Thinking something was hanging over from initially installing RVM to use as a user, I removed the user, deleting the home directory, and recreated the user with permissions.
Same error on cap deploy "bash: /home/foo/.rvm/bin/rvm-shell: No such file or directory"
The situation now is:
For foo, .bashrc contains the last line:
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'
When I issue:
type rvm | head -1
the response is "rvm is a function".
/etc/rvmrc contains
if [[ ! -s "$HOME/.rvm/scripts/rvm" ]]; then
umask g+w
export rvm_selfcontained=0
export rvm_prefix="/usr/local/"
fi
Running out of ideas here, and hoping for some suggestions.
Next time try to add this in your capistrano:
set :rvm_type, :system
It seems like rvm-shell is not in your rvm install directory. Run this command
rvm get head
Then you'll get it right in your rvm bin directory.
I just wanted to add to #imonyse's comment.
the head branch of rvm might be a tad too unstable for some deploys. I know our deprecated SLES boxes have a tendency to choke on it. It might be advisable to get the most recent stable version.
rvm get stable
Also don't do this on a really old server running production code as it may have undesired consequences.

RVM settings lost after every logout

I installed ruby, rails and gemsets using RVM on ubuntu as instructed on :
http://railstutorial.org/ruby-on-rails-tutorial-book#sec:rubygems
Now the problem is that everytime I reboot machine and open console, my RVM and rails settings are lost:
when I try "rails server" - rails is not found and all gems are lost too. I need to install rails and install other gems like heroku again.
Are you sourcing $HOME/.rvm/scripts/rvm into your shell in its .profile or whatever setup?
That would be the first thing to check.
Add this line:
source $HOME/.rvm/scripts/rvm
Try the following
rvm --default use 1.9.3