1

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

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

我希望能够在 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 文件让它工作?还是我应该考虑指定自定义构建步骤?

4

2 回答 2

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
于 2012-11-12T07:44:45.537 回答
2

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

dir '../vendor/bundle/mygemname', '__gems__/gems'
file '../vendor/bundle/mygemname/mygemname.gemspec', '__gems__/specifications'
于 2012-11-09T15:51:06.377 回答