jarbler 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f5261d55e15e23454414413af5f467bfdf5c2554916574269d6fa99f4a411a
4
- data.tar.gz: 5a77de393585a7fa444157ebc2e7835d6d39e2e0e004ade0f840d9f2f9abcff9
3
+ metadata.gz: 2c6eb4bd62cd4f241608b950e6cc12818efba108f75c79650a6ddcfa558315f6
4
+ data.tar.gz: 13574e8c87bcb8d8a3a3ed2a6263046559982d8de8572aaaa31a24ff81717c62
5
5
  SHA512:
6
- metadata.gz: ad30f274db2a26f844df82f295b95f9bdcd9a023f35bbc83a6d2b7ec44b77a4dd0b8ca5ca66bb3f46818acf927d2e72efefb0f8b2669b058f5f51b9dacdb6d49
7
- data.tar.gz: e07c531aa6082b3d186d2d3687d6a784b9b07593f4145e4d51bdd28247f57c710a35ed15196c18a0d3cb5a9f503808b242833709780b71442e0f293de1fe0db4
6
+ metadata.gz: e87be06e969d43ec0584c96708456404d54011362a681a7f99617f72c3a7108a8e203e7a26279e5106f0f535b75cde0a2f1e3df10874b354816d519893d37161
7
+ data.tar.gz: 2bffe72a8c78ba10605de7da93002f10eb08018ca17c88f932d1da49abefbfa6b68898f6d3ab22a338435dc57564118c1cf525272c45e277e099182952f0ceb9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.2] - 2024-06-13
4
+
5
+ - Exclude certain dirs or files from compilation with 'excludes_from_compile' option in config file
6
+
3
7
  ## [0.2.1] - 2024-06-13
4
8
 
5
9
  - Ruby files remain originally in jar if compile fails for a single file.
data/README.md CHANGED
@@ -58,7 +58,8 @@ The default configuration is focused on Ruby on Rails applications.<br>
58
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
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
60
  | executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
61
- | 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 |
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 |
62
63
  | include_gems_to_compile | false | Should .rb files of the project gems also be compiled if compile_ruby_files = true |
63
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 |
64
65
  | jar_name | &lt; Name of project dir &gt;.jar | The name of the generated jar file |
@@ -275,6 +275,11 @@ module Jarbler
275
275
  ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}gems#{File::SEPARATOR}/) } # Exclude ./gems/* directories from compiling
276
276
  end
277
277
 
278
+ # Exclude named files or directories from compiling
279
+ config.excludes_from_compile.each do |exclude|
280
+ ruby_files = ruby_files.select { |f| !(f =~ /\.#{File::SEPARATOR}app_root#{File::SEPARATOR}#{exclude}/) }
281
+ end
282
+
278
283
  ruby_files.each do |ruby_file|
279
284
  debug "Compile Ruby file #{ruby_file}"
280
285
  full_file_name = File.join(Dir.pwd, ruby_file) # full name including path is required by the JRuby compiler
@@ -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
6
+ attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :include_gems_to_compile, :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
@@ -29,6 +29,7 @@ module Jarbler
29
29
  def initialize
30
30
  @compile_ruby_files = false
31
31
  @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
32
+ @excludes_from_compile = %w(config)
32
33
  @executable = 'bin/rails'
33
34
  @executable_params = %w(server -e production -p 8080)
34
35
  @include_gems_to_compile = false
@@ -72,6 +73,9 @@ module Jarbler
72
73
  # Compile also the .rb files of the gems of the project to Java .class files?
73
74
  # config.include_gems_to_compile = #{include_gems_to_compile}
74
75
 
76
+ # Directories or files to exclude from the compilation if compile_ruby_files = true
77
+ # config.excludes_from_compile = #{excludes_from_compile}
78
+
75
79
  ".split("\n"))
76
80
  end
77
81
 
@@ -137,6 +141,7 @@ module Jarbler
137
141
  raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
138
142
  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')
139
143
  raise "include_gems_to_compile = true is supported only if compile_ruby_files = true!" if include_gems_to_compile && !compile_ruby_files
144
+ raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array)
140
145
  end
141
146
  end
142
147
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  VERSION_DATE = "2024-06-13"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ramm