jarbler 0.4.5 → 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: b72eccf370b618ce376f9091afac4360a8cae86f60908b50ddbb3d0bb1c6647f
4
- data.tar.gz: 659ea949e16bedfe51de531eb9cd54a71fe47e4873f41f58eb0708255aac8108
3
+ metadata.gz: 48b6fba9a7ec8ccee040f91610cff305443ded429167fe6cf56b8b57491d11fe
4
+ data.tar.gz: 1e9535dac8014e69db495dacea161216d674106bbd82c50d73ec6fc2912d1178
5
5
  SHA512:
6
- metadata.gz: 5284e6ee863cc608f78759bcc52ffa81989ba13cb236f13d7e74631dd15eb92df0af7df3c16bc7e9fb232632966bc68dbba19d3aed7a46032840b801db9ef701
7
- data.tar.gz: 6fe30919e5763b5861c33a3d797c04f1ba5839b3a6d84cf04698fbab40337f08bfb2edef0e18ae5f3aa8a66c72c5b422c66dc253630008bba195af0fb9d32d79
6
+ metadata.gz: babcb3d934484da62fb54bc1c3582305e1980ebddb376e1dee68abac65d117b7ec562b279c74947c451e176d87a85485dd245738b9a7da17e70799c08921d567
7
+ data.tar.gz: 37100108a44b8001cacc7c8a827117bc350c0b59d94bd177e7893b4a4c67873ef6ee6c887e36f0c9ec53d8d15907fc410075f1ac16fb33f15552290c13be9245
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
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
+
3
8
  ## [0.4.5] - 2026-03-10
4
9
  - Show JRuby warnings at execution of jar file only if environment variable `DEBUG` is set to 'true'
5
10
 
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. |
@@ -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
@@ -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,
@@ -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}"
@@ -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.5"
5
- VERSION_DATE = "2026-03-10"
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.5
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-03-10 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'