jenkinsci / jenkins.rb

Deprecated, see https://www.jenkins.io/jep/7
393 stars 83 forks source link

fix pathname bug when running in jruby in 1.9 mode. #58

Closed echohead closed 12 years ago

echohead commented 12 years ago

when running jruby in 1.9 compat mode, jenkins-plugin-runtime fails with the following error: jenkins-plugin-runtime-0.2.2/lib/jenkins/plugin/specification.rb:109:in `eval': can't convert Pathname into String (TypeError)

this commit allows the gem to work in both 1.8 and 1.9 by explicitly converting the Pathname to String.

the difference in how Pathnames are handled can be illustrated in the shell: $ echo "puts 'ok'" > foo $ JRUBY_OPTS=--1.8 ruby -e "puts RUBY_VERSION; require 'pathname'; p = Pathname.new('foo'); eval(File.read(p), nil, p, 0)" 1.8.7 ok $ JRUBY_OPTS=--1.9 ruby -e "puts RUBY_VERSION; require 'pathname'; p = Pathname.new('foo'); eval(File.read(p), nil, p, 0)" 1.9.2 TypeError: can't convert Pathname into String eval at org/jruby/RubyKernel.java:1088 (root) at -e:1

buildhive commented 12 years ago

Jenkins » jenkins.rb #15 SUCCESS This pull request looks good (what's this?)

joemiller commented 12 years ago

this looks good to me. it allows jpi to run on jruby 1.7.0 which defaults to 1.9 mode. will this PR be merged soon? jruby 1.7.0 is the latest release now.

hsbt commented 12 years ago

@joemiller I can't merged it cause to I don't want to version bump. but I'll fixing this problem soon.

hsbt commented 12 years ago

@echohead Thanks for your PR. I already fixed this problem with other code. Please try jpi-0.3.8.

If it solved your problrem. Please close this PR.