我正在尝试从分叉的
aws-sdk-ruby
存储库安装 gem,我在其中添加了一些新的提交。
以下是我添加到 Gemfile 中的内容:
gem 'aws-sdk', :git => 'https://github.com/suvrat-joshi/aws-sdk-ruby.git', :branch => 'retry-throttled-cf-requests'
但是当我尝试运行
bundle install
时,我收到以下错误:
Could not find gem 'aws-sdk' in [email protected]:suvrat-joshi/aws-sdk-ruby.git (at
retry-throttled-cf-requests@b77de6d).
此外,我可以通过运行
gem install aws-sdk -s https://github.com/suvrat-joshi/aws-sdk-ruby.git
从源代码安装此 gem。但是,我想通过bundle install
安装它。
请注意,我已经尝试过在网上找到的一些答案。但这些对我的案子都没有用。喜欢:
添加中
require 'bundler/setup'
至
config.ru
文件。
添加中
require 'bundler'
Bundler.setup(:default)
至
config.ru
文件。
使用
specific_install
命令
gem install specific_install
gem specific_install -l https://github.com/suvrat-joshi/aws-sdk-ruby.git
从link处的
aws-sdk.gemspec(
gem build aws-sdk.gemspec
)文件构建gem,然后将生成的gem文件复制到另一个项目的静态路径,然后将以下内容添加到Gemfile
.
gem 'aws-sdk-3.2.0.gem', path: 'vendor/gems/aws-sdk'
但是这个选项不适合我的情况,因为对于每个新更新,我都需要再次构建 gem 并将其复制到静态路径。
具有 Ruby 专业知识的人可以帮助我理解为什么这不起作用以及如何解决这个问题吗?
根据https://bundler.io/guides/git.html:
If the gem is located within a subdirectory of a git repository,
you can use the :glob option to specify the location of its .gemspec
同一页面提供了一个示例:
gem 'cf-copilot',
git: 'https://github.com/cloudfoundry/copilot',
glob: 'sdk/ruby/*.gemspec'
所以就你而言,它需要是:
gem 'aws-sdk',
:git => 'https://github.com/suvrat-joshi/aws-sdk-ruby.git',
:branch => 'retry-throttled-cf-requests',
:glob => 'gems/aws-sdk/aws-sdk.gemspec'