jarbler 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +11 -11
- data/lib/jarbler/config.rb +37 -25
- 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: ae7132c21c27b0d51a870c3e79470d83a4d4b6b088c474c8cdaf4cf4ed34a79c
|
4
|
+
data.tar.gz: 8e149011da1e3957f425f659a7ac35b47e1696b3896f1a617c6027d027a783bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0712390a6916ee50d063c3f9dcc92fc6389c3ca566bc0b089d5df0275e3044b0aee30d3dedbcaf8171642e8555958137ef8a1ab8d14123417af8bc4475fee44
|
7
|
+
data.tar.gz: b85408f04e6c496827c8fc78d34a78790e173721c6c10e9899e07a29c818d4986296bdfadf5cc79e1ff1de49ff5679d1982cfdc370c3bacca15786c62b7b9e85
|
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/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.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: 2024-
|
11
|
+
date: 2024-07-02 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'
|