Gem [resolved] 尝试用 Jira4r 这个 gem 通过 soap 操作 Jira,但 require 失败

ted · 2012年08月21日 · 最后由 xingcan 回复于 2015年06月17日 · 3867 次阅读
C:\Documents and Settings\ted>gem install soap4r
Successfully installed soap4r-1.5.8
1 gem installed
Installing ri documentation for soap4r-1.5.8...
Installing RDoc documentation for soap4r-1.5.8...

C:\Documents and Settings\ted>gem install jira4r
Fetching: jira4r-0.3.0.gem (100%)
Successfully installed jira4r-0.3.0
1 gem installed
Installing ri documentation for jira4r-0.3.0...
Installing RDoc documentation for jira4r-0.3.0...

C:\Documents and Settings\ted>irb
irb(main):001:0> require 'jira4r/jira4r'
LoadError: cannot load such file -- jira4r/jira4r
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from (irb):1
        from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):002:0>

所需的两个 gem(soap4r 和 jira4r)都成功 install 了,但是在 irb 中按照教程 require 就抱错,cannot load such file,gem 不是装上了吗?

http://svn.atlassian.com/svn/public/contrib/jira/jira-rpc-samples/src/ruby/jira4rsample.rb http://jira4r.rubyhaus.org/2+minute+walkthrough

require 'jira4r/jira4r'换成 require 'jira4r'试试。

我想说我遇到一些问题,都是require写错了。

我将 require 'jira4r/jira4r',换作了 'jira4r',结果得到了更多的抱错...

irb(main):002:0> require 'jira4r'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/charset.rb:13: warning:
 variable $KCODE is no longer effective
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
iconv will be deprecated in the future, use String#encode instead.
RuntimeError: XML processor module not found.
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/xmlparser.
rb:74:in `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/parser.rb
:9:in `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/processor
.rb:12:in `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/rpc/proxy
.rb:10:in `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/rpc/drive
r.rb:12:in `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jira4r-0.3.0/lib/jira4r.rb:2:in
 `<top (required)>'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:i
n `require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:i
n `rescue in require'
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:i
n `require'
        from (irb):2
        from C:/Ruby193/bin/irb:12:in `<main>'irb(main):003:0>

终于找到解决方案了,记录在这里吧,日后说不定有人会用的上:

1、require 'jira4r' 而非 require 'jira4r/jira4r' 2、(irb 中) require 'jira4r' 后会出现‘XML processor module not found’的抱错提示,其解决办法是 (windows 下面)

  • 打开 C:\Ruby193\lib\ruby\gems\1.9.1\gems\soap4r-1.5.8\lib\xsd\xmlparser.rb
  • 将其中 66 行的 c.to_s.downcase == name 改为 c.to_s.downcase == name

solution credit goes to: http://railsforum.com/viewtopic.php?id=41231

收工,终于可以在 Ruby 里面 talk to Jira, hi5

正准备找个 jira 库,试用一下

刚试试了一下,的确不错。。。

刚试了 好用

需要 登录 后方可回复, 如果你还没有账号请 注册新账号