Welcome Guest | Login

Freezing a Gem - What am I missing?

Hi there,

Trying to freeze my first Gem (yahoo-weather) for my site, and I'm really struggling with a few things.

First, I'm not clear on the "Temporarily assign GEM_HOME and GEM_PATH" section of the wiki.

It instructs the user to export the GEM_HOME and GEM_PATH environment variables, and then before any other command is issued, it says "Logout and start a new shell session!! Or rake will not work..." Doesn't doing this UNDO the process of setting the GEM_HOME & GEM_PATH to include the .gems directory we created earlier? If I log out and back in, doing a echo $GEM_HOME shows nothing,

Anyway, if I do this and continue with the instructions, I receive an error:

username@spurgeon [~/churchill]# rake rails:gems:freeze
(in /home/username/churchill)
rake aborted!
no such file to load -- /home/username/churchill/config/../vendor/rails/railties/lib/initializer
/home/username/churchill/Rakefile:4
(See full trace by running task with --trace)

I'm hoping this is something simple. Yahoo-Weather may be a small feature for my site, but learning the process of installing a Gem will no doubt be invaluable for the remainder of my projects.

Thanks,
Grant

2007-04-02 08:41 PM

Hi Grant,

You need to stay in your current session if you're going to freeze your custom-installed gems.

2007-04-03 12:45 AM

Sijin,

Thanks, what made the install work was:

1. Not missing the step to change into the vendor directory before unpacking the gem
2. Staying in the session wiht the $GEM_PATH modified to include my .gems directory while unpacking them
3. Starting a new session to freeze the gems

I see the wiki has been updated, removing the line indicating to start a new session. It's worth noting that I also receive notification:

'The rake task freeze_gems has been deprecated, please use the replacement version rails:freeze:gems'

Now...let's see if my gem works!!

Thanks for the help.
Grant

2007-04-03 06:36 AM

Well I'm back,  and although my gem (yahoo-weather) is installed in the Vendor directory, it clearly is not available to me. Attempting to include code for the gem in my app results in an error, and I've tried to get it to load via irb in a shell session.

Suggestions anyone?

Grant

2007-04-04 10:03 PM

Hi there - sometimes gems are just picky.

I went ahead and installed it on your server:

Successfully installed yahoo-weather-1.0.0


Can you can clear it out of your vendor folder and give it a try now?

Cheers,
~William

2007-04-05 01:15 AM

William,

Works great now, thanks. I appreciate HR accomodating this. Although it may seem likea 'fun' gem, it's a requirement of the site set out by my client.

Many thanks,
Grant

2007-04-05 06:09 AM

Yeah, sure thing - I completely understand.  I'm glad it works for you now.  :)

2007-04-05 06:40 AM

Sorry to bring this up again, but maybe I've just stumbled across another 'picky' gem.

I want to use SuperRedCloth, which is essentially RedCloth 4. It renders text much better than 3.0.4 (which was worse than 3.0.3).
http://redhanded.hobix.com/inspect/superredcloth1160Gems.html

I've installed the gem, unpacked it to my Vendor directory, however it is still not found when I run my app. SuperRedCloth works on my dev machine, but I've tried requiring superredcloth in the following various methods without luck:

1. require 'superredcloth'
2. require 'superredcloth-1.160'
3. require 'superredcloth-1.160/lib/superredcloth'

(option 1 works on my dev box)

Any help would be appreciated.

Thanks HR!


2007-04-09 06:17 AM

What exactly does the folder say in the vendor/ dir?  This doesn't appear to be an "offical" gem in the gems repository yet - so you may have to play around with it a bit and/or contact the gem author.  

2007-04-09 06:29 AM

Good morning William,

The folder is called 'superredcloth-1.160'

Grant

2007-04-09 06:35 AM

Have you tried moving it to the plugins folder and not requiring it at all?  ('morning) -- you may also need to play around with the capitalization -- (i.e. SuperRedCloth or something like that) -- are you also restarting your mongrel/fastcgi processes when you change this?

2007-04-09 06:41 AM

No, I haven't tried moving it to my plugins folder (didn't know you could do this). Do I move the entire superredcloth-1.160 folder there?

I did try restartiing my processes, as well as capitalization, but I'll try this again...you never know.

2007-04-09 06:46 AM

Yes - some gems you can do this - you move the whole folder and change the name from superredcloth-1.160 to superredcloth

I'm not sure if that will help - but I'd try that along with all the capitalization trial and errors.  

2007-04-09 09:25 AM

Hey William. I'm at a loss at this point. I've tried the following:

1. Rename superredcloth-1.160 in my vendor directory to superredcloth and moved to Plugins
2. Tried different capitalization:

require 'superredcloth'
require 'Superredcloth'
require 'SuperRedCloth'
require 'superredcloth/lib/superredcloth'
require 'superredcloth-1.160/lib/superredcloth'
require 'superredcloth-1.160/lib/superredcloth.rb'

3. DL'd and froze the gem 2 or 3 more times (just to be sure)

4. I've also performed the same gem download & unpacking process into my vendor directory on my dev machine (OS X Tiger) and it works by simply requiring 'superredcloth'.

I appreciate this Gem is not in the main repository yet and don't expect HR to install the Gem, but I'm confident your familiarity with the HR environment is much better than mine. ;)

If this has reached beyond the scope of support HR can provide, I do understand. Eventually whytheluckystff will commit it to the repository!

Thanks,
Grant

2007-04-13 09:21 PM

When you're loading the gem via gem install - what is the exact command you are using?  I think emailing support and letting us take a look at your setup would be good at this point...tell us exactly how to repeat the error and what it should look like when it works.

Of course - as soon as this thing is committed you can run a

rake rails:freeze:edge

and you'll be good to go...but...I know it takes time.  

2007-04-14 01:35 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.