开发者

Why can't I access a locally installed gem from a simple Ruby app?

I am trying to write a simple Ruby program that I will run from my computer to check/set the amount of dynos I have running on my Heroku app. I am doing this because the highest frequency you can run cron in a Heroku app is hourly, and I want more frequent checking of the queue depth.

This simple Ruby app will exist outside of the actual Ruby on Rails application. In order to check/set the dynos, I need to use the Heroku gem. The gem is already installed as a local gem

$ gem list heroku
*** LOCAL GEMS ***
heroku (1.16.2, 1.9.8)

How can I access the Heroku gem from my simple Ruby app? I have tried:

dynos_check.rb

require 'heroku'

But I get this error when I try to run it:

$ ruby dynos_check.rb
dynos_check.rb:1:in `require': no such file to load -- heroku (LoadError)
    from dynos_check.rb:1

How can I access th开发者_如何学Goe Heroku gem?

Here is some other info:

$ which ruby
/usr/local/bin/ruby
$ gem env | grep 'RUBY EXECUTABLE'
  - RUBY EXECUTABLE: /usr/local/bin/ruby


You didn't say what version of Ruby you're running, but if it's < 1.9, before all other require statements, you'll need to add:

require 'rubygems'

Ruby 1.9+ does that automatically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜