标签: jruby

srub插件为jruby

是否有sbt可用的插件自动安装JRuby并添加一些钩子以在某些点自动运行脚本(例如在编译之前).

背景:对于(升力)项目,我想使用sass,或者更具体地说,罗盘作为生成css的工具.遗憾的是,sass的Java或Scala克隆是不够的.

当然,手动生成css然后将两者都放在存储库中并且没有人需要关心它根本不是问题.

另一方面,为了简化多个系统的开发,我宁愿在sbt中有一个明确的依赖,这只是简单的工作.

有没有办法实现这个目标?
或者通常:有没有办法从Scala内部运行JRuby脚本?

编辑添加maven-2到标签.也许有一个JRuby的maven回购允许我以某种方式交付和使用它.

maven-2 scala jruby sass sbt

5
推荐指数
1
解决办法
578
查看次数

使JRuby继承Java代理设置

我想从JRuby上运行的Rails代码发出HTTP请求.

我怎样才能重新使用http.proxyHost,http.proxyPort和http.nonProxyHosts设置,给JVM运行它?

ruby proxy http jruby jrubyonrails

5
推荐指数
1
解决办法
1996
查看次数

你如何在Java中使用Ruby?

使用JRuby,您可以在Ruby中使用Java库.在Java中使用Ruby库是否相反?

具体来说,我想编写一个Eclipse插件,我需要在这个用Ruby编写的库中使用一堆遗留函数.

ruby java jruby

5
推荐指数
1
解决办法
1700
查看次数

在rails3/jruby中,间歇性地导致此错误的原因是什么?SAVEPOINT active_record_1不存在

当一个人测试系统时,不会发生这些错误.但是通过jmeter测试,我可以非常可靠地重现一些错误:

ActiveRecord::JDBCError: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1

Stack:

    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `log'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:208:in `execute'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/mysql/adapter.rb:156:in `rollback_to_savepoint'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:179:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:171:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:240:in `save'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:239:in `save'
    ...(our code that simply calls save on a new instance of a model class)...
Run Code Online (Sandbox Code Playgroud)

我们不是嵌套事务,甚至没有明确地使用它们.我发现此错误消息存在一个现有错误,但它不相关; 我们没有截断或做任何DDL工作.仅仅创建一个记录并保存它.

我们使用Rails 3.0.10,JRuby 1.6.5,activerecord-jdbcmysql-adapter,使用Warbler 1.3.2进行了警告,并通过Elastic Beanstalk在64位Tomcat 7/Amazon RDS上使用单个Mysql实例v5.1.57进行部署.我们为config.threadsafe设置了! - 这感觉就像在ActiveRecord的内容中出现某种类型的种族 - 但ActiveRecord应该在线程安全中工作,不是吗?

最后一点:我担心这是一个JRuby或Warbler问题,因为如果我们从JRuby切换到MRI Ruby 1.9,我们就无法重现这个问题.

ruby jruby warbler ruby-on-rails-3 amazon-elastic-beanstalk

5
推荐指数
1
解决办法
566
查看次数

当我希望它使用常规ruby时,New Rails应用尝试在"bundle install"上使用jruby,有错误吗?

我过去做了很多rails和ruby工作(使用rvm,有许多不同类型的红宝石),但最近还没有完成任何ruby工作.我只是尝试制作一个新的rails应用程序,以确保我的技能不生锈,使用以下设置:

使用系统ruby:

哪个ruby:/ usr/bin/ruby
ruby -v:ruby 1.8.7(2008-08-11> patchlevel 72)[i586-linux]

rails -v:Rails 3.0.7

当我输入:rails new TestApp我得到一个新的rails应用程序,带有Gemfile,一切似乎都很好.

在TestApp内部,当我运行时:

捆绑安装

我明白了:

http://pastie.org/2986861

令我沮丧的是:

org/jruby/RubyArray.java:1671:in `each': Detected invalid array contents due to unsynchronized modifications with concurrent users (ConcurrencyError)
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/spec_set.rb:12:in `each'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/installer.rb:49:in `run'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/installer.rb:8:in `install'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/cli.rb:222:in `install'
from org/jruby/RubyObject.java:1334:in `send'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/vendor/thor/task.rb:21:in `run'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/vendor/thor/base.rb:389:in `start'
from /home/jenny/lib/ruby/gems/1.8/gems/bundler-1.0.13/bin/bundle:13:in `(root)'
from org/jruby/RubyKernel.java:1066:in `load'
Run Code Online (Sandbox Code Playgroud)

这似乎意味着捆绑包使用jruby(并且在执行此操作时出错并且无法执行我的捆绑安装).

这里有什么明显的错误吗?我正在使用新的rails应用程序附带的默认gem文件...(在这里找到:http://pastie.org/2986869)

我最后一次做任何轨道工作,一切都很好......但那是不久前(几个月,也许近一年?).有什么我忘了吗?

编辑:

哪个bundle:/ home/jenny/bin/bundle哪个rails:/ home/jenny/bin/rails

我不相信自己目前正在使用RVM,但只是为了确保我确保rvm指向系统ruby(所以rvm或不,它应该使用相同的东西).

编辑:"rvm …

ruby jruby ruby-on-rails-3

5
推荐指数
1
解决办法
896
查看次数

使用JRuby和rbenv指定1.9模式

我有2个应用程序,一个需要在1.8模式下运行JRuby 1.6.5,另一个需要在1.9模式下运行JRuby 1.6.7.是否可以在应用程序中指定我希望一个应用程序在1.9模式下运行,而无需显式设置JRUBY_OPTS环境变量.在.rvmrc中,我可以执行以下操作:

proj_1_8 version of .rvmrc
unset JRUBY_OPTS
rvm use jruby-1.6.5@proj_1_8

proj_1_9 version of .rvmrc
export JRUBY_OPTS=--1.9
rvm use jruby-1.6.7@proj_1_9
Run Code Online (Sandbox Code Playgroud)

无论如何,我可以自动获取模式集,而无需在项目之间切换时手动设置/取消设置环境变量?

jruby rbenv

5
推荐指数
1
解决办法
1651
查看次数

在jRuby中使用'fork'生成进程的替代方法?

在MRI Ruby中,我可以这样做:

def transfer
  internal_server = self.init_server
  pid = fork do
    internal_server.run
  end

  # Make the server process run independently.
  Process.detach(pid)

  internal_client = self.init_client
  # Do other stuff with connecting to internal_server...
  internal_client.post('some data')    
ensure
  # Kill server
  Process.kill('KILL', pid) if pid
end
Run Code Online (Sandbox Code Playgroud)

但是上面的代码不会在jRuby中运行,因为它不支持'fork'方法:

NotImplementedError: fork is not available on this platform
Run Code Online (Sandbox Code Playgroud)

在jRuby中有没有替代解决方案?

谢谢.

ruby jruby

5
推荐指数
2
解决办法
3924
查看次数

尝试使用橡胶部署jRoR应用程序并获取NoMethodError:nil的未定义方法`authorize_port_range':NilClass

这是我第一次使用橡胶或部署到Amazon EC2.我正在关注这个Railscast.我已经用Google搜索了,似乎没有其他人遇到这个问题.这是运行时的控制台日志cap rubber:create_staging:

user529789@user529789-M15x:~/develops/grouper$ cap rubber:create_staging
    triggering load callbacks
  * executing `rubber:init'
  * executing `rubber:create_staging'
Hostname to use for staging instance [production]: 
Roles to use for staging instance [apache,app,collectd,common,db:primary=true,elasticsearch,examples,graphite_server,graphite_web,graylog_elasticsearch,graylog_mongodb,graylog_server,graylog_web,haproxy,mongodb,monit,passenger,postgresql,postgresql_master,web,web_tools]: 
  * executing `rubber:create'
Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket
Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket
  * Creating new security group: grouper_production_default
  * Creating new rule: {"source_group_name"=>"grouper_production_default", "source_group_account"=>"<account id redacted>"}
[DEPRECATION] authorize_group_and_owner is deprecated, use authorize_port_range with :group option instead
  * Creating new rule: …
Run Code Online (Sandbox Code Playgroud)

jruby jrubyonrails amazon-ec2 fog

5
推荐指数
1
解决办法
364
查看次数

为什么我的Tomcat JRuby应用程序中永远不会释放内存?

我有一个JRuby on Rails应用程序,它运行在Tomcat(Warble)中.它使用Java桥连接到Progress(OpenEdge)应用程序服务器......当我监视内存时,它只会继续运行.

  • Tomcat 7.0
  • JRuby 1.6.7.2(Ruby-1.9.2-p312)
  • JVM 1.7.0.25
  • Rails 3.2.7
  • jruby-rack 1.1.7
  • 鸣鸟1.3.6

在这里找到问题的最佳方法是什么?我想它可能是未清理的JRuby对象,或者是Java桥或垃圾收集器中没有完成其工作的东西......

即使我让这个过程运行了半个小时,内存也不会下降......

  • 有没有办法知道哪些物体还活着?
  • 是否有易于使用的免费工具,通过这些工具,我可以获得有关谁使用所有内存的更多信息?

By the way, I already have configured the Tomcat server to use more memory, but that's just delaying a heap space error...

EDIT: What I'm actually seeing is that Tomcat just uses all the memory that it can maximum use (Maximum memory pool). And it never releases it. Maybe it's just normal behavior... I've now set maximum to 256MB for example and …

java tomcat ruby-on-rails jruby jrubyonrails

5
推荐指数
1
解决办法
898
查看次数

JRuby 9k不适用于Puma和扭矩盒4

我的应用程序在jruby-1.7.12和puma和扭矩盒4上运行良好。

我正在尝试使用彪马和扭矩盒4的最新jruby-graal(9k)。

但是我的服务器尚未开始使用jruby-graal。这就是卡住的地方。

krunal@krunal-Lenovo-IdeaPad-U530-Touch:~/code/test$ rails s puma 
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)
Run Code Online (Sandbox Code Playgroud)

jruby jrubyonrails torquebox puma

5
推荐指数
0
解决办法
226
查看次数