JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5073

Unable to run scripts using -S if they aren't in the primary jruby.jar

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: JRuby 1.5.2
    • Fix Version/s: None
    • Component/s: Miscellaneous
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      I am attempting to create a gem called Jarbler. One of my goals is to make it very simple to take Gemfile's and set them up to be embedded in a jar.

      Unfortunately, the "-S script" command line doesn't want to let me run my commands. Even trying Nick Sieger's Gem in a Jar fails.

      After reviewing the code, I thought putting them in my own jar, in the path: /META-INF/jruby.home/bin would solve the problem, however jruby.home is resolved down to a jar:// style path for the primary jar.

      I have modified the RubyInstanceConfig to stop trying to be smart and to just use classpath:/META-INF/jruby.home/ when nothing is configured.

      All tests pass. The issue is resolved.

      Changeset: http://github.com/ericanderson/jruby/commit/523da7926974b32263bbc26b5402cddac56c8eca

        Activity

        Hide
        Eric Anderson added a comment -

        Yup.

        So, the if statement was just to short java's compiler while I made sure my change worked.

        Basically, you don't need to search into the exact jar to get a URL for the script you're looking for. jrubyHome can just be that location in the classpath.

        Show
        Eric Anderson added a comment - Yup. So, the if statement was just to short java's compiler while I made sure my change worked. Basically, you don't need to search into the exact jar to get a URL for the script you're looking for. jrubyHome can just be that location in the classpath.
        Hide
        Charles Oliver Nutter added a comment -

        So I believe we need to keep the code and drop the "if (true)", since Eric was just using it to test his fixes. I'm for rolling it into 1.5.4 (and master, of course).

        Show
        Charles Oliver Nutter added a comment - So I believe we need to keep the code and drop the "if (true)", since Eric was just using it to test his fixes. I'm for rolling it into 1.5.4 (and master, of course).
        Hide
        Charles Oliver Nutter added a comment -

        So here's the patch I came up with. Eliminates the "cleverness" and goes straight to classpath: URL if there's no jruby home set. Ideally "classpath:" URL should cover anything in classpath, so the file/jar stuff isn't needed. Right?

        Not sure if there's something I'm breaking with this...

        https://gist.github.com/663018

        Show
        Charles Oliver Nutter added a comment - So here's the patch I came up with. Eliminates the "cleverness" and goes straight to classpath: URL if there's no jruby home set. Ideally "classpath:" URL should cover anything in classpath, so the file/jar stuff isn't needed. Right? Not sure if there's something I'm breaking with this... https://gist.github.com/663018
        Hide
        Nick Sieger added a comment -

        It does break the new "test-jar-complete" ant target I made. The pre-installed rake is not found in the complete jar.

        I think we need to keep the existing behavior, but perhaps add some logic to allow -S to be smarter about bin scripts in jars.

        Show
        Nick Sieger added a comment - It does break the new "test-jar-complete" ant target I made. The pre-installed rake is not found in the complete jar. I think we need to keep the existing behavior, but perhaps add some logic to allow -S to be smarter about bin scripts in jars.
        Hide
        Charles Oliver Nutter added a comment -

        JRuby has moved bug tracking to Github, accessible via our Github page at https://github.com/jruby/jruby/issues, or via http://bugs.jruby.org. In addition, this bug has not been updated in over two years.

        We have decided to close down these old JIRA issues.

        If your report is still a problem on current JRuby versions (1.7.18 or master/9.0.0.0), please re-file the bug at http://bugs.jruby.org.

        You can contact us on the JRuby mailing lists, Freenode IRC channel #jruby, or the @jruby Twitter account if you are unsure how to proceed.

        Show
        Charles Oliver Nutter added a comment - JRuby has moved bug tracking to Github, accessible via our Github page at https://github.com/jruby/jruby/issues , or via http://bugs.jruby.org . In addition, this bug has not been updated in over two years. We have decided to close down these old JIRA issues. If your report is still a problem on current JRuby versions (1.7.18 or master/9.0.0.0), please re-file the bug at http://bugs.jruby.org . You can contact us on the JRuby mailing lists, Freenode IRC channel #jruby, or the @jruby Twitter account if you are unsure how to proceed.

          People

          • Assignee:
            Nick Sieger
            Reporter:
            Eric Anderson

            Dates

            • Created:
              Updated:
              Resolved: