简体   繁体   English

Heroku上Gemfile中的自定义Ruby Gem

[英]Custom Ruby Gem in Gemfile on Heroku

I've modified a Gem that I use in my Rails app, and need to use it on Heroku. 我已经修改了我在Rails应用中使用的Gem,并且需要在Heroku上使用它。 Is there a way to upload the modified Gem to Heroku within my app and specify a custom path in my Gemfile? 有没有办法将修改后的Gem上传到我的应用程序中的Heroku并在我的Gemfile中指定自定义路径?

您可以将自定义gem放置在vendor目录中,然后在Gemfile中指定它们:

gem 'gemname', '1.0', :path => 'vendor/gemname'

在Gemfile中:gem'blah gem 'blah', :git => 'https://github.com/XXX/YYY.git'

  1. Fork it on github 在github上分叉
  2. Point your application to your modified gem using :git option when specifying gem dependency in Gemfile 在Gemfile中指定gem依赖项时,使用:git选项将应用程序指向修改后的gem

You can set up a custom gem server like Geminabox . 您可以设置自定义的gem服务器,例如Geminabox Unfortunately, it is designed for a LAN and has no built-in authentication. 不幸的是,它是为LAN设计的,没有内置的身份验证。 You can protect it via Rack::Auth middleware or use Rack::Mount to attach it to a secret path. 您可以通过Rack :: Auth中间件来保护它,也可以使用Rack :: Mount将其附加到秘密路径。 If that's too tedious, you can use a private gem hosting service like Gemfury (disclaimer: I work on this service). 如果这太麻烦了,您可以使用像Gemfury这样的私人gem托管服务(免责声明:我从事这项服务)。 Once you have either of those set up, just add the following to your Gemfile: 设置完其中任何一个后,只需将以下内容添加到您的Gemfile中:

source 'https://custom-gem-server.com/secret-token/'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM