开发者

Executing a binary gem file with unpacked gems

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


This has the answer you're looking for: http://www.mail-archive.com/rubyonrails-talk@googlegroups.com/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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜