Windows(RVM)vs Linux(jruby):如何修复不同的gem要求?

时间:2015-05-23 14:27:37

标签: ruby-on-rails ruby-on-rails-4 bundler jruby railsinstaller

在Windows(RVM)上创建Rails应用程序并将它们部署到Linux(jRuby)时,我遇到了不兼容的gem要求。如何在Linux / jRuby端重新配置Rails需求,以便捆绑和运行应用程序?

由于 debug_inspector 仅存在于RVM上,因此gem要求不会捆绑在jRuby上。相反,捆绑者抱怨:

  

使用debug_inspector 0.0.2

     

Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。

[...]/jruby-1.7.20/bin/jruby -r ./siteconf20150523-28378-1i9zw09.rb extconf.rb
     

[...] / JRuby的1.7.20 / LIB /红宝石/共享/ mkmf.rb:14:   使用RbConfig而不是过时和弃用的Config。 mkmf.rb不能   找到ruby的头文件   [...] / JRuby的1.7.20 / LIB /天然的/包括/红宝石/ ruby​​.h

     

extconf失败,未捕获信号1

由于

#diff Gemfile.lock_rvm Gemfile.lock_jruby
2c2
<   remote: http://rubygems.org/
---
>   remote: https://rubygems.org/
32a33,37
>     activerecord-jdbc-adapter (1.3.16)
>       activerecord (>= 2.2)
>     activerecord-jdbcsqlite3-adapter (1.3.16)
>       activerecord-jdbc-adapter (~> 1.3.16)
>       jdbc-sqlite3 (>= 3.7.2, < 3.9)
40,41d44
<     binding_of_caller (0.7.2)
<       debug_inspector (>= 0.0.1)
43,44d45
<     byebug (5.0.0)
<       columnize (= 0.9.0)
52,53d52
<     columnize (0.9.0)
<     debug_inspector (0.0.2)
59c58
<     jbuilder (2.2.16)
---
>     jbuilder (2.2.13)
61a61
>     jdbc-sqlite3 (3.8.7)
66c66
<     json (1.8.2)
---
>     json (1.8.2-java)
72d71
<     mini_portile (0.6.2)
75,76c74,76
<     nokogiri (1.6.6.2-x86-mingw32)
<       mini_portile (~> 0.6.0)
---
>     nokogiri (1.6.6.2-java)
>     puma (2.11.2-java)
>       rack (>= 1.1, < 2.0)
107c107
<     sass (3.4.14)
---
>     sass (3.4.13)
119c119
<     sprockets-rails (2.3.1)
---
>     sprockets-rails (2.3.0)
123c123,125
<     sqlite3 (1.3.10-x86-mingw32)
---
>     therubyrhino (2.0.4)
>       therubyrhino_jar (>= 1.7.3)
>     therubyrhino_jar (1.7.6)
125c127
<     thread_safe (0.3.5)
---
>     thread_safe (0.3.5-java)
136,140d137
<     web-console (2.1.2)
<       activemodel (>= 4.0)
<       binding_of_caller (>= 0.7.2)
<       railties (>= 4.0)
<       sprockets-rails (>= 2.0, < 4.0)
143c140
<   x86-mingw32
---
>   java
146c143
<   byebug
---
>   activerecord-jdbcsqlite3-adapter
149a147
>   puma
153c151
<   sqlite3
---
>   therubyrhino
157d154
<   web-console (~> 2.0)

1 个答案:

答案 0 :(得分:3)

使用Gemfile中的gem "ruby-debug", :platforms => :mri_18 选项,例如

import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
import pylab 
pylab.show()
from matplotlib import style
style.use("ggplot")

def graphRawFX(): 
    date,bid,ask = np.loadtxt('XAUUSDS.txt', 
                              unpack=True, 
                              delimiter='\t'  ,
                              converters={0:mdates.strpdate2num('%d%m%Y%H%M%S%F')})
    fig=plt.figure(figsize=(10,7))
    ax1 = plt.subplot2grid((40,40), (0,0), rowspan=40, colspan=40)
    ax1.plot(date,bid)
    ax1.plot(date,ask)
    ax1.xaxis.set_major_formatter(mdates.DateFormatter('%d%m%Y %H:%M:%S:%F.'))

    for label in ax1.xaxis.get_ticklabels(): 
        label.set_rotation(45)
    plt.subplotls_adjust(bottom=.23)
    plt.gca().get_yaxis().get_major_formatter().setuseoffset(False)
    plt.grid(True)
    plt.show()
    graphRawFX()
    plt.savefig('foo.png')

if __name__=='__main__':
    graphRawFX()

http://bundler.io/v1.3/man/gemfile.5.html