jarbler 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +4 -0
 - data/README.md +1 -0
 - data/jarbler.gemspec +3 -3
 - data/lib/jarbler/JarMain.java +31 -12
 - data/lib/jarbler/version.rb +2 -2
 - metadata +9 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a6c86b6661dda0e9669619c5bac4a954a400dbeed028cb1944b9f0b781b4771d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 987e8bd4e2bd388f1b1642a8b9e911e9774e4c9870eb56c3bb85d053de1e1e1b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4810b94071beeda3eea5fc513646b63033129e38b258b0d274e4b3384705f3b1034ff7a706cf90317c6c0dd5086fea572652c7b89ddeba62bb3faebc68d1f69d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b6054b374c79cc5f1d4976d1b486fcc4730e088e54285edb3156f6cd592ca2bf8c665c8fcfbec383fc4e9e2132268744dec11fdc1e81b5fbf0dbdf0d9c5cd40d
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -53,6 +53,7 @@ The default executable parameters are  "server -p 8080 -e production". 
     | 
|
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
            ## Troubleshooting
         
     | 
| 
       55 
55 
     | 
    
         
             
            * Set DEBUG=true in environment to get additional runtime information
         
     | 
| 
      
 56 
     | 
    
         
            +
            * The temporary folder with the extracted app and jRuby runtime files is not deleted after execution if DEBUG is set.
         
     | 
| 
       56 
57 
     | 
    
         | 
| 
       57 
58 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       58 
59 
     | 
    
         | 
    
        data/jarbler.gemspec
    CHANGED
    
    | 
         @@ -8,12 +8,12 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       8 
8 
     | 
    
         
             
              spec.authors = ["Peter Ramm"]
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.email = ["Peter@ramm-oberhermsdorf.de"]
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              spec.summary = " 
     | 
| 
       12 
     | 
    
         
            -
              spec.description = "Pack  
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary = "Pack a Ruby app into a Java jar file"
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description = "Pack Ruby combined with jRuby runtime into a jar file to simply run the app on any Java platform by '> java -jar file.jar'"
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.homepage = "https://github.com/rammpeter/jarbler"
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.license = "MIT"
         
     | 
| 
       15 
15 
     | 
    
         
             
              spec.required_ruby_version = ">= 2.6.0"
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       17 
17 
     | 
    
         
             
              spec.metadata["homepage_uri"] = spec.homepage
         
     | 
| 
       18 
18 
     | 
    
         
             
              spec.metadata["source_code_uri"] = "https://github.com/rammpeter/jarbler"
         
     | 
| 
       19 
19 
     | 
    
         
             
              spec.metadata["changelog_uri"] = "https://github.com/rammpeter/jarbler/CHANGELOG.md"
         
     | 
    
        data/lib/jarbler/JarMain.java
    CHANGED
    
    | 
         @@ -23,7 +23,10 @@ import java.lang.ClassNotFoundException; 
     | 
|
| 
       23 
23 
     | 
    
         
             
            import java.lang.NoSuchMethodException;
         
     | 
| 
       24 
24 
     | 
    
         
             
            import java.lang.IllegalAccessException;
         
     | 
| 
       25 
25 
     | 
    
         
             
            import java.lang.InstantiationException;
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
            import java.util.Map;
         
     | 
| 
      
 27 
     | 
    
         
            +
            import java.util.HashMap;
         
     | 
| 
      
 28 
     | 
    
         
            +
            import java.lang.reflect.Field;
         
     | 
| 
      
 29 
     | 
    
         
            +
            import java.io.FileWriter;
         
     | 
| 
       27 
30 
     | 
    
         | 
| 
       28 
31 
     | 
    
         
             
            class JarMain {
         
     | 
| 
       29 
32 
     | 
    
         | 
| 
         @@ -55,6 +58,7 @@ class JarMain { 
     | 
|
| 
       55 
58 
     | 
    
         
             
                        System.out.println("Extracting files from "+jarPath+" to "+ newFolder.getAbsolutePath());
         
     | 
| 
       56 
59 
     | 
    
         
             
                        unzip(jarPath, newFolder.getAbsolutePath());
         
     | 
| 
       57 
60 
     | 
    
         | 
| 
      
 61 
     | 
    
         
            +
                        String app_root = newFolder.getAbsolutePath()+File.separator+"app_root";
         
     | 
| 
       58 
62 
     | 
    
         | 
| 
       59 
63 
     | 
    
         
             
                        // get the file name of the jruby jar file in newFolder
         
     | 
| 
       60 
64 
     | 
    
         
             
                        File[] files = newFolder.listFiles();
         
     | 
| 
         @@ -86,15 +90,15 @@ class JarMain { 
     | 
|
| 
       86 
90 
     | 
    
         
             
                            throw new RuntimeException("Property 'executable' definition missing in jarbler.properties");
         
     | 
| 
       87 
91 
     | 
    
         
             
                        }
         
     | 
| 
       88 
92 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                         
     | 
| 
       90 
     | 
    
         
            -
                         
     | 
| 
       91 
     | 
    
         
            -
                        System.setProperty("BUNDLE_PATH", newFolder.getAbsolutePath()+File.separator+"gems");   // this drives bundler for rails app
         
     | 
| 
       92 
     | 
    
         
            -
                        System.setProperty("BUNDLE_WITHOUT", "test:development");  // exclude test and development dependencies from Gemfile check
         
     | 
| 
      
 93 
     | 
    
         
            +
                        // create the bundle config file with the path of the gems
         
     | 
| 
      
 94 
     | 
    
         
            +
                        create_bundle_config(app_root, newFolder.getAbsolutePath()+File.separator+"gems");
         
     | 
| 
       93 
95 
     | 
    
         | 
| 
       94 
96 
     | 
    
         
             
                        // Load the Jar file
         
     | 
| 
       95 
97 
     | 
    
         
             
                        URLClassLoader classLoader = new URLClassLoader(new URL[]{
         
     | 
| 
       96 
     | 
    
         
            -
                             
     | 
| 
       97 
     | 
    
         
            -
                             
     | 
| 
      
 98 
     | 
    
         
            +
                            jrubyCoreFile.toURI().toURL(),
         
     | 
| 
      
 99 
     | 
    
         
            +
                            jrubyStdlibFile.toURI().toURL()
         
     | 
| 
      
 100 
     | 
    
         
            +
                            //new URL("file:/" + jrubyCoreFile.getAbsolutePath()),
         
     | 
| 
      
 101 
     | 
    
         
            +
                            //new URL("file:/" + jrubyStdlibFile.getAbsolutePath())
         
     | 
| 
       98 
102 
     | 
    
         
             
                        });
         
     | 
| 
       99 
103 
     | 
    
         | 
| 
       100 
104 
     | 
    
         
             
                        // Load the class
         
     | 
| 
         @@ -128,15 +132,18 @@ class JarMain { 
     | 
|
| 
       128 
132 
     | 
    
         
             
                            debug(" - " + arg);
         
     | 
| 
       129 
133 
     | 
    
         
             
                        }
         
     | 
| 
       130 
134 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
                        System.setProperty("user.dir",  
     | 
| 
      
 135 
     | 
    
         
            +
                        System.setProperty("user.dir", app_root);
         
     | 
| 
       132 
136 
     | 
    
         
             
                        // call the method org.jruby.Main.main
         
     | 
| 
       133 
137 
     | 
    
         
             
                        mainMethod.invoke(null, (Object)mainArgs.toArray(new String[mainArgs.size()]));
         
     | 
| 
       134 
138 
     | 
    
         
             
                    } catch (Exception e) {
         
     | 
| 
       135 
     | 
    
         
            -
                        e. 
     | 
| 
      
 139 
     | 
    
         
            +
                        e.printStackTrace();
         
     | 
| 
       136 
140 
     | 
    
         
             
                    } finally {
         
     | 
| 
       137 
     | 
    
         
            -
                        // remove the temp directory newFolder
         
     | 
| 
       138 
     | 
    
         
            -
                         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
                        // remove the temp directory newFolder if not DEBUG mode
         
     | 
| 
      
 142 
     | 
    
         
            +
                        if (System.getenv("DEBUG") != null) {
         
     | 
| 
      
 143 
     | 
    
         
            +
                            System.out.println("DEBUG mode is active, temporary folder is not removed at process termination: "+ newFolder.getAbsolutePath());
         
     | 
| 
      
 144 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 145 
     | 
    
         
            +
                            deleteFolder(newFolder);
         
     | 
| 
      
 146 
     | 
    
         
            +
                        }
         
     | 
| 
       140 
147 
     | 
    
         
             
                    }
         
     | 
| 
       141 
148 
     | 
    
         
             
                }
         
     | 
| 
       142 
149 
     | 
    
         | 
| 
         @@ -206,4 +213,16 @@ class JarMain { 
     | 
|
| 
       206 
213 
     | 
    
         
             
                  file.delete();
         
     | 
| 
       207 
214 
     | 
    
         
             
                }
         
     | 
| 
       208 
215 
     | 
    
         | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
                private static void create_bundle_config(String app_root, String gem_path) throws IOException {
         
     | 
| 
      
 218 
     | 
    
         
            +
                    File bundle_config = new File(app_root + File.separator + ".bundle");
         
     | 
| 
      
 219 
     | 
    
         
            +
                    bundle_config.mkdir();
         
     | 
| 
      
 220 
     | 
    
         
            +
                    File bundle_config_file = new File(bundle_config.getAbsolutePath() + File.separator + "config");
         
     | 
| 
      
 221 
     | 
    
         
            +
                    bundle_config_file.createNewFile();
         
     | 
| 
      
 222 
     | 
    
         
            +
                    FileWriter fw = new FileWriter(bundle_config_file);
         
     | 
| 
      
 223 
     | 
    
         
            +
                    fw.write("---\n");
         
     | 
| 
      
 224 
     | 
    
         
            +
                    fw.write("BUNDLE_PATH: " + gem_path + "\n");
         
     | 
| 
      
 225 
     | 
    
         
            +
                    fw.write("BUNDLE_WITHOUT: test:development\n");
         
     | 
| 
      
 226 
     | 
    
         
            +
                    fw.close();
         
     | 
| 
      
 227 
     | 
    
         
            +
                }
         
     | 
| 
       209 
228 
     | 
    
         
             
            }
         
     | 
    
        data/lib/jarbler/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,16 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: jarbler
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Peter Ramm
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-04-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
     | 
    
         
            -
            description: Pack  
     | 
| 
      
 13 
     | 
    
         
            +
            description: Pack Ruby combined with jRuby runtime into a jar file to simply run the
         
     | 
| 
      
 14 
     | 
    
         
            +
              app on any Java platform by '> java -jar file.jar'
         
     | 
| 
       14 
15 
     | 
    
         
             
            email:
         
     | 
| 
       15 
16 
     | 
    
         
             
            - Peter@ramm-oberhermsdorf.de
         
     | 
| 
       16 
17 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -40,7 +41,7 @@ metadata: 
     | 
|
| 
       40 
41 
     | 
    
         
             
              homepage_uri: https://github.com/rammpeter/jarbler
         
     | 
| 
       41 
42 
     | 
    
         
             
              source_code_uri: https://github.com/rammpeter/jarbler
         
     | 
| 
       42 
43 
     | 
    
         
             
              changelog_uri: https://github.com/rammpeter/jarbler/CHANGELOG.md
         
     | 
| 
       43 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 44 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       44 
45 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       45 
46 
     | 
    
         
             
            require_paths:
         
     | 
| 
       46 
47 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -55,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       55 
56 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       56 
57 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       57 
58 
     | 
    
         
             
            requirements: []
         
     | 
| 
       58 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       59 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 59 
     | 
    
         
            +
            rubygems_version: 3.3.26
         
     | 
| 
      
 60 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       60 
61 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       61 
     | 
    
         
            -
            summary:  
     | 
| 
      
 62 
     | 
    
         
            +
            summary: Pack a Ruby app into a Java jar file
         
     | 
| 
       62 
63 
     | 
    
         
             
            test_files: []
         
     |