Question

I have a Ruby IronWorker which depends on a private gem that isn't published to RubyGems.

Is there a way to merge this local mygemname-0.0.1.gem into my IronWorker in the .worker file?

I'm hoping to be able to specify something the following in myruby.worker:

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

Currently this give the following error

.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)

Hoping for defaults gives:

 gem 'mygemname', '>=0.0.1'

Gives the following error

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

Am I on the right track trying to get this to work via the .worker file? Or should I be looking into specifying a custom build step?

Was it helpful?

Solution 2

As far as i know, git and local paths unsupported right now. Here is way to manually include local gem: Add these lines to .worker file:

dir '../vendor/bundle/mygemname', '__gems__/gems'
file '../vendor/bundle/mygemname/mygemname.gemspec', '__gems__/specifications'

OTHER TIPS

If your unpublished gem itself has dependancies, you need to do a little massaging to get things going. Here is a technique that works for me:

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top