문제

Is there a way to use a locally packaged jruby gem inside a ruby on rails application that uses MRI?

I currently use the following:

platform :jruby do gem 'my_gem', path: "path_to_my_gem" end

and I am not sure if it works. The gem is a bench of rake tasks, which I can't see when I run rake -T.

Any ideas?

도움이 되었습니까?

해결책

there is no such thing as a jruby gem per se. it's the platform that you configure your gem to run on in the gem specification.

this is what bundler uses to split up groups so that you can include platform specific gems.

in the case of jruby, the platform is the JVM. so if you want to invoke tasks that require a java integration you need to run them with jruby.

so the short answer is: NO

the long answer is that there are several ways to invoke stuff from MRI.

you could shell out and run jruby via the commandline to issue a command on that gem.

you could use the ruby java bridge to interact with java directly, maybe even load the gem in some weird kind of way through a ScriptContainer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top