jarbler 0.4.4 → 0.4.6

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: 640a16561d8e25d6674c56908ffb3442ad42eeccb9d34bd54dc480167902f52a
4
- data.tar.gz: 76c9ea77cbf7eaea89588a6ffbcc6d06b39d79e6cd7560df822c31b979a7bf81
3
+ metadata.gz: 48b6fba9a7ec8ccee040f91610cff305443ded429167fe6cf56b8b57491d11fe
4
+ data.tar.gz: 1e9535dac8014e69db495dacea161216d674106bbd82c50d73ec6fc2912d1178
5
5
  SHA512:
6
- metadata.gz: 9ecdbb4c5485b2e816793e367e4f1257e2f546ed95b515ec6c34393a8dd22fe8546efe8f63eef393b5f455396267db2dfc71f0ff22c0f246034f35736bcd05a0
7
- data.tar.gz: acfe393d73f216856896a60fe815a94a3016eaf7a9dbf88734b8a99431b59ec5a39d947ace599a72365d70fac5ba55fff240dd0d92a9d57e46dce8d4bac66745
6
+ metadata.gz: babcb3d934484da62fb54bc1c3582305e1980ebddb376e1dee68abac65d117b7ec562b279c74947c451e176d87a85485dd245738b9a7da17e70799c08921d567
7
+ data.tar.gz: 37100108a44b8001cacc7c8a827117bc350c0b59d94bd177e7893b4a4c67873ef6ee6c887e36f0c9ec53d8d15907fc410075f1ac16fb33f15552290c13be9245
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Ask2AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.6] - 2026-04-07
4
+ - New config attribute 'exclude_gems' to exclude certain gems from being included in the jar file. <br/>
5
+ Gems specified in 'exclude_gems' are not included in the jar file and not available at runtime. <br/>
6
+ This allows to exclude gems which are dependencies of other gems that are not needed for the application and are excluded from initialization by 'gem name, require: false'.
7
+
8
+ ## [0.4.5] - 2026-03-10
9
+ - Show JRuby warnings at execution of jar file only if environment variable `DEBUG` is set to 'true'
10
+
3
11
  ## [0.4.4] - 2026-02-03
4
12
 
5
13
  - Version conflicts with installed system default gems are fixed. <br/>
data/README.md CHANGED
@@ -56,6 +56,7 @@ The default configuration is focused on Ruby on Rails applications.<br>
56
56
  | Option | Default value | Description |
57
57
  |-----------------------|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
58
58
  | compile_ruby_files | false | Ahead of time compilation of all .rb files of the application to .class files.<br/>Only the .class files are stored in the jar file. The Gem dependencies are not compiled. Requires JRuby as Ruby environment at compile time. |
59
+ | exclude_gems | [] | Exclude certain gems from being included in the jar file. <br/>Gems specified in 'exclude_gems' are not included in the jar file and are not available at runtime. Only the specification file is needed to be in the jar file.<br/>This allows to exclude gems which are dependencies of other gems that are not needed for the application and are excluded from initialization by 'gem name, require: false'. |
59
60
  | 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"] ) |
60
61
  | 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 |
61
62
  | 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. |
@@ -70,7 +71,8 @@ The default configuration is focused on Ruby on Rails applications.<br>
70
71
 
71
72
  ## Troubleshooting
72
73
  * Set DEBUG=true in OS environment to get additional runtime information
73
- * The temporary folder with the extracted app and JRuby runtime files is not deleted after execution if DEBUG is set.
74
+ * The temporary folder with the extracted app and JRuby runtime files is not deleted after execution if DEBUG is set.<br/>
75
+ This is the case for execution of `jarble` as well as for execution of the created jar file.
74
76
 
75
77
  ### Possible error messages
76
78
  * Gem::LoadError: You have already activated ..., but your Gemfile requires ... . Since ... is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports net-protocol as a default gem.
@@ -157,10 +157,12 @@ class JarMain {
157
157
  //debug("JRuby set property 'jruby.gem.home' to '" + full_gem_home + "'");
158
158
  //System.setProperty("jruby.gem.home", full_gem_home);
159
159
 
160
- // Enable JRuby warnings, not proof to really function
161
- System.setProperty("jruby.log.warnings", "true");
162
- System.setProperty("jruby.cli.verbose", "true");
163
- // System.setProperty("jruby.debug.fullTrace", "true");
160
+ // Enable JRuby warnings
161
+ if (debug_active()) {
162
+ System.setProperty("jruby.log.warnings", "true");
163
+ System.setProperty("jruby.cli.verbose", "true");
164
+ // System.setProperty("jruby.debug.fullTrace", "true");
165
+ }
164
166
 
165
167
  debug("JRuby program starts with the following arguments: ");
166
168
  for (String arg : mainArgs) {
@@ -139,20 +139,26 @@ module Jarbler
139
139
  else # Gem is from rubygems
140
140
  unless spec.default_gem? # Do not copy default gems, because they are already included in the jruby jars standard library
141
141
  # copy the Gem and gemspec separately
142
- debug "Adding local Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
143
- file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems")
144
-
145
- if spec.extension_dir && Dir.exist?(spec.extension_dir)
146
- debug "Adding extension from dir '#{spec.extension_dir}' into jar file at temporary location '#{extension_target_location}'"
147
- puts "Adding extension from dir '#{spec.extension_dir}' into jar file but extension is not for platform 'universal-java-xx'!!!" unless spec.extension_dir['universal-java']
148
- file_utils_copy(spec.extension_dir, extension_target_location)
149
- end
150
142
 
151
143
  # spec.loaded_from contains the path to the gemspec file including the path prefix "default/" for default gems
152
144
  file_utils_copy(spec.loaded_from, "#{gem_target_location}/specifications")
153
- spec.executables.each do |executable|
154
- debug "Adding executable of local Gem from dir '#{spec.bin_dir}/#{executable}/' into jar file at temporary location '#{gem_target_location}/bin'"
155
- file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bin")
145
+
146
+ unless config.excluded_gems.include?(needed_gem[:name]) # only the spec file needs to be included for excluded_gems
147
+ debug "Adding local Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
148
+ file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems") unless config.excluded_gems.include?(needed_gem[:name])
149
+
150
+ if spec.extension_dir && Dir.exist?(spec.extension_dir)
151
+ debug "Adding extension from dir '#{spec.extension_dir}' into jar file at temporary location '#{extension_target_location}'"
152
+ puts "Adding extension from dir '#{spec.extension_dir}' into jar file but extension is not for platform 'universal-java-xx'!!!" unless spec.extension_dir['universal-java']
153
+ file_utils_copy(spec.extension_dir, extension_target_location)
154
+ end
155
+
156
+ spec.executables.each do |executable|
157
+ debug "Adding executable of local Gem from dir '#{spec.bin_dir}/#{executable}/' into jar file at temporary location '#{gem_target_location}/bin'"
158
+ file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bin")
159
+ end
160
+ else
161
+ debug "Skipping copy of excluded gem #{needed_gem[:name]} version #{needed_gem[:version]} from dir '#{spec.gem_dir}' into jar file"
156
162
  end
157
163
  end
158
164
  end
@@ -181,7 +187,7 @@ module Jarbler
181
187
  # find lockfile record for Gemfile spec
182
188
  lockfile_spec = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == gemfile_spec.name }
183
189
  if lockfile_spec
184
- unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec.full_name)
190
+ unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec.full_name)
185
191
  needed_gems << { full_name: lockfile_spec.full_name, name: lockfile_spec.name, version: lockfile_spec.version }
186
192
  end
187
193
  debug "Direct Gem dependency: #{lockfile_spec.full_name}"
@@ -211,7 +217,7 @@ module Jarbler
211
217
  lockfile_spec_found = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == lockfile_spec_dep.name }
212
218
  if lockfile_spec_found
213
219
  debug "Indirect Gem dependency from #{lockfile_spec.full_name}: #{lockfile_spec_found.full_name}"
214
- unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec_found.full_name)
220
+ unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec_found.full_name)
215
221
  needed_gems << { full_name: lockfile_spec_found.full_name, name: lockfile_spec_found.name, version: lockfile_spec_found.version }
216
222
  add_indirect_dependencies(lockfile_specs, lockfile_spec_found, needed_gems)
217
223
  end
@@ -5,6 +5,7 @@ module Jarbler
5
5
  class Config
6
6
  attr_accessor :compile_java_version, # compile_java_version only for backward compatibility, use java_opts instead
7
7
  :compile_ruby_files,
8
+ :excluded_gems,
8
9
  :excludes,
9
10
  :excludes_from_compile,
10
11
  :executable,
@@ -26,7 +27,7 @@ module Jarbler
26
27
  config = Jarbler::Config.new
27
28
  end
28
29
  unless config.class == Jarbler::Config
29
- Jarbler.debug "No valid config provided in #{CONFIG_FILE}! Using defaults."
30
+ puts "No valid config provided in #{CONFIG_FILE}! Using defaults."
30
31
  config = Config.new
31
32
  end
32
33
  config.define_jruby_version
@@ -44,6 +45,7 @@ module Jarbler
44
45
  end
45
46
  puts "Used configuration values are:"
46
47
  puts " compile_ruby_files: #{config.compile_ruby_files}"
48
+ puts " excluded_gems: #{config.excluded_gems}" unless config.excluded_gems.empty?
47
49
  puts " excludes: #{config.excludes}"
48
50
  puts " excludes_from_compile: #{config.excludes_from_compile}" if config.compile_ruby_files
49
51
  puts " executable: #{config.executable}"
@@ -52,7 +54,7 @@ module Jarbler
52
54
  puts " includes: #{config.includes}"
53
55
  puts " jar_name: #{config.jar_name}"
54
56
  puts " java_opts: #{config.java_opts}"
55
- puts " jrubyc_opts: #{config.jruby_version}" if config.compile_ruby_files
57
+ puts " jrubyc_opts: #{config.jrubyc_opts}" if config.compile_ruby_files
56
58
  puts " jruby_version: #{config.jruby_version}"
57
59
  puts ""
58
60
  config
@@ -61,6 +63,7 @@ module Jarbler
61
63
  def initialize
62
64
  @compile_ruby_files = false
63
65
  @compile_java_version = nil # deprecated, use java_opts instead
66
+ @excluded_gems = []
64
67
  @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
65
68
  @excludes_from_compile = []
66
69
  @executable = 'bin/rails'
@@ -82,6 +85,12 @@ module Jarbler
82
85
  # the original ruby files are not included in the jar file, so source code is not visible
83
86
  # config.compile_ruby_files = #{compile_ruby_files}
84
87
 
88
+ # Exclude certain gems from being included in the jar file.
89
+ # Gems specified in 'exclude_gems' are not included in the jar file and not available at runtime.
90
+ # This allows to exclude gems which are dependencies of other gems
91
+ # that are not needed for the application and are excluded from initialization by 'gem name, require: false'.
92
+ # config.excluded_gems = #{excluded_gems}
93
+
85
94
  # Application directories or files to exclude from the jar file
86
95
  # config.excludes = #{excludes}
87
96
  # config.excludes << 'additional'
@@ -192,6 +201,7 @@ module Jarbler
192
201
  def validate_values
193
202
  raise "compile_java_version is not valid any more! Use config.java_opts instead with -source and -target." if compile_java_version
194
203
  raise "Invalid config value for jar name: #{jar_name}" unless jar_name =~ /\w+/
204
+ raise "Invalid config value for excluded_gems: #{excluded_gems}" unless @excluded_gems.is_a?(Array)
195
205
  raise "Invalid config value for executable: #{executable}" unless executable =~ /\w+/
196
206
  raise "Invalid config value for executable params: #{executable_params}" unless executable_params.is_a?(Array)
197
207
  raise "Invalid config value for gemfile groups: #{gemfile_groups}" unless gemfile_groups.is_a?(Array)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.4.4"
5
- VERSION_DATE = "2026-01-29"
4
+ VERSION = "0.4.6"
5
+ VERSION_DATE = "2026-04-07"
6
6
  end
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.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-03 00:00:00.000000000 Z
11
+ date: 2026-04-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'
@@ -19,6 +19,7 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - ".idea/copilot.data.migration.ask2agent.xml"
22
23
  - CHANGELOG.md
23
24
  - Gemfile
24
25
  - LICENSE