Editing a gem definition on HEROKU (opentok)

℡╲_俬逩灬. 提交于 2019-12-24 11:15:04

问题


quick question about Heroku. My app is using a gem called opentok. To function outside of a "sandbox" mode, the app requires changing an API link in a gem file called opentok.rb. I did that locally and the app works fine. however, when I deploy to heroku, the app does not work because heroku looks at my gem file and gets the unmodified gem lib of opentok which then runs my app on the heroku server in sandbox mode.

Is there a way I can access the opentok gem file (opentok.rb) on the heroku server and edit it with gvim from a console?

Thank you!!


回答1:


Unpack the gem to your vendor directory, edit it as you require, then tell Bundler where to retrieve the gem from.

Command line:

gem unpack opentok-VERSION --target vendor/gems

Bundler:

gem 'opentok', :path => "vendor/gems/opentok-VERSION"

After you've done all this, do a bundle install, add the vendored Gem to your git repository, and push to heroku.




回答2:


For the opentok gem, though, the api url can be passed directly as an option:

opentok = OpenTok::OpenTokSDK.new @api_key, @api_secret, :api_url => 'https://api.opentok.com/hl'

this feature is documented in the spec/opentok_spec.rb file. Look for:

it "should be possible to set the api url as an option" do

Thanks to Stijnster, the opentok gem creator, for pointing it out to me!



来源:https://stackoverflow.com/questions/6503132/editing-a-gem-definition-on-heroku-opentok

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!