开发者

Ruby not properly understand what gems are installed when running from Jenkins?

I have a Jenkins job that is supposed to run. The job description is as follows:

SVN update the workspace repository

Run the following Windows batch command "ruby -d tester.rb"

When I run this command from the command line on the master machine (which is a physical machine in front of me), the script runs no problem

When I run a seperate job that calls "ruby -v", it sees the correct version of ruby.

When I run a seperate job that calls "gem list", it sees the correct version of ruby.

However when I run the job described at the top, I get errors that none of the gems listed as being installed by "gem list" are installed, and my script does not run.

Can anyone provide a suggestion?

for more information here is code from a run with a bit of a combination of 开发者_Python百科the data:


[workspace] $ cmd /c call C:\Windows\TEMP\hudson3791189246243258127.bat

C:\Program Files (x86)\Jenkins\jobs\job1\workspace>ruby -r rubygems -e "p Gem.path" 
["C:/Windows/system32/config/systemprofile/.gem/ruby/1.8", "C:/Ruby187/lib/ruby/gems/1.8"]

C:\Program Files (x86)\Jenkins\jobs\job1\workspace>cd .qa_automation\trunk 

C:\Program Files (x86)\Jenkins\jobs\job1\workspace\.qa_automation\trunk>set GEM_HOME=c:\Ruby187\lib\ruby\gems\1.8 

C:\Program Files (x86)\Jenkins\jobs\job1\workspace\.qa_automation\trunk>ruby -d _Tester.rb config\portalconfigPROD.txt compare_IWT_Main_TSS 
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- random_data
Exception `NoMethodError' at C:/Ruby187/lib/ruby/1.8/rational.rb:78 - undefined method `gcd' for Rational(1, 2):Rational
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- uuidtools
Exception `NameError' at C:/Ruby187/lib/ruby/gems/1.8/gems/uuidtools-2.1.2/lib/uuidtools/version.rb:25 - uninitialized constant UUID
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- builder
./lib/Portal/Session.rb:379: warning: statement not reached
./lib/Portal/Session.rb:434: warning: statement not reached
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- selenium-webdriver
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- yajl/json_gem
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60 - no such file to load -- yajl/json_gem
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- json/ext/parser
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60 - no such file to load -- json/ext/parser
Exception `LoadError' at C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60 - no such file to load -- json/ext/parser
Using Pure library for JSON.
_Tester.rb:78: warning: already initialized constant ARGV
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/remote/capabilities.rb:171: warning: method redefined; discarding old proxy=
C:/Ruby187/lib/ruby/gems/1.8/gems/ffi-1.0.9-x86-mingw32/lib/ffi/struct.rb:225: warning: discarding old align
Exception `LoadError' at C:/Ruby187/lib/ruby/gems/1.8/gems/ffi-1.0.9-x86-mingw32/lib/ffi/library.rb:133 - LoadError
Exception `LoadError' at C:/Ruby187/lib/ruby/gems/1.8/gems/ffi-1.0.9-x86-mingw32/lib/ffi/library.rb:133 - LoadError


For a quick hack, try running the command "ruby -d tester.rb", with the file path to ruby where your gems are installed.

So for example "/users/llaskin/lib/bin/ruby -d tester.rb".

Also if you have used RVM to install your ruby and gems, and have installed multiple versions, rvm messes things up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜