jarbler 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c6eb4bd62cd4f241608b950e6cc12818efba108f75c79650a6ddcfa558315f6
4
- data.tar.gz: 13574e8c87bcb8d8a3a3ed2a6263046559982d8de8572aaaa31a24ff81717c62
3
+ metadata.gz: e5bf0d9d2f693809471939cb344e2eda75ac6c9c270aaa310bd94753b7cf07c9
4
+ data.tar.gz: e367da474f36bb879d7f443caddffc9daac481979e7275d7eb9ec0f8e39394f0
5
5
  SHA512:
6
- metadata.gz: e87be06e969d43ec0584c96708456404d54011362a681a7f99617f72c3a7108a8e203e7a26279e5106f0f535b75cde0a2f1e3df10874b354816d519893d37161
7
- data.tar.gz: 2bffe72a8c78ba10605de7da93002f10eb08018ca17c88f932d1da49abefbfa6b68898f6d3ab22a338435dc57564118c1cf525272c45e277e099182952f0ceb9
6
+ metadata.gz: 643e64f9d2752d3be1041fd4607f8e809114dd97ca5a4f5d4cf4caae8dae15919a823f4e42cae5dd764fe9cbaf448e82fc738d09165afca9b042c23cac2e51eb
7
+ data.tar.gz: f67e8fea36cab2c072cc3c5aaeeb5695d6bda3b2e1e1d134f4a900afaf7d61bfc2b53988059b33c9dd4cc5698d368bbc9fbc43fa99569926a694ead10f638cc9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
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
+
8
+ ## [0.2.3] - 2024-06-13
9
+
10
+ - Show used configuration values in log output
11
+
3
12
  ## [0.2.2] - 2024-06-13
4
13
 
5
14
  - Exclude certain dirs or files from compilation with 'excludes_from_compile' option in config file
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 | 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 | ["config"] | The files and dirs of the project to exclude from the compilation of .rb files |
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
- | include_gems_to_compile | false | Should .rb files of the project gems also be compiled if compile_ruby_files = true |
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 |
65
- | jar_name | &lt; Name of project dir &gt;.jar | The name of the generated jar file |
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 | &lt; Name of project dir &gt;.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
@@ -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}app_root#{File::SEPARATOR}#{exclude}/) }
276
+ ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}#{exclude}/) }
281
277
  end
282
278
 
283
279
  ruby_files.each do |ruby_file|
@@ -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, :include_gems_to_compile, :excludes_from_compile
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
@@ -23,16 +23,32 @@ module Jarbler
23
23
  config.executable = config.executable.sub(/\.rb$/, '.class') if config.compile_ruby_files
24
24
 
25
25
  config.validate_values
26
+
27
+ puts ""
28
+ if File.exist?(CONFIG_FILE)
29
+ puts "Configuration loaded from file #{File.join(Dir.pwd, CONFIG_FILE)}"
30
+ else
31
+ puts "No configuration file found at #{File.join(Dir.pwd, CONFIG_FILE)}. Using default values."
32
+ end
33
+ puts "Used configuration values are:"
34
+ puts " compile_ruby_files: #{config.compile_ruby_files}" if config.compile_ruby_files
35
+ puts " excludes: #{config.excludes}" unless config.excludes.empty?
36
+ puts " excludes_from_compile: #{config.excludes_from_compile}" unless config.excludes_from_compile.empty?
37
+ puts " executable: #{config.executable}"
38
+ puts " executable_params: #{config.executable_params}" unless config.executable_params.empty?
39
+ puts " includes: #{config.includes}" unless config.includes.empty?
40
+ puts " jar_name: #{config.jar_name}"
41
+ puts " jruby_version: #{config.jruby_version}"
42
+ puts ""
26
43
  config
27
44
  end
28
45
 
29
46
  def initialize
30
47
  @compile_ruby_files = false
31
48
  @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
32
- @excludes_from_compile = %w(config)
49
+ @excludes_from_compile = []
33
50
  @executable = 'bin/rails'
34
51
  @executable_params = %w(server -e production -p 8080)
35
- @include_gems_to_compile = false
36
52
  @includes = %w(app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile script vendor tmp)
37
53
  @jar_name = File.basename(Dir.pwd) + '.jar'
38
54
  @jruby_version = nil # determined automatically at runtime
@@ -70,10 +86,8 @@ module Jarbler
70
86
  # the original ruby files are not included in the jar file, so source code is not visible
71
87
  # config.compile_ruby_files = #{compile_ruby_files}
72
88
 
73
- # Compile also the .rb files of the gems of the project to Java .class files?
74
- # config.include_gems_to_compile = #{include_gems_to_compile}
75
-
76
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']
77
91
  # config.excludes_from_compile = #{excludes_from_compile}
78
92
 
79
93
  ".split("\n"))
@@ -132,6 +146,11 @@ module Jarbler
132
146
  puts msg if ENV['DEBUG']
133
147
  end
134
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
+
135
154
  def validate_values
136
155
  raise "Invalid config value for jar name: #{jar_name}" unless jar_name =~ /\w+/
137
156
  raise "Invalid config value for executable: #{executable}" unless executable =~ /\w+/
@@ -140,7 +159,6 @@ module Jarbler
140
159
  raise "Invalid config value for excludes: #{excludes}" unless excludes.is_a?(Array)
141
160
  raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
142
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')
143
- raise "include_gems_to_compile = true is supported only if compile_ruby_files = true!" if include_gems_to_compile && !compile_ruby_files
144
162
  raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array)
145
163
  end
146
164
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.2.2"
5
- VERSION_DATE = "2024-06-13"
4
+ VERSION = "0.3.0"
5
+ VERSION_DATE = "2024-06-16"
6
6
  end
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.2.2
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-13 00:00:00.000000000 Z
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'