jarbler 0.2.3 → 0.3.0
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 +10 -11
- data/lib/jarbler/builder.rb +1 -5
- data/lib/jarbler/config.rb +8 -8
- 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: e5bf0d9d2f693809471939cb344e2eda75ac6c9c270aaa310bd94753b7cf07c9
|
4
|
+
data.tar.gz: e367da474f36bb879d7f443caddffc9daac481979e7275d7eb9ec0f8e39394f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 643e64f9d2752d3be1041fd4607f8e809114dd97ca5a4f5d4cf4caae8dae15919a823f4e42cae5dd764fe9cbaf448e82fc738d09165afca9b042c23cac2e51eb
|
7
|
+
data.tar.gz: f67e8fea36cab2c072cc3c5aaeeb5695d6bda3b2e1e1d134f4a900afaf7d61bfc2b53988059b33c9dd4cc5698d368bbc9fbc43fa99569926a694ead10f638cc9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.0] - 2024-06-18
|
4
|
+
|
5
|
+
- excludes_from_compile specifies paths as the location in the jar file
|
6
|
+
- Desupport of configuration attribute include_gems_to_compile
|
7
|
+
|
3
8
|
## [0.2.3] - 2024-06-13
|
4
9
|
|
5
10
|
- Show used configuration values in log output
|
data/README.md
CHANGED
@@ -53,17 +53,16 @@ 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) | The files and dirs of the project to exclude from the include option
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
| jruby_version | The current most recent JRuby version | The version of the JRuby runtime to use |
|
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 | The current most recent JRuby version | The version of the JRuby runtime to use |
|
67
66
|
|
68
67
|
|
69
68
|
## Troubleshooting
|
data/lib/jarbler/builder.rb
CHANGED
@@ -271,13 +271,9 @@ module Jarbler
|
|
271
271
|
|
272
272
|
ruby_files = Find.find('.').select { |f| f =~ /\.rb$/ } # find all Ruby files in the current directory
|
273
273
|
|
274
|
-
if !config.include_gems_to_compile
|
275
|
-
ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}gems#{File::SEPARATOR}/) } # Exclude ./gems/* directories from compiling
|
276
|
-
end
|
277
|
-
|
278
274
|
# Exclude named files or directories from compiling
|
279
275
|
config.excludes_from_compile.each do |exclude|
|
280
|
-
ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}
|
276
|
+
ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}#{exclude}/) }
|
281
277
|
end
|
282
278
|
|
283
279
|
ruby_files.each do |ruby_file|
|
data/lib/jarbler/config.rb
CHANGED
@@ -3,7 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Jarbler
|
5
5
|
class Config
|
6
|
-
attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :
|
6
|
+
attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :excludes_from_compile
|
7
7
|
|
8
8
|
CONFIG_FILE = 'config/jarble.rb'
|
9
9
|
# create instance of Config class with defaults or from config file
|
@@ -36,7 +36,6 @@ module Jarbler
|
|
36
36
|
puts " excludes_from_compile: #{config.excludes_from_compile}" unless config.excludes_from_compile.empty?
|
37
37
|
puts " executable: #{config.executable}"
|
38
38
|
puts " executable_params: #{config.executable_params}" unless config.executable_params.empty?
|
39
|
-
puts " include_gems_to_compile: #{config.include_gems_to_compile}" if config.include_gems_to_compile
|
40
39
|
puts " includes: #{config.includes}" unless config.includes.empty?
|
41
40
|
puts " jar_name: #{config.jar_name}"
|
42
41
|
puts " jruby_version: #{config.jruby_version}"
|
@@ -47,10 +46,9 @@ module Jarbler
|
|
47
46
|
def initialize
|
48
47
|
@compile_ruby_files = false
|
49
48
|
@excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
|
50
|
-
@excludes_from_compile =
|
49
|
+
@excludes_from_compile = []
|
51
50
|
@executable = 'bin/rails'
|
52
51
|
@executable_params = %w(server -e production -p 8080)
|
53
|
-
@include_gems_to_compile = false
|
54
52
|
@includes = %w(app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile script vendor tmp)
|
55
53
|
@jar_name = File.basename(Dir.pwd) + '.jar'
|
56
54
|
@jruby_version = nil # determined automatically at runtime
|
@@ -88,10 +86,8 @@ module Jarbler
|
|
88
86
|
# the original ruby files are not included in the jar file, so source code is not visible
|
89
87
|
# config.compile_ruby_files = #{compile_ruby_files}
|
90
88
|
|
91
|
-
# Compile also the .rb files of the gems of the project to Java .class files?
|
92
|
-
# config.include_gems_to_compile = #{include_gems_to_compile}
|
93
|
-
|
94
89
|
# Directories or files to exclude from the compilation if compile_ruby_files = true
|
90
|
+
# The paths map to the final location of files or dirs in the jar file, e.g. config.excludes_from_compile = ['gems', 'app_root/app/models']
|
95
91
|
# config.excludes_from_compile = #{excludes_from_compile}
|
96
92
|
|
97
93
|
".split("\n"))
|
@@ -150,6 +146,11 @@ module Jarbler
|
|
150
146
|
puts msg if ENV['DEBUG']
|
151
147
|
end
|
152
148
|
|
149
|
+
# Avoid exception if using depprecated config attribute include_gems_to_compile
|
150
|
+
def include_gems_to_compile=(_value)
|
151
|
+
puts "Configuration attribute 'include_gems_to_compile' is deprecated. Use 'excludes_from_compile = [\”gems\”]' instead."
|
152
|
+
end
|
153
|
+
|
153
154
|
def validate_values
|
154
155
|
raise "Invalid config value for jar name: #{jar_name}" unless jar_name =~ /\w+/
|
155
156
|
raise "Invalid config value for executable: #{executable}" unless executable =~ /\w+/
|
@@ -158,7 +159,6 @@ module Jarbler
|
|
158
159
|
raise "Invalid config value for excludes: #{excludes}" unless excludes.is_a?(Array)
|
159
160
|
raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
|
160
161
|
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')
|
161
|
-
raise "include_gems_to_compile = true is supported only if compile_ruby_files = true!" if include_gems_to_compile && !compile_ruby_files
|
162
162
|
raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array)
|
163
163
|
end
|
164
164
|
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.
|
4
|
+
version: 0.3.0
|
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-06-
|
11
|
+
date: 2024-06-16 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'
|