jruby

JRuby 1.7.0 will not install bundler given plenty of memory

天涯浪子 提交于 2019-12-10 22:46:22
问题 I installed jruby with rvm install jruby-1.7.0 and it ran out of memory when it tried to create the gemsets so I started by trying to install bundler with the new version and this is what I get ~>gem install bundler Error: Your application used more stack memory than the safety cap of 2048K. Specify -J-Xss####k to increase it (#### = cap size in KB). Specify -w for full StackOverflowError stack trace So I moved up the memory and I still got nothing with a huge chunk of memory ~>JRUBY_OPTS=-J

Rails: How can my app tell if it is running in MRI or JRuby?

淺唱寂寞╮ 提交于 2019-12-10 21:45:42
问题 In a previous question, I asked how to tell my Gemfile whether to take the JRuby-relevant gems or the MRI-relevant gems. The answer I got was to do the following in the Gemfile: platforms :jruby do gem "activerecord-jdbcsqlite3-adapter" end platforms :mri do gem "sqlite3" end Obviously, the platforms() method in Bundler knows how to figure out if I'm running MRI or JRuby. Is there another way I can tell within my program if I am running JRuby or MRI? 回答1: Are you able to distinguish between

Using rails' “post” in controller tests in rspec with scoping and protocol on routes

牧云@^-^@ 提交于 2019-12-10 21:42:35
问题 I have a rails project that is running out of a subdirectory of the base url in production and I want it to act that way in dev so as to make dev and prod as close as possible. I have the routes file set up like so: Foo::Application.routes.draw do def draw_routes root :to=>'foo#home' resources :cats, :only=>[:create] do end if Rails.env.production? scope :protocol=>'http://' do draw_routes end else scope :path=>"/foo", :protocol=>'http://' do draw_routes end end end My CatsController is like

Assigning a Java package to a JRuby class

坚强是说给别人听的谎言 提交于 2019-12-10 17:29:48
问题 (This isn't a homework question, as it's above and beyond the class just for my personal interest.) In my Java class this semester, our instructor is giving us the compiled JUnit tests that our completed labs should pass. For example, our first lab was to design this class: package java112.labs1; public class MysteryClassOne { public int mysteryMethodOne() { return 1; } } This is very trivial Java code and to give myself a bit more of a challenge as I've had previous Java experience, I'd like

RVM reports Gemfile ruby as not installed

笑着哭i 提交于 2019-12-10 17:22:22
问题 In my Gemfile, I have specified: ruby '1.9.3', engine: 'jruby', engine_version: '1.7.9' But entering my Rails project directory makes rvm throw up this error: RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, you can ignore these warnings with 'rvm rvmrc warning ignore /home/petey/rails/kotoba/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. ruby-1.9.3,engine:jruby,engine_version:1.7.9 is not installed. To install do:

IntelliJ & JRuby: how to setup project?

落爺英雄遲暮 提交于 2019-12-10 15:17:22
问题 I've downloaded a trial version of IntelliJ 13 and I've installed the latest JRuby version for Windows. I've searched thoroughly on the net, but have been unable to find any guidance as to how to setup a JRuby project in IntelliJ. I've chosen IntelliJ as opposed to RubyMine as it should have better support for Java/Ruby integration (see http://devnet.jetbrains.com/docs/DOC-1146). So in short; how do I setup IntelliJ for a JRuby project - perhaps just a simple hello world example? 回答1: so in

Ruby parser in Java

 ̄綄美尐妖づ 提交于 2019-12-10 14:49:51
问题 The project I'm doing is written in Java and parsers source code files. (Java src up to now). Now I'd like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses Ruby source code. The only thing I have been able to find up to now are Ruby parsers in Ruby (ParseTree and RubyParser...). I could maybe parse the source files I want with a Ruby parser in JRuby, and then access my Java stuff from there. But that would mean that I will not be able to reuse a lot

Make JRuby inherit Java proxy settings

若如初见. 提交于 2019-12-10 14:46:12
问题 I would like to make HTTP requests from Rails code running on top of JRuby. How can I make it to re-use http.proxyHost, http.proxyPort and http.nonProxyHosts settings, given to JVM running it ? 回答1: To pass JVM flags through JRuby, use -J... . In this case: jruby -J-Dhttp.proxyHost=foo -J-Dhttp.proxyPort=1234 -J-Dhttp.nonProxyHosts="*.bar.com" ... This is explained in JRuby's help text. -J[java option] pass an option on to the JVM (e.g. -J-Xmx512m) use --properties to list JRuby properties

JRuby on Rails: Using custom Java classes in your Rails app

限于喜欢 提交于 2019-12-10 13:23:12
问题 I just started with JRuby on Rails and absolutely love it. I know how to use current classes within the Java API in my Rails app, but if I wanted to create a new custom class written in purely Java code, how would I be able to use it in my Rails app? For example, let's say I created Dog.java: class Dog { private String name; public Dog() { name = "Fido"; } public String getName() { return name; } } How would I be able to create a new Dog object (Dog.new) in my Rails app? I need to put the Dog

Why does devise put /devise/ in front of every link_to anchor?

拜拜、爱过 提交于 2019-12-10 11:41:57
问题 I just generated all the views for devise, and I'm starting to customize the login screen. It works great except for all the links that are generated on the sign in page start with "/devise". Why is it doing that? Seems like odd default behaviour How do I stop it from adding /devise to every link_to()? My routes file: devise_for :users get "/webpages/:page" => "webpages#show", :as => :show_webpage root :to => "webpages#index" My 'rake routes' new_user_session GET /users/sign_in(.:format) {