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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc9683c3fba322e4476646046c54b7c61ae7b6fa3d4c9865d1223fad0db590ee
4
- data.tar.gz: 5e64e298302111c5fbcc606c8aad86ba93b454daece192318c33b3eca6696ccb
3
+ metadata.gz: a6c86b6661dda0e9669619c5bac4a954a400dbeed028cb1944b9f0b781b4771d
4
+ data.tar.gz: 987e8bd4e2bd388f1b1642a8b9e911e9774e4c9870eb56c3bb85d053de1e1e1b
5
5
  SHA512:
6
- metadata.gz: 0edc420a59cb4e48364c0155c0cee0f2449b32264de8f3967cf790b82df541a367d7206b4a5dbf0461561be9e88fee79d8ba7bdc737d6ca2eda951a97cc5e0d9
7
- data.tar.gz: 4e7d227903baacaaf8960f333c9f3beaee96dd5c399a45ab724620af04fbdfcbb5ed1ccce9a1955907d563ce2888b1d9a0b174dc2dadb85d557960e30ca7608c
6
+ metadata.gz: 4810b94071beeda3eea5fc513646b63033129e38b258b0d274e4b3384705f3b1034ff7a706cf90317c6c0dd5086fea572652c7b89ddeba62bb3faebc68d1f69d
7
+ data.tar.gz: b6054b374c79cc5f1d4976d1b486fcc4730e088e54285edb3156f6cd592ca2bf8c665c8fcfbec383fc4e9e2132268744dec11fdc1e81b5fbf0dbdf0d9c5cd40d
data/CHANGELOG.md CHANGED
@@ -3,3 +3,7 @@
3
3
  ## [0.1.0] - 2023-04-12
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.1.1] - 2023-04-24
8
+
9
+ - Fixed the bug 'java.lang.ClassNotFoundException: org.jruby.Main' with Windows
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 = "Create jar file from Rails app"
12
- spec.description = "Pack a Rails application into an executable jar file"
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"
@@ -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
- System.setProperty("GEM_PATH", newFolder.getAbsolutePath()+File.separator+"gems"); // not really necessray for Rails
90
- System.setProperty("GEM_HOME", newFolder.getAbsolutePath()+File.separator+"gems"); // not really necessray for Rails
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
- new URL("file://" + jrubyCoreFile.getAbsolutePath()),
97
- new URL("file://" + jrubyStdlibFile.getAbsolutePath())
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", newFolder.getAbsolutePath()+File.separator+"app_root");
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.getCause().printStackTrace();
139
+ e.printStackTrace();
136
140
  } finally {
137
- // remove the temp directory newFolder
138
- debug("jRuby program terminated, removing temporary folder "+ newFolder.getAbsolutePath());
139
- deleteFolder(newFolder);
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
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.1.0"
5
- VERSION_DATE = "2023-04-20"
4
+ VERSION = "0.1.1"
5
+ VERSION_DATE = "2023-04-24"
6
6
  end
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.0
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-23 00:00:00.000000000 Z
11
+ date: 2023-04-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Pack a Rails application into an executable jar file
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.4.12
59
- signing_key:
59
+ rubygems_version: 3.3.26
60
+ signing_key:
60
61
  specification_version: 4
61
- summary: Create jar file from Rails app
62
+ summary: Pack a Ruby app into a Java jar file
62
63
  test_files: []