[英]Installing a gem (rvm_gem) from a private gem repository with Chef?
[英]Installing a Ruby gem from a Github repository using Chef?
有沒有辦法從它的Github倉庫(或更具體地說,一個分支)而不是從Rubygems安裝Ruby gem?
我試過了
gem_package 'some_gem' do
source 'git://github.com:user/some_gem.git'
end
我明白了
Gem::Exception
--------------
Cannot load gem at [git://github.com:user/some_gem.git] in /
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/some_recipe/recipes/default.rb
15: gem_package 'some_gem' do
16: source 'git://github.com:user/some_gem.git'
17: end
18:
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/some_gem/recipes/default.rb:15:in `from_file'
gem_package("some_gem") do
provider Chef::Provider::Package::Rubygems
action :install
retries 0
retry_delay 2
package_name "some_gem"
source "git://github.com:user/some_gem.git"
cookbook_name :some_cookbook
recipe_name "default"
end
我也嘗試了與源https://github.com/user/some_gem
相同的錯誤Illformed requirement [""]
。
我不確定這是完成任務的最佳方法,但我能夠通過這種方式完成:
# temporarily install gem from fork
git '/usr/local/src/mosql' do
repository 'https://github.com/roadtrippers/mosql.git'
end
execute 'gem build mosql.gemspec' do
cwd '/usr/local/src/mosql'
end
gem_package 'mosql' do
source '/usr/local/src/mosql/mosql-0.2.0.gem'
end
mosql是我正在安裝的分叉gem的名稱。
這里的注意事項是版本被放入.gem文件的名稱,所以我必須提前知道。
相當古老的問題,但您可以使用http://community.opscode.com/cookbooks/gem_specific_install
我沒有積極維護它,但我對新PR很開放
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.