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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +3 -2
- data/lib/jarbler/builder.rb +4 -3
- data/lib/jarbler/config.rb +19 -11
- data/lib/jarbler/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70f0325158bf02611ae188df443a2e22a3032f7b8e275e09d0e2ff8216476979
|
4
|
+
data.tar.gz: 1d5ca40cfa30dad802a394e4b4980854d0a0bb093cf00eafece8ef5b090e5c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3671a308f5c65bcc937676930c9792d6461db55f52e2dd6d609edb3ad1d75262164740b951d733fb71041954fc8ee3377b91122af78d0e1768e1977bc851470
|
7
|
+
data.tar.gz: c33d7b1affbcf4cdd4c7cb9f1e5ecf375e083266c59e077ed28d4532ded06b301d4b88b29e9afb63ba0c2d98c699ca9315d7afd35b3bb2037728d3e602693d4b
|
data/CHANGELOG.md
CHANGED
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 | < Name of project dir >.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‘`. |
|
data/lib/jarbler/builder.rb
CHANGED
@@ -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 [
|
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.
|
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:"
|
data/lib/jarbler/config.rb
CHANGED
@@ -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
|
61
|
-
@compile_java_version
|
62
|
-
@excludes
|
63
|
-
@excludes_from_compile
|
64
|
-
@executable
|
65
|
-
@executable_params
|
66
|
-
@
|
67
|
-
@
|
68
|
-
@
|
69
|
-
@
|
70
|
-
@
|
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)
|
data/lib/jarbler/version.rb
CHANGED
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
|
+
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-
|
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'
|