gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 17:37:11 25 4
gpt4 key购买 nike

我有一个 Ruby IronWorker,它依赖于未发布到 RubyGems 的私有(private) 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 文件让它工作?还是我应该考虑指定自定义构建步骤?

最佳答案

如果您未发布的 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

关于ruby - 如何在 IronWorker 中捆绑本地 gem 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13305823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com