jarbler 0.2.1 → 0.2.3

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: 97f5261d55e15e23454414413af5f467bfdf5c2554916574269d6fa99f4a411a
4
- data.tar.gz: 5a77de393585a7fa444157ebc2e7835d6d39e2e0e004ade0f840d9f2f9abcff9
3
+ metadata.gz: bba70c5fbf20494c82fc683d2e4ad8c39952000e8a525c7070f142219f7c38bd
4
+ data.tar.gz: '085db112eb0163afbad08545074af2a3994ec6cc498f56b6da16910833c2fe62'
5
5
  SHA512:
6
- metadata.gz: ad30f274db2a26f844df82f295b95f9bdcd9a023f35bbc83a6d2b7ec44b77a4dd0b8ca5ca66bb3f46818acf927d2e72efefb0f8b2669b058f5f51b9dacdb6d49
7
- data.tar.gz: e07c531aa6082b3d186d2d3687d6a784b9b07593f4145e4d51bdd28247f57c710a35ed15196c18a0d3cb5a9f503808b242833709780b71442e0f293de1fe0db4
6
+ metadata.gz: 3a18adb5dfd17593a8c9fa8fb0c997b1e65544705a1074f39984923c6bfd9d82eb938c30b32b09339d349a17cb2e591ed817812060228bb94ecdb6e8cc890e2f
7
+ data.tar.gz: 36b98d4f3293ffcc11bbec6ef8e53f57a934d7885d30be43c6ed4c0dbcf3c54802d606d6a5d11292c37a4e1681077a92ecc7f9d23a49008ada7b95c1b0634d17
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.3] - 2024-06-13
4
+
5
+ - Show used configuration values in log output
6
+
7
+ ## [0.2.2] - 2024-06-13
8
+
9
+ - Exclude certain dirs or files from compilation with 'excludes_from_compile' option in config file
10
+
3
11
  ## [0.2.1] - 2024-06-13
4
12
 
5
13
  - 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
@@ -23,12 +23,31 @@ 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 " include_gems_to_compile: #{config.include_gems_to_compile}" if config.include_gems_to_compile
40
+ puts " includes: #{config.includes}" unless config.includes.empty?
41
+ puts " jar_name: #{config.jar_name}"
42
+ puts " jruby_version: #{config.jruby_version}"
43
+ puts ""
26
44
  config
27
45
  end
28
46
 
29
47
  def initialize
30
48
  @compile_ruby_files = false
31
49
  @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
50
+ @excludes_from_compile = %w(config)
32
51
  @executable = 'bin/rails'
33
52
  @executable_params = %w(server -e production -p 8080)
34
53
  @include_gems_to_compile = false
@@ -72,6 +91,9 @@ module Jarbler
72
91
  # Compile also the .rb files of the gems of the project to Java .class files?
73
92
  # config.include_gems_to_compile = #{include_gems_to_compile}
74
93
 
94
+ # Directories or files to exclude from the compilation if compile_ruby_files = true
95
+ # config.excludes_from_compile = #{excludes_from_compile}
96
+
75
97
  ".split("\n"))
76
98
  end
77
99
 
@@ -137,6 +159,7 @@ module Jarbler
137
159
  raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files)
138
160
  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
161
  raise "include_gems_to_compile = true is supported only if compile_ruby_files = true!" if include_gems_to_compile && !compile_ruby_files
162
+ raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array)
140
163
  end
141
164
  end
142
165
  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.3"
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ramm