jarbler 0.3.0 → 0.3.2
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 +5 -0
- data/README.md +11 -11
- data/lib/jarbler/JarMain.java +5 -2
- data/lib/jarbler/config.rb +37 -25
- data/lib/jarbler/version.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d57d186383ffc6bf5de8396b10fa81aa47947bedb96f36ef67d4cbecef2ca2fb
|
4
|
+
data.tar.gz: 64c3888a99ec67bbf0e4ac0c3c85a5d2f8cd042a84403ad879a02476c8c62a80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ef50f2616b885cca428943bcc6baf4d0db106da0e7620339981378ef2321ccd6b336c7c992a10531e670b6c63baa80d14f37512e8890b9136593047267adbcb
|
7
|
+
data.tar.gz: f4b1644168cdc90c5314b65cf616b1d096bec65888de485b490744f68b9577867c9a3625f8dbc7e443c11c7b57ea125210ce45a159f3e8ad477f559d8610f910
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.1] - 2024-07-02
|
4
|
+
|
5
|
+
- Use file .ruby-version to define the JRuby version for the jar file only if .ruby-version contains a valid jRuby version
|
6
|
+
|
7
|
+
|
3
8
|
## [0.3.0] - 2024-06-18
|
4
9
|
|
5
10
|
- excludes_from_compile specifies paths as the location in the jar file
|
data/README.md
CHANGED
@@ -53,20 +53,20 @@ 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
|
57
|
-
|
58
|
-
| compile_ruby_files | false
|
59
|
-
| executable | "bin/rails"
|
60
|
-
| executable_params | ["server", "-e", "production", "-p", "8080"]
|
61
|
-
| excludes_from_compile | []
|
62
|
-
| excludes | ["tmp/cache", "tmp/pids", ...] (see generated template file for whole content)
|
63
|
-
| includes | ["app", "bin", "config", ...] (see generated template file for whole content)
|
64
|
-
| jar_name | < Name of project dir >.jar
|
65
|
-
| jruby_version |
|
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 | < Name of project dir >.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
|
69
|
-
* Set DEBUG=true in environment to get additional runtime information
|
69
|
+
* Set DEBUG=true in OS environment to get additional runtime information
|
70
70
|
* The temporary folder with the extracted app and JRuby runtime files is not deleted after execution if DEBUG is set.
|
71
71
|
|
72
72
|
### Possible error messages
|
data/lib/jarbler/JarMain.java
CHANGED
@@ -56,9 +56,12 @@ class JarMain {
|
|
56
56
|
jarPath = jarPath.substring(1); // remove the leading slash
|
57
57
|
}
|
58
58
|
|
59
|
+
// get the absolute path of the jar file, especially if it contains spaces in Windows
|
60
|
+
String aboluteJarPath = new File(jarPath).getAbsolutePath();
|
61
|
+
|
59
62
|
// extract the jarFile by unzipping it (not using the jar utility which may not be available)
|
60
|
-
System.out.println("Extracting files from "+
|
61
|
-
unzip(
|
63
|
+
System.out.println("Extracting files from "+aboluteJarPath+" to "+ newFolder.getAbsolutePath());
|
64
|
+
unzip(aboluteJarPath, newFolder.getAbsolutePath());
|
62
65
|
|
63
66
|
String app_root = newFolder.getAbsolutePath()+File.separator+"app_root";
|
64
67
|
|
data/lib/jarbler/config.rb
CHANGED
@@ -31,12 +31,12 @@ module Jarbler
|
|
31
31
|
puts "No configuration file found at #{File.join(Dir.pwd, CONFIG_FILE)}. Using default values."
|
32
32
|
end
|
33
33
|
puts "Used configuration values are:"
|
34
|
-
puts " compile_ruby_files: #{config.compile_ruby_files}"
|
35
|
-
puts " excludes: #{config.excludes}"
|
36
|
-
puts " excludes_from_compile: #{config.excludes_from_compile}"
|
34
|
+
puts " compile_ruby_files: #{config.compile_ruby_files}"
|
35
|
+
puts " excludes: #{config.excludes}"
|
36
|
+
puts " excludes_from_compile: #{config.excludes_from_compile}"
|
37
37
|
puts " executable: #{config.executable}"
|
38
|
-
puts " executable_params: #{config.executable_params}"
|
39
|
-
puts " includes: #{config.includes}"
|
38
|
+
puts " executable_params: #{config.executable_params}"
|
39
|
+
puts " includes: #{config.includes}"
|
40
40
|
puts " jar_name: #{config.jar_name}"
|
41
41
|
puts " jruby_version: #{config.jruby_version}"
|
42
42
|
puts ""
|
@@ -117,29 +117,40 @@ module Jarbler
|
|
117
117
|
|
118
118
|
# define JRuby version if not set in config file
|
119
119
|
def define_jruby_version
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
if @jruby_version.nil? && File.exist?('.ruby-version') # not yet defined in config file but .ruby-version file exists
|
121
|
+
# read the file RAILS_ROOT/.ruby-version starting from char at position 6 to the end of the line
|
122
|
+
full_jruby_version_string = File.read('.ruby-version')
|
123
|
+
if full_jruby_version_string[0..5] == 'jruby-'
|
124
|
+
@jruby_version = full_jruby_version_string[6..20].strip
|
125
|
+
if @jruby_version =~ /\d+\.\d+\.\d+\.\d+/ # check if the version is valid with four digits
|
126
|
+
debug "Jarbler::Config.define_jruby_version: JRuby version used from .ruby-version file: #{@jruby_version}"
|
127
|
+
else
|
128
|
+
debug "Jarbler::Config.define_jruby_version: Invalid JRuby version in .ruby-version file (not four digits delimited by dot): #{full_jruby_version_string}"
|
129
|
+
@jruby_version = nil
|
130
|
+
end
|
125
131
|
else
|
126
|
-
|
127
|
-
# Fetch the gem specification from Rubygems.org
|
128
|
-
# search for the gem and get the JSON response
|
129
|
-
response = Gem::SpecFetcher.fetcher.search_for_dependency(Gem::Dependency.new('jruby-jars'))
|
130
|
-
# extract the versions from the response
|
131
|
-
self.jruby_version = response&.first&.first&.first&.version&.to_s
|
132
|
-
raise "Unable to determine the latest available version of jruby-jars gem!\Rsponse = #{response.inspect}" unless self.jruby_version
|
133
|
-
|
134
|
-
#command = "gem search --remote jruby-jars"
|
135
|
-
#lines = `#{command}`
|
136
|
-
#raise "Command \"#{command}\" failed with return code #{$?} and output:\n#{lines}" unless $?.success?
|
137
|
-
#jruby_jars_line = lines.match(/^jruby-jars \((.*)\)/)
|
138
|
-
#raise "No jruby-jars gem found in rubygems.org!" unless jruby_jars_line
|
139
|
-
#self.jruby_version = /\((.*?)\)/.match(jruby_jars_line.to_s)[1]
|
140
|
-
debug "JRuby version from latest jruby-jars gem: #{jruby_version}"
|
132
|
+
debug "Jarbler::Config.define_jruby_version: Version info from .ruby-version file not applicable: #{full_jruby_version_string}"
|
141
133
|
end
|
142
134
|
end
|
135
|
+
|
136
|
+
if @jruby_version.nil? # not yet defined in config file and .ruby-version file
|
137
|
+
# no .ruby-version file to be used, use JRuby version of the latest Gem
|
138
|
+
# Fetch the gem specification from Rubygems.org
|
139
|
+
# search for the gem and get the JSON response
|
140
|
+
response = Gem::SpecFetcher.fetcher.search_for_dependency(Gem::Dependency.new('jruby-jars'))
|
141
|
+
debug("Jarbler::Config.define_jruby_version: Response from search_for_dependency = #{response.inspect}")
|
142
|
+
# extract the versions from the response
|
143
|
+
@jruby_version = response&.first&.first&.first&.version&.to_s
|
144
|
+
raise "Unable to determine the latest available version of jruby-jars gem!\nResponse = #{response.inspect}" unless @jruby_version
|
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
|
+
debug "Jarbler::Config.define_jruby_version: JRuby version from latest jruby-jars gem: #{jruby_version}"
|
153
|
+
end
|
143
154
|
end
|
144
155
|
|
145
156
|
def debug(msg)
|
@@ -160,6 +171,7 @@ module Jarbler
|
|
160
171
|
raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
|
161
172
|
raise "compile_ruby_files = true is supported only with JRuby! Current runtime is '#{RUBY_ENGINE}'" if compile_ruby_files && (defined?(RUBY_ENGINE) && RUBY_ENGINE != 'jruby')
|
162
173
|
raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array)
|
174
|
+
raise "Invalid config value for jruby_version: #{jruby_version}" unless jruby_version.nil? || jruby_version =~ /\d+\.\d+\.\d+\.\d+/
|
163
175
|
end
|
164
176
|
end
|
165
177
|
end
|
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.3.
|
4
|
+
version: 0.3.2
|
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:
|
11
|
+
date: 2025-03-01 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'
|
@@ -42,7 +42,7 @@ metadata:
|
|
42
42
|
homepage_uri: https://github.com/rammpeter/jarbler
|
43
43
|
source_code_uri: https://github.com/rammpeter/jarbler
|
44
44
|
changelog_uri: https://github.com/rammpeter/jarbler/CHANGELOG.md
|
45
|
-
post_install_message:
|
45
|
+
post_install_message:
|
46
46
|
rdoc_options: []
|
47
47
|
require_paths:
|
48
48
|
- lib
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubygems_version: 3.3.27
|
61
|
-
signing_key:
|
61
|
+
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Pack a Ruby app into a Java jar file
|
64
64
|
test_files: []
|