jarbler 0.4.0 → 0.4.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: 792e9125f2dd1d6a61bf741655f724f6139777ae2ef8f7076874520024764d3d
4
- data.tar.gz: e5d238d29e05a075a7d60ecdfda2b239b27c8b873aa917f029ee92c45cfcb50e
3
+ metadata.gz: 70f0325158bf02611ae188df443a2e22a3032f7b8e275e09d0e2ff8216476979
4
+ data.tar.gz: 1d5ca40cfa30dad802a394e4b4980854d0a0bb093cf00eafece8ef5b090e5c85
5
5
  SHA512:
6
- metadata.gz: 441fff46742aa485e9e2adfbf8f2e09478b835c450c735d4060bfe302bb3bf0cb27c50cc976e4e9893d20089921797706e192a7d30681f091b46183d646c3229
7
- data.tar.gz: d9f8addc2d6b81fd20692956524c325fa438d0dd1eac257cffb5ae7b659724698b4e8b1218169119cd5943c48d0fa12d498126cba785c9b632060c37d7599995
6
+ metadata.gz: c3671a308f5c65bcc937676930c9792d6461db55f52e2dd6d609edb3ad1d75262164740b951d733fb71041954fc8ee3377b91122af78d0e1768e1977bc851470
7
+ data.tar.gz: c33d7b1affbcf4cdd4c7cb9f1e5ecf375e083266c59e077ed28d4532ded06b301d4b88b29e9afb63ba0c2d98c699ca9315d7afd35b3bb2037728d3e602693d4b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2025-07-15
4
+
5
+ - config attribute 'gemfile_groups' established to specify the groups of the Gemfile which should be included in the jar file
3
6
 
4
7
  ## [0.4.0] - 2025-04-24
5
8
 
data/README.md CHANGED
@@ -56,10 +56,11 @@ 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
- | 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
59
  | 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
60
  | 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
+ | 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. |
62
+ | executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
63
+ | gemfile_groups | [:default, :production] | List of groups from Gemfile to include in the jar file, e.g. [:default, :production, :development, :test].<br/>Group :default are all gems not assigned to a specific group. |
63
64
  | 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
65
  | jar_name | &lt; Name of project dir &gt;.jar | The name of the generated jar file |
65
66
  | java_opts | none | Additional options for the Java compiler (javac).<br/>Used for the compilation of the jar file bootstrap class JarMain.java.<br/>Does not influence the optional AOT compilation of the application's ruby files.<br/>E.g. control the class file version of the JarMain.class with `java_opts = '-target 1.8 -source 1.8‘`. |
@@ -10,7 +10,7 @@ module Jarbler
10
10
  class Builder
11
11
  # Execute all functions needed to build the jar file
12
12
  # Should be executed in application directory of Rails/Ruby application
13
- # @return [void]
13
+ # @return [String] Ruby minor version of the JRuby jars with patch level set to 0
14
14
  def build_jar
15
15
  debug "Running with Ruby version '#{RUBY_VERSION}' on platform '#{RUBY_PLATFORM}'. Engine '#{RUBY_ENGINE}' version '#{RUBY_ENGINE_VERSION}'"
16
16
 
@@ -72,6 +72,7 @@ module Jarbler
72
72
  # place the jar in project directory
73
73
  file_utils_copy(config.jar_name, app_root)
74
74
  puts "Created jar file #{app_root}/#{config.jar_name}"
75
+ ruby_minor_version # Used in tests to know the target Gem dir
75
76
  end
76
77
  rescue Exception => e
77
78
  puts "Error: #{e.message}"
@@ -144,10 +145,10 @@ module Jarbler
144
145
  lockfile_parser = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
145
146
  lockfile_specs = lockfile_parser.specs
146
147
 
147
- Bundler.setup # Load Gems specified in Gemfile, ensure that Gem path also includes the Gems loaded into bundler dir
148
+ Bundler.setup(*config.gemfile_groups) # Load Gems specified in Gemfile, ensure that Gem path also includes the Gems loaded into bundler dir
148
149
  # filter Gems needed for production
149
150
  gemfile_specs = Bundler.definition.dependencies.select do |d|
150
- d.groups.include?(:default) || d.groups.include?(:production)
151
+ !(d.groups & config.gemfile_groups).empty? # Check if the Gem is in the groups specified in config.gemfile_groups
151
152
  end
152
153
 
153
154
  debug "Gems from Gemfile needed for production:"
@@ -9,6 +9,7 @@ module Jarbler
9
9
  :excludes_from_compile,
10
10
  :executable,
11
11
  :executable_params,
12
+ :gemfile_groups,
12
13
  :includes,
13
14
  :java_opts,
14
15
  :jar_name,
@@ -47,6 +48,7 @@ module Jarbler
47
48
  puts " excludes_from_compile: #{config.excludes_from_compile}" if config.compile_ruby_files
48
49
  puts " executable: #{config.executable}"
49
50
  puts " executable_params: #{config.executable_params}"
51
+ puts " gemfile_groups: #{config.gemfile_groups}"
50
52
  puts " includes: #{config.includes}"
51
53
  puts " jar_name: #{config.jar_name}"
52
54
  puts " java_opts: #{config.java_opts}"
@@ -57,17 +59,18 @@ module Jarbler
57
59
  end
58
60
 
59
61
  def initialize
60
- @compile_ruby_files = false
61
- @compile_java_version = nil # deprecated, use java_opts instead
62
- @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
63
- @excludes_from_compile = []
64
- @executable = 'bin/rails'
65
- @executable_params = %w(server -e production -p 8080)
66
- @includes = %w(app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile script vendor tmp)
67
- @java_opts = nil
68
- @jar_name = File.basename(Dir.pwd) + '.jar'
69
- @jrubyc_opts = []
70
- @jruby_version = nil # determined automatically at runtime
62
+ @compile_ruby_files = false
63
+ @compile_java_version = nil # deprecated, use java_opts instead
64
+ @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
65
+ @excludes_from_compile = []
66
+ @executable = 'bin/rails'
67
+ @executable_params = %w(server -e production -p 8080)
68
+ @gemfile_groups = [:default, :production]
69
+ @includes = %w(app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile script vendor tmp)
70
+ @java_opts = nil
71
+ @jar_name = File.basename(Dir.pwd) + '.jar'
72
+ @jrubyc_opts = []
73
+ @jruby_version = nil # determined automatically at runtime
71
74
  # execute additional block if given
72
75
  yield self if block_given?
73
76
  end
@@ -93,6 +96,10 @@ module Jarbler
93
96
  # Additional command line parameters for the Ruby executable
94
97
  # config.executable_params = #{executable_params}
95
98
 
99
+ # List of groups from Gemfile to include in the jar file, e.g. [:default, :production, :development, :test]
100
+ # group :default are all gems not assigned to a specific group
101
+ # config.gemfile_groups = #{gemfile_groups}
102
+
96
103
  # Application directories or files to include in the jar file
97
104
  # config.includes = #{includes}
98
105
  # config.includes << 'additional'
@@ -187,6 +194,7 @@ module Jarbler
187
194
  raise "Invalid config value for jar name: #{jar_name}" unless jar_name =~ /\w+/
188
195
  raise "Invalid config value for executable: #{executable}" unless executable =~ /\w+/
189
196
  raise "Invalid config value for executable params: #{executable_params}" unless executable_params.is_a?(Array)
197
+ raise "Invalid config value for gemfile groups: #{gemfile_groups}" unless gemfile_groups.is_a?(Array)
190
198
  raise "Invalid config value for includes: #{includes}" unless includes.is_a?(Array)
191
199
  raise "Invalid config value for excludes: #{excludes}" unless excludes.is_a?(Array)
192
200
  raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.4.0"
5
- VERSION_DATE = "2025-04-24"
4
+ VERSION = "0.4.1"
5
+ VERSION_DATE = "2025-07-15"
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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-24 00:00:00.000000000 Z
11
+ date: 2025-07-15 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'