0

I'm trying to get an Ruby on Rails App working with JustHost hosting service.

Basically Justhost has some system gems installed that can't be modified under /usr/lib64/ruby/gems/1.9.3

At system level they have rails 3.2.13 and rake 0.9.2.2

Then, from the control panel I can add my own gems. So I installed rake 11.1.2

This adds rake 11.1.2 in this editable folder under my home directory: $HOME/ruby/gems

Now Also from control panel, I can create a Ruby on Rails application. This created a Ruby app in $HOME/rails_apps/MyApp

If I run bundle install with this fresh app, everything works perfectly. However, if I add this line to my Gemfile:

gem 'rake', '11.1.2'

When I run bundle install, i get this error:

Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-11.1.2.gem] in /home1/myhome/rails_apps/redmine
An error occurred while installing rake (11.1.2), and Bundler cannot continue.
Make sure that `gem install rake -v '11.1.2'` succeeds before bundling.

So I'm not sure how can I avoid this error. rake 11.1.2 is installed in my user's gem collection, so maybe I have to do something so that it takes it from there.

There is one step I've seen in the JustHost docs at https://my.justhost.com/hosting/help/rails

It says: Configure your .bashrc

You will need to add the following to your ~/.bashrc file.

~/.bashrc file

export HPATH=$HOME
export GEM_HOME=$HPATH/ruby/gems
export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3
export GEM_CACHE=$GEM_HOME/cache
export PATH=$PATH:$HPATH/ruby/gems/bin
export PATH=$PATH:$HPATH/ruby/gems

The problem is I don't have the hidden .bashrc in my home folder. Can I create one? The only bashrc I can see is /etc/bashrc (not hidden). Maybe I can copy this file and add the lines.

I copied this file as $HOME/.bashrc and added the export lines, but i still get the same error.

So I don't know what else i can do. Any ideas?

Jack Casas
  • 914
  • 18
  • 37

1 Answers1

0

OK.. The key was actually bashrc.

I created a new .bashrc in my $HOME folder

if [ -f "/etc/bashrc" ] ; then
  source /etc/bashrc
fi

and added the lines in the docs:

export GEM_HOME=$HOME/ruby/gems
export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3
export GEM_CACHE=$GEM_HOME/cache
export PATH=$PATH:$HOME/ruby/gems/bin

The I ran

source ~/.bashrc

After doing this, bundle install finished correctly.

Jack Casas
  • 914
  • 18
  • 37