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

10th
Apr 2016
Christian Meier
@mkristian
Apr 10 2016 05:35
@ysb33r require "rack" Rack::Server.start for the initScript will start up a rack server which is configured in config.ru
Schalk W. Cronjé
@ysb33r
Apr 10 2016 16:13
@mkristian I cannot get the thing to work. Using the config.ru does not work correctly as it is looking for it on disk rather than in the JAR. Also my attempt to put a small wrapper class does not seem to work (even though it is based on a working example I had from earlier version of JRubyJar). If you have a chance, have a look at https://github.com/ysb33r/theInternetWebsiteTestInAJar and tell me what I am doing wrong.
my nr1 priority use-case here, is to fire it up on a separate thread in a Spock test so that I can demonstrate use of Geb for testing web UIs. Having it as a standalone executable JAR would be nicem but that is nr2.
Christian Meier
@mkristian
Apr 10 2016 16:28
@ysb33r one thing is to use the IsolatedScriptingContainer which could do the whole trick, but not sure more is needed
is your example complete - the downloaded ruby app is complete, etc ? will have a look at your repo
Schalk W. Cronjé
@ysb33r
Apr 10 2016 17:01
@mkristian the downloaded ruby app is complete. It runs if run via JRubyExec (that’s the runApp task). So I know it works. It’s about getting working from inside a JAR.
Christian Meier
@mkristian
Apr 10 2016 17:01
ok will have look - a bit later this evening ;)
Schalk W. Cronjé
@ysb33r
Apr 10 2016 17:12
thanks. I’ll play with IsolatedScriptingContainer in the mean time
Schalk W. Cronjé
@ysb33r
Apr 10 2016 18:10
what I don;t understand is what it is jruby command-line does differently to ScriptingContainer so that server.rb runs.
Christian Meier
@mkristian
Apr 10 2016 19:32
@ysb33r ysb33r/theInternetWebsiteTestInAJar#1
which allows to startup the app via java. if you need something slightly different let me know. the ScriptingContainer just did not work - could not get a grip on this, some error not showing up and needs more digging then the jar-bootstrap.rb thing I did in this PR
Schalk W. Cronjé
@ysb33r
Apr 10 2016 19:46
Thanks! I was not quite stupid then.
BTW I was wondering. Is there a wat to tell JarMain to use anotehr bootstrap script? I was thinking of the case where on might more that one JAR on the classpath packaged in the same way.
anyway I should put it on my backlog to add this as an example to the jrubyjar docs
Christian Meier
@mkristian
Apr 10 2016 19:49
you can leave the jar-bootstrap.rb out of the jar and just execute java -cp jruby-complete-9.0.5.0.jar:theInternetWebsiteTestInAJar-jruby-0.49.1.jar:jruby-mains-0.5.0.jar org.jruby.mains.JarMain the-internet/server.rb
no need for this bootstrap script
Schalk W. Cronjé
@ysb33r
Apr 10 2016 19:50
ah!
so one could create a simple java class as a wrapper which just invokes JarMain.main(“the-internet/server.rb”) ?
Christian Meier
@mkristian
Apr 10 2016 19:52
that will do
Schalk W. Cronjé
@ysb33r
Apr 10 2016 19:53
I also just realised that if we do it this way, the POM file will not list jruby-mains.
So I’ll need to add it to compile.
Christian Meier
@mkristian
Apr 10 2016 19:54
yes, I was just playing with command-line from a shell
Schalk W. Cronjé
@ysb33r
Apr 10 2016 19:55
nice! I think we have actually discovered a useful use-case here.
Christian Meier
@mkristian
Apr 10 2016 19:56
:)
Schalk W. Cronjé
@ysb33r
Apr 10 2016 20:03
If I start it up in a thread, do you know of anyway to tell it to stop?
Christian Meier
@mkristian
Apr 10 2016 20:05
I tried to start the ScriptingContainer in its own thread but this failed on loading some resources. that was the point where I gave up - was not very persistent here, I have to admit.
Schalk W. Cronjé
@ysb33r
Apr 10 2016 20:06
what I mean is it I start up JarMain in a thread, is there a way that will react to being interrupted?
Christian Meier
@mkristian
Apr 10 2016 20:08
no idea as this is just the regular jruby Main with some extra setups to run from all inside a jar.
just try it, could just behave well
Schalk W. Cronjé
@ysb33r
Apr 10 2016 20:36
have I ever mentioned that Java irritates me