Ruby on Rails, Gems, cPanel and Shared Hosting

Hi

Long story short!

I’ve got a rails application I’m trying to install on a shared hosting
plan (with NativeSpace) using cPanel.

I have two gems; calendar_date_select and prawn which are required.

I have used cPanel to install the gems - they say they are installed.

I’m trying to run my application and it’s not loading due to the
errors shown below …

I’m having to keep ask NativeSpace tech support to install gems which
seems silly as cPanel seems to say they are installed. And although
they’ve installed prawn, my application isn’t seeing it.

The error message in mongrel.log is:

Missing these required gems:
prawn

You’re running:
ruby 1.8.7.22 at /usr/bin/ruby
. rubygems 1.3.5 at /home/enigmath/ruby/gems, /usr/lib/ruby/gems/1.8

Run rake gems:install to install the missing gems.

I keep seeing the following in the cPanel gems setup help panel for
RubyGems installation:

Location of Your Ruby Gem(s)

Path: /home/enigmath/ruby/gems

Using Your Ruby Gem(s)

You will need to add /home/enigmath/ruby/gems to the include path.
You can do this by adding the following code to your script:

$:.push(“/home/enigmath/ruby/gems”)

Which means nothing to me!

I’ve tried following lots of information about setting variables
in .bash_profile (which I have done), but as I don’t have root access,
there is little I can do to run the script of check it’s working! What
I have been able to do just doesn’t seem to work.

Can anyone please tell me how to get this working?!

Also … when I remove the gems the server starts … and it loads on
www.enigmatheatrecompany.co.uk with the static page … but when I try
to go to www.enigmatheatrecompany,co.uk/appointment it says page not
found.

It’s like the routes aren’t working!!!

I have no experience with mongrel as I use Passenger on my development
server so I don’t know where to look for the problems or how to
structure a solution.

Does anyone have a helpful “I did this with cPanel and although it was
a pain I solved it this way?” advice?!

Thanks

Darren

Hi,

Do you have ssh access to your account?
I had lately problems with some gems (available but not found somehow).
In the end I installed them myself by specifying the path like:

gem install curb -i /home/myusername/.gems

And then adding the path to environment.rb file:

ENV[‘GEM_PATH’] = ‘/usr/local/lib/ruby/gems/1.8:/home/myusername/.gems/’

Then everything worked.


On another host I also had to put something similar to your

$:.push(“/home/enigmath/ruby/gems”)

Unfortunately I don’t remember where it went, to the cgi dispatcher
maybe?


Maybe you should post your routes…
I imagine that the , in www.enigmatheatrecompany,co.uk/appointment is
not a , when you write it in the server…

Cheers.

I’d look into unpacking your gems into your app instead of relying on
your shared host:

rake gems:unpack:dependencies

Ruby on Rails: Talk wrote:
[…]

I keep seeing the following in the cPanel gems setup help panel for
RubyGems installation:

Location of Your Ruby Gem(s)

Path: /home/enigmath/ruby/gems

Using Your Ruby Gem(s)

You will need to add /home/enigmath/ruby/gems to the include path.
You can do this by adding the following code to your script:

$:.push(“/home/enigmath/ruby/gems”)

Which means nothing to me!

How can it mean nothing to you? It’s instructions for adding a line of
code to your program. The instructions even contain the line of code to
add. Next time, read the error messages, don’t just shut your eyes and
say they mean nothing.

But Lee is right: you should unpack gems into vendor.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen

I have always been met with such helpful people in this group I
sometimes marvel that when asking what might appear a simple question
which foxes other people that the respondents take it upon themselves
to rain down scorn and rudeness. How lucky am I to have escaped
this … until now!

For information I am fully aware that the code was given to me. I was
fully aware of the instructions and - having been to school for a good
many years I’ve learnt to open my eyes and read (which as a man is
quite good as I have also managed to stand up and urinate at the same
time too - women are proud of me all over the world). I can even cope
with the difficult words with lots of letters and syllables. I even
think I got a gold star once for my spelling. So …

Please … try getting off your high horse and read the message for
what it is. A question relating to WHERE to place the line as the
error message simply says “by adding the following code to your
script”.

Now … having used my open eyes and a pretty good grasp of the
English language and knowing all about Google … I have finally
(after reading LOTS of other people with the same problem) ascertained
(ohh … a long word) that you have to place it in to config/
environment.rb.

However, I have also found that for cPanel … this is not going to
work for complicated gems.

I feel so clever now.

I also followed Lee’s advice and marvel at how he could give that
advice without the need to be rude.

I’m now going to read more long words in the dictionary and hope I can
next time express myself in a posting to this group so that I’m not
met by unhelpful comments like yours.

Oh how superior you must feel now.

Hugs

Kisses

Me x

Nice you got it working.
I’ll start unpacking also :slight_smile:

Ruby on Rails: Talk wrote:

Marnen

I have always been met with such helpful people in this group I
sometimes marvel that when asking what might appear a simple question
which foxes other people that the respondents take it upon themselves
to rain down scorn and rudeness. How lucky am I to have escaped
this … until now!

I didn’t mean to be rude, just forceful. I’m sorry it came across
differently.

For information I am fully aware that the code was given to me.

That was not clear from your original message.

[…]

Please … try getting off your high horse and read the message for
what it is. A question relating to WHERE to place the line as the
error message simply says “by adding the following code to your
script”.

I did read the message for what it was. Nowhere did you ask where to
put that line of code; you just complained that it “means nothing to
you”. I responded to what you wrote, not what you might have meant to
write.

[…]> I’m now going to read more long words in the dictionary

Long words have nothing to do with it.

and hope I can
next time express myself in a posting to this group so that I’m not
met by unhelpful comments like yours.

That would be great. You will get better answers if you ask the
questions you meant to ask.

Oh how superior you must feel now.

No, not at all. And I don’t know why you bothered wasting time on
direct insults.

Hugs

Kisses

Um, what? After the tone of the remainder of your message?

Me x

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Hi :slight_smile:

I have deleted my original post :slight_smile:

I think I was having a bad moment!

Take care

On Jan 8, 1:10Â pm, “Ruby on Rails: Talk” [email protected]
wrote:

You will need to add /home/enigmath/ruby/gems to the include path.
You can do this by adding the following code to your script:

$:.push(“/home/enigmath/ruby/gems”)

Which means nothing to me!

It means something to me - your host is still trying to half-ass
Rubygems support like they did back in the 1.x era. The best advice
would be to switch to a real host, as fighting with a shared setup
this old is going to get painful, especially if you happen to need a
gem with native bits.

If you still want to stick it out, I’d recommend unpacking the gems
(use “rake gems:unpack:dependencies” to get them all) and running that
way. The $:.push method isn’t compatible with the gem dependency
system in Rails 2.1 and higher.

–Matt J.