jarbler 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -8
- data/README.md +14 -3
- data/build_gem.sh +1 -1
- data/lib/jarbler/JarMain.java +3 -1
- data/lib/jarbler/builder.rb +14 -10
- 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: 2be6f0a0ffe320df86b23b1e9f70fd0e1d65be38c9bac0f1a2c4d165f1c62969
|
4
|
+
data.tar.gz: 38fe9c1a73da1682ba09ce8364e6f174a567ad563f7254322a8a2a85fb19e329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26346f96a9051a76a5ad7b94d3317dbfd604b52c45ae0b4102d809a2c0d82f26226c81cf27028352b756d56f8a99032ac128827755f0ccfc7f2998b78491f531
|
7
|
+
data.tar.gz: b9b4720764fcaf4cdde6ff2051d1667fe5571ccd3fef3bca71f32a9b129a4d680998657ea8213ac395a1f1e9fc60a1eee21148acf34b5cfb4d09317d255af230
|
data/CHANGELOG.md
CHANGED
@@ -1,21 +1,33 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.
|
3
|
+
## [0.1.6] - 2023-06-19
|
4
4
|
|
5
|
-
-
|
5
|
+
- Bugfix: Do not clone default gems, because they are already included in the jruby jars standard library
|
6
6
|
|
7
|
-
## [0.1.
|
7
|
+
## [0.1.5] - 2023-06-15
|
8
8
|
|
9
|
-
-
|
9
|
+
- Bugfix: use minor ruby version without patch level for Gem files location
|
10
10
|
|
11
|
-
## [0.1.
|
11
|
+
## [0.1.4] - 2023-04-28
|
12
12
|
|
13
|
-
-
|
13
|
+
- Jarbler also supports Gemfile references to Gems with git dependencies now
|
14
14
|
|
15
15
|
## [0.1.3] - 2023-04-25
|
16
16
|
|
17
17
|
- Removed .jruby-version so that the jruby version is not fixed anymore
|
18
18
|
|
19
|
-
## [0.1.
|
19
|
+
## [0.1.2] - 2023-04-24
|
20
|
+
|
21
|
+
- extract valid Gem paths from Bundler instead of using the environment variable GEM_PATH
|
22
|
+
|
23
|
+
## [0.1.1] - 2023-04-24
|
24
|
+
|
25
|
+
- Fixed the bug 'java.lang.ClassNotFoundException: org.jruby.Main' with Windows
|
26
|
+
|
27
|
+
## [0.1.0] - 2023-04-12
|
28
|
+
|
29
|
+
- Initial release
|
30
|
+
|
31
|
+
|
32
|
+
|
20
33
|
|
21
|
-
- Jarbler also supports Gemfile references to Gems with git dependencies now
|
data/README.md
CHANGED
@@ -15,6 +15,8 @@ Install the gem and add to the application's Gemfile by executing:
|
|
15
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
16
|
|
17
17
|
$ gem install jarbler
|
18
|
+
|
19
|
+
[![Gem Version](https://badge.fury.io/rb/jarbler.svg)](https://badge.fury.io/rb/jarbler)
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
@@ -47,9 +49,18 @@ To create a template config file with information about all the supported config
|
|
47
49
|
|
48
50
|
$ jarble config
|
49
51
|
|
50
|
-
The default configuration
|
51
|
-
|
52
|
-
|
52
|
+
The default configuration if focused on Ruby on Rails applications.<br>
|
53
|
+
|
54
|
+
### Configuration options
|
55
|
+
| Option | Default value | Description |
|
56
|
+
|-------------------|--------------------------------------------------------------------------------|---------------------------------------------------------------------|
|
57
|
+
| executable | "bin/rails" | The ruby file to run at execution of jar file |
|
58
|
+
| executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
|
59
|
+
| excludes | ["tmp/cache", "tmp/pids", ...] (see generated template file for whole content) | The files and dirs of the project to exlude from the include option |
|
60
|
+
| includes | ["app", "bin", "config", ...] (see generated template file for whole content) | The files and dirs of the project to include in the jar file |
|
61
|
+
| jar_name | < Name of project dir >.jar | The name of the generated jar file |
|
62
|
+
| jruby_version | The current most recent jRuby version | The version of the jRuby runtime to use |
|
63
|
+
|
53
64
|
|
54
65
|
## Troubleshooting
|
55
66
|
* Set DEBUG=true in environment to get additional runtime information
|
data/build_gem.sh
CHANGED
data/lib/jarbler/JarMain.java
CHANGED
@@ -57,7 +57,7 @@ class JarMain {
|
|
57
57
|
jarPath = jarPath.substring(1); // remove the leading slash
|
58
58
|
}
|
59
59
|
|
60
|
-
// extract the jarFile by
|
60
|
+
// extract the jarFile by unzipping it (not using the jar utility which may not be available)
|
61
61
|
System.out.println("Extracting files from "+jarPath+" to "+ newFolder.getAbsolutePath());
|
62
62
|
unzip(jarPath, newFolder.getAbsolutePath());
|
63
63
|
|
@@ -135,8 +135,10 @@ class JarMain {
|
|
135
135
|
debug(" - " + arg);
|
136
136
|
}
|
137
137
|
|
138
|
+
debug("jRuby set property 'user.dir' to '" + app_root + "'");
|
138
139
|
System.setProperty("user.dir", app_root);
|
139
140
|
// call the method org.jruby.Main.main
|
141
|
+
debug("Calling org.jruby.Main.main with: "+ mainArgs);
|
140
142
|
mainMethod.invoke(null, (Object)mainArgs.toArray(new String[mainArgs.size()]));
|
141
143
|
} catch (Exception e) {
|
142
144
|
e.printStackTrace();
|
data/lib/jarbler/builder.rb
CHANGED
@@ -18,7 +18,7 @@ module Jarbler
|
|
18
18
|
app_root = Dir.pwd
|
19
19
|
debug "Project dir: #{app_root}"
|
20
20
|
|
21
|
-
|
21
|
+
ruby_minor_version = copy_jruby_jars_to_staging(staging_dir) # Copy the jruby jars to the staging directory
|
22
22
|
exec_command "javac -nowarn -Xlint:deprecation -source 8 -target 8 -d #{staging_dir} #{__dir__}/JarMain.java" # Compile the Java files
|
23
23
|
|
24
24
|
# Copy the application project to the staging directory
|
@@ -31,7 +31,7 @@ module Jarbler
|
|
31
31
|
raise "Gemfile.lock not found in #{app_root}" unless File.exist?("#{app_root}/Gemfile.lock")
|
32
32
|
|
33
33
|
# Copy the needed Gems to the staging directory
|
34
|
-
copy_needed_gems_to_staging(staging_dir,
|
34
|
+
copy_needed_gems_to_staging(staging_dir, ruby_minor_version)
|
35
35
|
|
36
36
|
Dir.chdir(staging_dir) do
|
37
37
|
# create the manifest file
|
@@ -101,10 +101,10 @@ module Jarbler
|
|
101
101
|
|
102
102
|
# Copy the needed Gems to the staging directory
|
103
103
|
# @param staging_dir [String] the staging directory
|
104
|
-
# @param
|
104
|
+
# @param ruby_minor_version [String] the corresponding ruby minor version of the jruby jars version
|
105
105
|
# @return [void]
|
106
|
-
def copy_needed_gems_to_staging(staging_dir,
|
107
|
-
gem_target_location = "#{staging_dir}/gems/jruby/#{
|
106
|
+
def copy_needed_gems_to_staging(staging_dir, ruby_minor_version)
|
107
|
+
gem_target_location = "#{staging_dir}/gems/jruby/#{ruby_minor_version}"
|
108
108
|
FileUtils.mkdir_p("#{gem_target_location}/gems")
|
109
109
|
FileUtils.mkdir_p("#{gem_target_location}/specifications")
|
110
110
|
FileUtils.mkdir_p("#{gem_target_location}/bundler/gems")
|
@@ -121,9 +121,11 @@ module Jarbler
|
|
121
121
|
# Copy the Gem from bundler/gems including the gemspec
|
122
122
|
file_utils_copy(spec.gem_dir, "#{gem_target_location}/bundler/gems")
|
123
123
|
else # Gem is from rubygems
|
124
|
-
# copy the
|
125
|
-
|
126
|
-
|
124
|
+
unless spec.default_gem? # Do not copy default gems, because they are already included in the jruby jars standard library
|
125
|
+
# copy the Gem and gemspec separately
|
126
|
+
file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems")
|
127
|
+
file_utils_copy("#{spec.gem_dir}/../../specifications/#{needed_gem[:full_name]}.gemspec", "#{gem_target_location}/specifications")
|
128
|
+
end
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|
@@ -200,7 +202,7 @@ module Jarbler
|
|
200
202
|
|
201
203
|
# Copy the jruby-jars to the staging directory
|
202
204
|
# @param [String] staging_dir Path to the staging directory
|
203
|
-
# @return [String] the ruby version of the jRuby jars
|
205
|
+
# @return [String] the minor ruby version of the jRuby jars with patch level set to 0
|
204
206
|
def copy_jruby_jars_to_staging(staging_dir)
|
205
207
|
|
206
208
|
# Ensure that jruby-jars gem is installed, otherwise install it. Accepts also bundler path in .bundle/config
|
@@ -224,7 +226,9 @@ module Jarbler
|
|
224
226
|
raise "Could not determine Ruby version for jRuby #{config.jruby_version} in following output:\n#{lines}" unless match_result
|
225
227
|
ruby_version = match_result[0].tr('()', '')
|
226
228
|
debug "Corresponding Ruby version for jRuby (#{config.jruby_version}): #{ruby_version}"
|
227
|
-
ruby_version
|
229
|
+
ruby_minor_version = ruby_version.split('.')[0..1].join('.') + '.0'
|
230
|
+
debug "Corresponding Ruby minor version for jRuby (#{config.jruby_version}): #{ruby_minor_version}"
|
231
|
+
ruby_minor_version
|
228
232
|
end
|
229
233
|
|
230
234
|
# Execute the command in OS and return the output
|
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.1.
|
4
|
+
version: 0.1.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: 2023-
|
11
|
+
date: 2023-06-19 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'
|