These are chat archives for jruby-gradle/jruby-gradle-plugin

1st
Aug 2016
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:13
Hello everyone, I'm new to gradle as well as jruby/gradle. Could someone point me to example were the initScript in a jrubyJar requires other ruby files in the local lib/* directory
Christian Meier
@mkristian
Aug 01 2016 11:15
@mrinalwadhwa local filesystem ? then you need to set the current directory to it: Dir.chdir(ENV_JAVA['user.dir'])
otherwise the current working directory of ruby is inside the jar-file
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:16
in the jar
my LOAD_PATH modification didn't work, I suppose $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
Christian Meier
@mkristian
Aug 01 2016 11:18
is you jar bundling up the lib/** ? could you just verify the LOAD_PATH with p $LOAD_PATH ?
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:19
checking, thanks
LOAD_PATH: ["c/../lib", "uri:classloader://", "uri:classloader:/META-INF/jruby.home/lib/ruby/2.3/site_ruby", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib"]
Christian Meier
@mkristian
Aug 01 2016 11:20
are you on windows ?
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:21
nope linux
debian
Christian Meier
@mkristian
Aug 01 2016 11:23
oh - so then I would like to know File.dirname(__FILE__) ? FYI the init script will be in the root of the jar-file not inside the lib directory
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:25
File.dirname(__FILE__) is "c"
ah I see I place the initScript in bin/
that is not true once it is in the jar
Christian Meier
@mkristian
Aug 01 2016 11:26
sorry I wanted to see __FILE__
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:26
no problem, one sec
Christian Meier
@mkristian
Aug 01 2016 11:27
the c is bothering me a bit from POV of jruby
yes, the initscript will be in bin/.. after packing it
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:27
"classpath:jar-bootstrap.rb"
also does not look like my jar actually has the lib dir, does everything in the directory where build.gradle is get included? or do I have to specify (I assume the gemspec has no effect)
Christian Meier
@mkristian
Aug 01 2016 11:31
thanks - I think you found a jruby bug - will find some time to investigate. but your problem is more like the assumption about the file location. you have to add somehting like from '.' includes '**' (sorry my gradle syntax might be out of the way - it is a while ago now, I am more the jruby guy here)
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 11:34
Thank you, I appreciate the help, will try and report back (loving jruby btw, will become a goto tool for me I think)
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 12:14
This worked into('lib') { from 'lib' }
Christian Meier
@mkristian
Aug 01 2016 12:14
:)
Mrinal Wadhwa
@mrinalwadhwa
Aug 01 2016 12:14
Thanks @mkristian :)
Christian Meier
@mkristian
Aug 01 2016 12:15
welcome
Blane Dabney
@raelik
Aug 01 2016 15:11
@mrinalwadhwa One thing to recognize about jruby is that since the 9.0.0.0 release they've stopped maintaining complete backwards compatibility with prior MRI releases. So, if your app is non-functional with 2.0 and requires 1.8/1.9, you'll have to stick with the 1.7.x series. Likewise, 9.1.x.x is 2.3 compatible, so if your app doesn't work with 2.3 (i.e. Rails 3.x apps), then you have to stick with 9.0.x.x