我是 ruby 新手,并创建了一个使用 Git gem 的脚本。( require 'git'
)。我必须向 jenkins 执行这个脚本,并为此添加了一个Gemfile
andGemfile.lock
条目如下:
Gemfile
source 'https://rubygems.org'
gem 'pg'
gem 'git', '~> 1.3'
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
pg (0.18.4)
git (1.3.0)
PLATFORMS
ruby
DEPENDENCIES
pg
git
当尝试使用以下命令通过 jenkins 执行脚本时:
#!/bin/bash -l
rvm use 1.9.3
bundle install --gemfile Gemfile --deployment
bundle exec ruby processMetadata.rb
请帮我解决下面提到的错误:
Using /usr/local/rvm/gems/ruby-1.9.3-p551
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* git (~> 1.3)
You have deleted from the Gemfile:
* git
/usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/definition.rb:181:in `rescue in specs': Your bundle is locked to git (1.3.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of git (1.3.0) has removed it. You'll need to update your bundle to a different version of git (1.3.0) that hasn't been removed in order to install. (Bundler::GemNotFound)
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/definition.rb:175:in `specs'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/definition.rb:235:in `specs_for'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/definition.rb:224:in `requested_specs'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/runtime.rb:118:in `block in definition_method'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/runtime.rb:19:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler.rb:99:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.13.1/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
Build step 'Execute shell' marked build as failure