如何在IronWorker中捆绑本地gem依赖项

时间:2012-11-09 09:59:34

标签: ruby ironworker iron.io

我有一个Ruby IronWorker,它依赖于未发布到RubyGems的私有gem。

有没有办法在mygemname-0.0.1.gem文件中将此本地.worker合并到我的IronWorker中?

我希望能够在myruby.worker中指定以下内容:

gem 'mygemname', '>=0.0.1', :path=> 'vendor/bundle'

目前,这会产生以下错误

.rvm/gems/ruby-1.9.3-p0/gems/iron_worker_ng-0.12.2/lib/iron_worker_ng/code/base.rb:79 :in `eval':
   wrong number of arguments (3 for 2) (ArgumentError)

希望默认值为:

 gem 'mygemname', '>=0.0.1'

给出以下错误

Could not find gem 'mygemname (>= 0.0.1) ruby' in the gems available on this machine. 

我是否正在通过.worker文件试图让它工作?或者我应该考虑指定自定义构建步骤吗?

2 个答案:

答案 0 :(得分:3)

如果未发布的gem本身具有依赖关系,则需要进行一些按摩以使事情顺利进行。这是一种适合我的技术:

mygem.worker

runtime "ruby"

#Merge in an unpublished local gem
dir '../opensource-cli-tools/facebook_exporter', '__gems__/gems'
file '../opensource-cli-tools/facebook_exporter/mygem.gemspec', '__gems__/specifications'

#Merge in a custom build script to fetch the unpublished gem's dependancies
file "Gemfile"
file "install_dependancies.sh"

remote_build_command 'chmod +x install_dependancies.sh && ./install_dependancies.sh'

#Run the puppy!
exec "run.rb"

install_dependancies.sh

echo "Installing dependancies to __gems__/"
gem install bundler --install-dir ./__gems__ --no-ri --no-rdoc
bundle install --standalone --path ./__gems__
cp -R ./__gems__/ruby/*/* ./__gems__
rm -rf ./__gems__/ruby
echo "Fixing install location of mygem"
mv ./__gems__/gems/mygem ./__gems__/gems/mygem-0.0.1

答案 1 :(得分:2)

据我所知,git和本地路径现在不受支持。 以下是手动包含本地gem的方法: 将这些行添加到.worker文件:

dir '../vendor/bundle/mygemname', '__gems__/gems'
file '../vendor/bundle/mygemname/mygemname.gemspec', '__gems__/specifications'
相关问题