jarbler 0.3.1 → 0.3.4

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: ae7132c21c27b0d51a870c3e79470d83a4d4b6b088c474c8cdaf4cf4ed34a79c
4
- data.tar.gz: 8e149011da1e3957f425f659a7ac35b47e1696b3896f1a617c6027d027a783bb
3
+ metadata.gz: d00ae03fa03fd70f85ce56da587974f9f2a5645ff977beb6c2a4e9188e92ce53
4
+ data.tar.gz: 7b1b592f4459f728b3838eaa6d40b9f60a78350413f8bbe34fe59c7160fd23ef
5
5
  SHA512:
6
- metadata.gz: d0712390a6916ee50d063c3f9dcc92fc6389c3ca566bc0b089d5df0275e3044b0aee30d3dedbcaf8171642e8555958137ef8a1ab8d14123417af8bc4475fee44
7
- data.tar.gz: b85408f04e6c496827c8fc78d34a78790e173721c6c10e9899e07a29c818d4986296bdfadf5cc79e1ff1de49ff5679d1982cfdc370c3bacca15786c62b7b9e85
6
+ metadata.gz: d4ca329fcd32d2833608ffff76dfecb923dacc72cc1027ed661aa6e2572f2d2a8b026c364597b831107e0e069604bd48ad54af79d5253787007efeba67464b20
7
+ data.tar.gz: 24fab155519254614a9b0ca86477d01a6c5e25f7394c2b0545eac82a3c2989fe72408a6100dc256eba2e68ba580143f1c47431f3acda2028d766a2343ab0ae4e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.4] - 2025-03-07
4
+
5
+ - Warning if Ruby-specific environment variables (GEM_HOME etc.) are set which may cause malfunction of app in jar file
6
+ - Accept jar file locations with blanks in the path, especially for Windows
7
+ - Setting `compile_ruby_files=true` compiles only .rb file of the application, but does not compile the .rb files in Gems.<br/>
8
+ Compiling the Gems also remains an open task.
9
+ - Bugfix: Accept spaces in the path to the jar file, especially for Windows
10
+
3
11
  ## [0.3.1] - 2024-07-02
4
12
 
5
13
  - Use file .ruby-version to define the JRuby version for the jar file only if .ruby-version contains a valid jRuby version
data/README.md CHANGED
@@ -53,16 +53,16 @@ To create a template config file with information about all the supported config
53
53
  The default configuration is focused on Ruby on Rails applications.<br>
54
54
 
55
55
  ### Configuration options
56
- | Option | Default value | Description |
57
- |-------------------------|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
58
- | compile_ruby_files | false | Ahead of time compilation of all .rb files of application and Gem dependencies to .class files. Only store .class files in jar. Requires JRuby runtime. |
59
- | executable | "bin/rails" | The ruby start file to run at execution of jar file. File extension .class is used automatically if start file is .rb and AOT compilation is used. |
60
- | executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
61
- | excludes_from_compile | [] | The files and dirs of the project to exclude from the compilation of .rb files. Paths specifies the location in the jar file (e.g. ["app_root/file.rb"] ) |
62
- | excludes | ["tmp/cache", "tmp/pids", ...] (see generated template file for whole content) | The files and dirs of the project to exclude from the include option |
63
- | includes | ["app", "bin", "config", ...] (see generated template file for whole content) | The files and dirs of the project to include in the jar file |
64
- | jar_name | &lt; Name of project dir &gt;.jar | The name of the generated jar file |
65
- | jruby_version | A valid JRuby version from file '.ruby-version' or the current most recent version of the Gem 'jruby-jars' | The version of the JRuby runtime to use |
56
+ | Option | Default value | Description |
57
+ |-------------------------|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
58
+ | compile_ruby_files | false | Ahead of time compilation of all .rb files of the application to .class files. Onl the .class files are stored in the jar file. The Gem dependencies are not compiled. Requires JRuby runtime. |
59
+ | executable | "bin/rails" | The ruby start file to run at execution of jar file. File extension .class is used automatically if start file is .rb and AOT compilation is used. |
60
+ | executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
61
+ | excludes_from_compile | [] | The files and dirs of the project to exclude from the compilation of .rb files. Paths specifies the location in the jar file (e.g. ["app_root/file.rb"] ) |
62
+ | excludes | ["tmp/cache", "tmp/pids", ...] (see generated template file for whole content) | The files and dirs of the project to exclude from the include option |
63
+ | includes | ["app", "bin", "config", ...] (see generated template file for whole content) | The files and dirs of the project to include in the jar file |
64
+ | jar_name | &lt; Name of project dir &gt;.jar | The name of the generated jar file |
65
+ | jruby_version | A valid JRuby version from file '.ruby-version' or the current most recent version of the Gem 'jruby-jars' | The version of the JRuby runtime to use |
66
66
 
67
67
 
68
68
  ## Troubleshooting
@@ -10,6 +10,7 @@ import java.util.jar.JarFile;
10
10
  import java.util.jar.JarInputStream;
11
11
  import java.util.jar.JarOutputStream;
12
12
  import java.util.ArrayList;
13
+ import java.util.Arrays;
13
14
  import java.util.Properties;
14
15
  import java.util.zip.ZipEntry;
15
16
  import java.util.zip.ZipInputStream;
@@ -42,19 +43,24 @@ class JarMain {
42
43
  debug(" - " + arg);
43
44
  }
44
45
  }
46
+
45
47
  // create a new folder in temp directory
46
48
  File newFolder = new File(System.getProperty("java.io.tmpdir") + File.separator + UUID.randomUUID().toString());
47
49
  newFolder.mkdir();
50
+
48
51
  try {
49
- // Get the path of the jar file
50
- String jarPath = JarMain.class.getProtectionDomain().getCodeSource().getLocation().getPath();
51
-
52
- // remove the leading slash if path is a windows path
53
- String os = System.getProperty("os.name").toLowerCase();
54
- boolean isWindows = os.contains("windows");
55
- if (os.contains("windows") && jarPath.startsWith("/") && jarPath.indexOf(':') != -1) {
56
- jarPath = jarPath.substring(1); // remove the leading slash
57
- }
52
+
53
+ // Ensure that environment does not inject external dependencies
54
+ checkEnvForToxicEntries();
55
+
56
+ // Get the path of the jar file with valid characters for spaces etc., especially for Windows
57
+ URL jarPathUrl = JarMain.class.getProtectionDomain().getCodeSource().getLocation();
58
+
59
+ // Convert the URL to a URI, then to a File
60
+ File jarFile = new File(jarPathUrl.toURI());
61
+
62
+ // Get the absolute path of the file
63
+ String jarPath = jarFile.getAbsolutePath();
58
64
 
59
65
  // extract the jarFile by unzipping it (not using the jar utility which may not be available)
60
66
  System.out.println("Extracting files from "+jarPath+" to "+ newFolder.getAbsolutePath());
@@ -84,8 +90,9 @@ class JarMain {
84
90
 
85
91
  Properties prop = new Properties();
86
92
  prop.load(new FileInputStream(newFolder.getAbsolutePath()+File.separator+"jarbler.properties"));
87
- executable = prop.getProperty("jarbler.executable");
88
- executable_params = prop.getProperty("jarbler.executable_params");
93
+ executable = prop.getProperty("jarbler.executable");
94
+ executable_params = prop.getProperty("jarbler.executable_params");
95
+ String gem_home_suffix = prop.getProperty("jarbler.gem_home_suffix");
89
96
 
90
97
  Boolean compile_ruby_files = Boolean.parseBoolean(prop.getProperty("jarbler.compile_ruby_files", "false"));
91
98
  if (compile_ruby_files) {
@@ -99,8 +106,11 @@ class JarMain {
99
106
  throw new RuntimeException("Property 'executable' definition missing in jarbler.properties");
100
107
  }
101
108
 
109
+ // single path to the gems directory
110
+ String gem_home = newFolder.getAbsolutePath()+File.separator+"gems";
111
+
102
112
  // create the bundle config file with the path of the gems
103
- create_bundle_config(app_root, newFolder.getAbsolutePath()+File.separator+"gems");
113
+ create_bundle_config(app_root, gem_home);
104
114
 
105
115
  // Load the Jar file
106
116
  URLClassLoader classLoader = new URLClassLoader(new URL[]{
@@ -109,7 +119,6 @@ class JarMain {
109
119
  //new URL("file:/" + jrubyCoreFile.getAbsolutePath()),
110
120
  //new URL("file:/" + jrubyStdlibFile.getAbsolutePath())
111
121
  });
112
-
113
122
  // Load the class
114
123
  Class<?> clazz = classLoader.loadClass("org.jruby.Main");
115
124
 
@@ -136,16 +145,24 @@ class JarMain {
136
145
  }
137
146
  }
138
147
 
148
+ debug("JRuby set property 'user.dir' to '" + app_root + "'");
149
+ System.setProperty("user.dir", app_root);
150
+
151
+ // GEM_HOME not explicitely set because this is done by Bundle.setup based on the .bundle/config file
152
+ // Setting GEM_HOME explicitely may cause problems with the JRuby runtime (Gem::GemNotFoundException: can't find gem bundler (= 2.6.3) with executable bundle)
153
+ //String full_gem_home = gem_home + File.separator + gem_home_suffix.replace("/", File.separator);
154
+ //debug("JRuby set property 'jruby.gem.home' to '" + full_gem_home + "'");
155
+ //System.setProperty("jruby.gem.home", full_gem_home);
156
+
139
157
  debug("JRuby program starts with the following arguments: ");
140
158
  for (String arg : mainArgs) {
141
159
  debug(" - " + arg);
142
160
  }
143
161
 
144
- debug("JRuby set property 'user.dir' to '" + app_root + "'");
145
- System.setProperty("user.dir", app_root);
146
162
  // call the method org.jruby.Main.main
147
163
  debug("Calling org.jruby.Main.main with: "+ mainArgs);
148
164
  mainMethod.invoke(null, (Object)mainArgs.toArray(new String[mainArgs.size()]));
165
+ // TODO: evaluate return value
149
166
  } catch (Exception e) {
150
167
  e.printStackTrace();
151
168
  } finally {
@@ -225,7 +242,7 @@ class JarMain {
225
242
 
226
243
  private static void debug(String msg) {
227
244
  if (System.getenv("DEBUG") != null) {
228
- System.out.println(msg);
245
+ System.err.println(msg);
229
246
  }
230
247
  }
231
248
 
@@ -266,4 +283,38 @@ class JarMain {
266
283
  }
267
284
  return jarFileName;
268
285
  }
286
+
287
+ /**
288
+ * Check environment for entries that may inluence execution of Ruby code.
289
+ * @param errorSummary The current error summary
290
+ */
291
+ private static void checkEnvForToxicEntries(){
292
+ StringBuilder errorSummary = new StringBuilder("");
293
+ String toxicEntries[] = {
294
+ "BUNDLE_BIN_PATH",
295
+ "BUNDLE_GEMFILE",
296
+ "BUNDLER_SETUP",
297
+ "BUNDLER_VERSION",
298
+ "GEM_HOME",
299
+ "GEM_PATH",
300
+ "RUBYLIB",
301
+ "RUBYOPT",
302
+ "RUBYPATH",
303
+ "RUBYSHELL"
304
+ };
305
+
306
+ Arrays.stream(toxicEntries).forEach(entry -> {
307
+ String envVal = System.getenv(entry);
308
+ if (envVal != null) {
309
+ errorSummary.append("Found environment variable '"+entry+"' with value '"+envVal+"'\n");
310
+ debug("Possibly toxic environment variable found: '"+entry+"'! Remove it from environment before execution of jar file if it causes errors.");
311
+ }
312
+ });
313
+
314
+ if (!errorSummary.toString().isEmpty()){
315
+ System.err.println("The follwing environment variables may influence the execution of the packaged Ruby code.");
316
+ System.err.println("Please remove this environment entries before the execution of the jar file if they cause errors.");
317
+ System.err.println(errorSummary);
318
+ }
319
+ }
269
320
  }
@@ -4,6 +4,7 @@ require 'bundler'
4
4
  require 'find'
5
5
  require 'fileutils'
6
6
  require 'yaml'
7
+ require 'open3'
7
8
 
8
9
  module Jarbler
9
10
  class Builder
@@ -50,6 +51,7 @@ module Jarbler
50
51
  end
51
52
  file.write("jarbler.executable_params=#{java_executable_params.strip}\n")
52
53
  file.write("jarbler.compile_ruby_files=#{config.compile_ruby_files}\n")
54
+ file.write("jarbler.gem_home_suffix=jruby/#{ruby_minor_version}\n") # Extension after BUNDLE_PATH for local Gems
53
55
  end
54
56
 
55
57
  # remove files and directories from excludes, if they exist (after copying the rails project and the gems)
@@ -86,30 +88,20 @@ module Jarbler
86
88
 
87
89
  private
88
90
 
89
-
90
- # Check if there is an additional local bundle path in .bundle/config
91
- # @param rails_root [String] the rails root directory
92
- # @return [String] the local bundle path or nil if not configured
93
- def bundle_config_bundle_path(rails_root)
94
- bundle_path = nil # default
95
- if File.exist?("#{rails_root}/.bundle/config")
96
- bundle_config = YAML.load_file("#{rails_root}/.bundle/config")
97
- if bundle_config && bundle_config['BUNDLE_PATH']
98
- bundle_path = "#{rails_root}/#{bundle_config['BUNDLE_PATH']}"
99
- debug "Local Gem path configured in #{rails_root}/.bundle/config: #{bundle_path}"
100
- end
101
- end
102
- bundle_path
103
- end
104
-
105
91
  # Copy the needed Gems to the staging directory
106
92
  # @param staging_dir [String] the staging directory
107
93
  # @param ruby_minor_version [String] the corresponding ruby minor version of the jruby jars version
108
94
  # @return [void]
109
95
  def copy_needed_gems_to_staging(staging_dir, ruby_minor_version)
110
96
  gem_target_location = "#{staging_dir}/gems/jruby/#{ruby_minor_version}"
97
+ FileUtils.mkdir_p("#{gem_target_location}/bin")
98
+ FileUtils.mkdir_p("#{gem_target_location}/build_info")
99
+ FileUtils.mkdir_p("#{gem_target_location}/cache")
100
+ FileUtils.mkdir_p("#{gem_target_location}/doc")
101
+ FileUtils.mkdir_p("#{gem_target_location}/extensions")
111
102
  FileUtils.mkdir_p("#{gem_target_location}/gems")
112
103
  FileUtils.mkdir_p("#{gem_target_location}/specifications")
104
+ FileUtils.mkdir_p("#{gem_target_location}/bundler/bin")
113
105
  FileUtils.mkdir_p("#{gem_target_location}/bundler/gems")
114
106
 
115
107
  needed_gems = gem_dependencies # get the full names of the dependencies
@@ -123,21 +115,34 @@ module Jarbler
123
115
  if spec.source.is_a?(Bundler::Source::Git)
124
116
  # Copy the Gem from bundler/gems including the gemspec
125
117
  file_utils_copy(spec.gem_dir, "#{gem_target_location}/bundler/gems")
118
+ spec.executables.each do |executable|
119
+ file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bundler/bin")
120
+ end
126
121
  else # Gem is from rubygems
122
+ # TODO: Gemfile could request a different version of default gem compared to the one jruby jars
123
+ # Should the default gems are also copied to the staging directory?
127
124
  unless spec.default_gem? # Do not copy default gems, because they are already included in the jruby jars standard library
128
125
  # copy the Gem and gemspec separately
129
126
  file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems")
130
- file_utils_copy("#{spec.gem_dir}/../../specifications/#{needed_gem[:full_name]}.gemspec", "#{gem_target_location}/specifications")
127
+ # spec.loaded_from contains the path to the gemspec file including the path prefix "default/" for default gems
128
+ file_utils_copy(spec.loaded_from, "#{gem_target_location}/specifications")
129
+ spec.executables.each do |executable|
130
+ file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bin")
131
+ end
131
132
  end
132
133
  end
133
134
  end
135
+ rescue Exception => e
136
+ debug("Builder.copy_needed_gems_to_staging: Failed with staging dir = '#{staging_dir}' and ruby minor version = #{ruby_minor_version} with #{e.class}\n#{e.message}")
137
+ raise
134
138
  end
135
139
 
136
140
  # Read the default/production dependencies from Gemfile.lock and Gemfile
137
141
  # @return [Array] Array with Hashes containing: name, version, full_name
138
142
  def gem_dependencies
139
143
  needed_gems = []
140
- lockfile_specs = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)).specs
144
+ lockfile_parser = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
145
+ lockfile_specs = lockfile_parser.specs
141
146
 
142
147
  Bundler.setup # Load Gems specified in Gemfile, ensure that Gem path also includes the Gems loaded into bundler dir
143
148
  # filter Gems needed for production
@@ -156,10 +161,18 @@ module Jarbler
156
161
  debug "Direct Gem dependency: #{lockfile_spec.full_name}"
157
162
  add_indirect_dependencies(lockfile_specs, lockfile_spec, needed_gems)
158
163
  else
159
- debug "Gem #{gemfile_spec.name} not found in Gemfile.lock"
164
+ if gemfile_spec.name == 'bundler'
165
+ debug "Gem bundler found in Gemfile.lock but not in specs, use version #{Bundler::VERSION}"
166
+ needed_gems << { full_name: "bundler-#{lockfile_parser.bundler_version}", name: 'bundler', version: lockfile_parser.bundler_version }
167
+ else
168
+ debug "Gem #{gemfile_spec.name} not found in specs: in Gemfile.lock"
169
+ end
160
170
  end
161
171
  end
162
- needed_gems.uniq.sort{|a,b| a[:full_name] <=> b[:full_name]}
172
+ needed_gems.uniq.sort{|a,b| a[:full_name] <=> b[:full_name]} # full_name also contains version
173
+ rescue Exception => e
174
+ debug("Builder.gem_dependencies: Failed with #{e.class}\n#{e.message}")
175
+ raise
163
176
  end
164
177
 
165
178
  # recurively find all indirect dependencies
@@ -180,13 +193,16 @@ module Jarbler
180
193
  debug "Gem #{lockfile_spec_dep.name} not found in Gemfile.lock"
181
194
  end
182
195
  end
196
+ rescue Exception => e
197
+ debug("Builder.add_indirect_dependencies: Failed with #{e.class}\n#{e.message}")
198
+ raise
183
199
  end
184
200
 
185
201
  # Output debug message if DEBUG environment variable is set
186
202
  # @param [String] msg Message to output
187
203
  # @return [void]
188
204
  def debug(msg)
189
- puts msg if ENV['DEBUG']
205
+ puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} #{msg}" if ENV['DEBUG']
190
206
  end
191
207
 
192
208
  # Get the config object
@@ -201,6 +217,9 @@ module Jarbler
201
217
  debug ""
202
218
  end
203
219
  @config
220
+ rescue Exception => e
221
+ debug("Builder.config: Failed with #{e.class}\n#{e.message}")
222
+ raise
204
223
  end
205
224
 
206
225
  # Copy the jruby-jars to the staging directory
@@ -208,12 +227,26 @@ module Jarbler
208
227
  # @return [String] the minor ruby version of the JRuby jars with patch level set to 0
209
228
  def copy_jruby_jars_to_staging(staging_dir)
210
229
 
230
+ debug "Copying JRuby Jars to staging dir: #{staging_dir}"
211
231
  # Ensure that jruby-jars gem is installed, otherwise install it. Accepts also bundler path in .bundle/config
212
- installer = Gem::DependencyInstaller.new
213
- installed = installer.install('jruby-jars', config.jruby_version)
232
+ installed = nil # ensure that installed is defined outside of the block
233
+ tries = 5
234
+ tries.times do |try|
235
+ begin
236
+ installer = Gem::DependencyInstaller.new
237
+ installed = installer.install('jruby-jars', config.jruby_version)
238
+ break # escape loop if successful
239
+ rescue Exception, RuntimeError => e
240
+ debug "Builder.copy_jruby_jars_to_staging: Failed to install jruby-jars #{try}. try with #{e.class}\n#{e.message}"
241
+ raise if try == tries - 1 # last try not successful
242
+ sleeptime = 5
243
+ debug "Builder.copy_jruby_jars_to_staging: Waiting #{sleeptime} seconds to prevent from Gem::RemoteFetcher::FetchError: IOError: closed stream"
244
+ sleep sleeptime # wait x seconds before next try
245
+ end
246
+ end
214
247
  raise "jruby-jars gem not installed in version #{config.jruby_version}" if installed.empty?
215
248
 
216
- jruby_jars_location = installed[0]&.full_gem_path
249
+ jruby_jars_location = installed[0]&.full_gem_path # need to be the first installed Gem
217
250
  debug "JRuby jars installed at: #{jruby_jars_location}"
218
251
 
219
252
  # Get the location of the jruby-jars gem
@@ -232,16 +265,24 @@ module Jarbler
232
265
  ruby_minor_version = ruby_version.split('.')[0..1].join('.') + '.0'
233
266
  debug "Corresponding Ruby minor version for JRuby (#{config.jruby_version}): #{ruby_minor_version}"
234
267
  ruby_minor_version
268
+ rescue Exception => e
269
+ debug "Builder.copy_jruby_jars_to_staging: Failed to copy JRuby jars to staging dir '#{jruby_jars_location}' with #{e.class}\n#{e.message}"
270
+ debug "Stack trace of exception:\n#{e.backtrace.join("\n")}"
271
+ raise
235
272
  end
236
273
 
237
274
  # Execute the command in OS and return the output
238
275
  # @param [String] command Command to execute
239
276
  # @return [String] the output of the command
240
277
  def exec_command(command)
241
- lines = `#{command}`
242
- raise "Command \"#{command}\"failed with return code #{$?} and output:\n#{lines}" unless $?.success?
243
- debug "Command \"#{command}\" executed successfully with following output:\n#{lines}"
244
- lines
278
+ debug("Execute by Open3.capture3: #{command}")
279
+ stdout, stderr, status = Open3.capture3(command)
280
+ debug "Command \"#{command}\" executed with return code #{status}!\nstdout:\n#{stdout}\n\nstderr:\n#{stderr}\n"
281
+ raise "Command \"#{command}\" failed with return code #{status}!\nstdout:\n#{stdout}\n\nstderr:\n#{stderr}\n" unless status.success?
282
+ "stdout:\n#{stdout}\nstderr:\n#{stderr}\n"
283
+ rescue Exception => e
284
+ debug "Builder.exec_command: Failed to execute command '#{command}' with #{e.class}\n#{e.message}"
285
+ raise
245
286
  end
246
287
 
247
288
  # Copy file or directory with error handling
@@ -254,8 +295,8 @@ module Jarbler
254
295
  else
255
296
  FileUtils.cp(source, destination)
256
297
  end
257
- rescue Exception
258
- puts "Error copying #{source} to #{destination}"
298
+ rescue Exception => e
299
+ debug "Builder.file_utils_copy: Failed to copy '#{source}' to '#{destination}' with #{e.class}\n#{e.message}"
259
300
  raise
260
301
  end
261
302
 
@@ -269,7 +310,8 @@ module Jarbler
269
310
  puts "Compiling .rb files to .class is done with JRuby version #{JRUBY_VERSION}, but intended runtime JRuby version for jar file is #{config.jruby_version}"
270
311
  end
271
312
 
272
- ruby_files = Find.find('.').select { |f| f =~ /\.rb$/ } # find all Ruby files in the current directory
313
+ # Compile all .rb files in the current directory tree, but not in the gems directory
314
+ ruby_files = Find.find('.').select { |f| f =~ /\.rb$/ && !f.include?("#{File::SEPARATOR}gems#{File::SEPARATOR}") } # find all Ruby files in the current directory
273
315
 
274
316
  # Exclude named files or directories from compiling
275
317
  config.excludes_from_compile.each do |exclude|
@@ -291,6 +333,9 @@ module Jarbler
291
333
  puts "'#{ruby_file}' is not compiled and will be included in the jar file as original Ruby file"
292
334
  end
293
335
  end
336
+ rescue Exception => e
337
+ puts "Builder.compile_ruby_files: Failed to compile Ruby files with #{e.class}\n#{e.message}"
338
+ raise
294
339
  end
295
340
  end
296
341
  end
@@ -143,12 +143,6 @@ module Jarbler
143
143
  @jruby_version = response&.first&.first&.first&.version&.to_s
144
144
  raise "Unable to determine the latest available version of jruby-jars gem!\nResponse = #{response.inspect}" unless @jruby_version
145
145
 
146
- #command = "gem search --remote jruby-jars"
147
- #lines = `#{command}`
148
- #raise "Command \"#{command}\" failed with return code #{$?} and output:\n#{lines}" unless $?.success?
149
- #jruby_jars_line = lines.match(/^jruby-jars \((.*)\)/)
150
- #raise "No jruby-jars gem found in rubygems.org!" unless jruby_jars_line
151
- #self.jruby_version = /\((.*?)\)/.match(jruby_jars_line.to_s)[1]
152
146
  debug "Jarbler::Config.define_jruby_version: JRuby version from latest jruby-jars gem: #{jruby_version}"
153
147
  end
154
148
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.3.1"
5
- VERSION_DATE = "2024-07-02"
4
+ VERSION = "0.3.4"
5
+ VERSION_DATE = "2025-03-07"
6
6
  end
data/log/.keep ADDED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.4
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: 2024-07-02 00:00:00.000000000 Z
11
+ date: 2025-03-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pack a Ruby app combined with JRuby runtime and all its Gem dependencies
14
14
  into a jar file to simply run the app on any Java platform by '> java -jar file.jar'
@@ -34,6 +34,7 @@ files:
34
34
  - lib/jarbler/builder.rb
35
35
  - lib/jarbler/config.rb
36
36
  - lib/jarbler/version.rb
37
+ - log/.keep
37
38
  - sig/jarbler.rbs
38
39
  homepage: https://github.com/rammpeter/jarbler
39
40
  licenses:
@@ -42,7 +43,7 @@ metadata:
42
43
  homepage_uri: https://github.com/rammpeter/jarbler
43
44
  source_code_uri: https://github.com/rammpeter/jarbler
44
45
  changelog_uri: https://github.com/rammpeter/jarbler/CHANGELOG.md
45
- post_install_message:
46
+ post_install_message:
46
47
  rdoc_options: []
47
48
  require_paths:
48
49
  - lib
@@ -58,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  version: '0'
59
60
  requirements: []
60
61
  rubygems_version: 3.3.27
61
- signing_key:
62
+ signing_key:
62
63
  specification_version: 4
63
64
  summary: Pack a Ruby app into a Java jar file
64
65
  test_files: []