views:

163

answers:

1

I am using the gem whenever

To update the crontab, it executes the whenever command in the root directory of my application.

The trouble is: my production environment doesn't have the gem installed, so I unpacked the whenever gem into my application and running 'whenever' from my application root directory fails to find the file

How do I run the frozen gem executable from the root directory of my application?

I found that

cd #{release_path} && /usr/bin/ruby #{release_path}/script/runner #{release_path}/vendor/gems/whenever-0.4.1/bin/whenever --update-crontab #{application}

works; but this seems like the 'wrong' answer

A: 

This has the answer you're looking for: http://www.mail-archive.com/[email protected]/msg45169.html

Finally, you usually can add gems to the load path by doing the following within your environment.rb:

Option 1: add gems using less ruby code within the environment.rb file

# Add additional load paths for your own custom dirs config.load_paths += %W( #{RAILS_ROOT}/extras )

Option 2: add gems using more ruby code within the environment.rb file

Dir.glob( File.expand_path( "#{RAILS_ROOT}/vendor/gems/*", FILE) ).each do | gem | $:.unshift File.join( gem, 'lib' ) end

Option 3: using a combination of Option (1) and (2).

Read the whole message, it's quite instructive.

Trevoke