jarbler 0.1.2 → 0.1.4

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: ff7c6489ae577a03079ca5976e6f8ea2c311593aa2754590b83e37a446f68bc9
4
- data.tar.gz: 840b7720151675d538e08473857d7fae6a4342f478cf84473ffc231f2414fc46
3
+ metadata.gz: 69c4dfd51fa32af943ab9ada29536253dc516150cdff7e82e1944216098a92c8
4
+ data.tar.gz: 63e6752eba98d7cc27642fcbb13a199fc41867a6d044edf28051f025d292ef09
5
5
  SHA512:
6
- metadata.gz: 444d52de14b8316967b5184c9e814e40d52bcb780d84ef74dc148befea457232182bf83b01ec8c64540959af7d2522d2e20417ed9589771e8cd63779ffd60266
7
- data.tar.gz: 991f7a004c5383846504ff98c7b0c0cb508e50530d64887e4418dd7b9ec2e788764303fa7358eb43d8d66ec3143118da038ee8cf8b03e5743dbc7b83175ff87b
6
+ metadata.gz: 882f6b8e791b8f7fc9cc4eff3d86867c2667f8d817fd4c46a1f10103bcf98e50aee1e98c10b49fe14ae5e4f5a63a992ff9bf9121d4a9459d87e20ca05560c42a
7
+ data.tar.gz: e8b9a10dbfacc4180710a62fe84cfa9595049d62cd6ff6625cf520d39d380357f13502f0e0f228057d85d226d4ef29fe255e5cc63cf011f5d00f92bc8c5d2c52
data/CHANGELOG.md CHANGED
@@ -12,3 +12,10 @@
12
12
 
13
13
  - extract valid Gem paths from Bundler instead of using the environment variable GEM_PATH
14
14
 
15
+ ## [0.1.3] - 2023-04-25
16
+
17
+ - Removed .jruby-version so that the jruby version is not fixed anymore
18
+
19
+ ## [0.1.4] - 2023-04-28
20
+
21
+ - Jarbler also supports Gemfile references to Gems with git dependencies now
data/Gemfile CHANGED
@@ -5,11 +5,14 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in jarbler.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ # gem "rake", "~> 13.0"
9
+ gem "rake"
10
+
11
+ group(:development) do
12
+ gem 'rdoc'
13
+ end
9
14
 
10
15
  group(:test) do
11
16
  gem 'minitest'
12
17
  gem 'minitest-reporters'
13
- # needed for minitests
14
- gem 'jruby-jars'
15
18
  end
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Jarbler
2
2
  Pack a Ruby application into an executable jar file.
3
3
 
4
- Jarbler allows you to create an self executing Java jar file containing your Ruby application.
4
+ Jarbler creates a self executing Java jar file containing a Ruby application and all its Gem dependencies.
5
5
 
6
6
  This tool is inspired by the widely used jRuby runner Warbler.
7
- In contrast to Warbler no Java servlet container is needed for execution.
8
- Instead the configured executable is executed using the jRuby runtime jars.
7
+ The configured Ruby program is directly executed inside the JVM using the jRuby runtime jars.
9
8
 
10
9
  ## Installation
11
10
 
@@ -28,6 +27,7 @@ To adjust Jarbler's configuration, modify the settings in config file ´config/j
28
27
  $ jarble config
29
28
 
30
29
  ### Preconditions
30
+ * Dependency handling should be based on Bundler (existence of Gemfile is required)
31
31
  * The Ruby app should be capable of running with jRuby
32
32
  * Gems with native extensions should not be used (e.g. sassc)
33
33
  * if needed for development or test such Gems with native extensions should be moved to the development and test group in the Gemfile.
@@ -43,7 +43,7 @@ Additional command line parameters are passed through to the executed Ruby app (
43
43
  ## Configuration
44
44
 
45
45
  The file config/jarble.rb contains the configuration for Jarbler.
46
- To create a template config file with information about the supported configuration options, execute:
46
+ To create a template config file with information about all the supported configuration options, execute:
47
47
 
48
48
  $ jarble config
49
49
 
@@ -55,6 +55,12 @@ The default executable parameters are "server -p 8080 -e production".
55
55
  * Set DEBUG=true in environment to get additional runtime information
56
56
  * The temporary folder with the extracted app and jRuby runtime files is not deleted after execution if DEBUG is set.
57
57
 
58
+ ### Possible error messages
59
+ * Gem::LoadError: You have already activated ..., but your Gemfile requires ... . Since ... is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports net-protocol as a default gem.
60
+ * Reason: Mismatch between the version of the local requested gem and the version of the default gem
61
+ * Solution: Update the default gems to the requested version
62
+
63
+
58
64
  ## Contributing
59
65
 
60
66
  Bug reports and pull requests are welcome on GitHub at https://github.com/rammpeter/jarbler. <br>
data/build_gem.sh CHANGED
@@ -1,4 +1,8 @@
1
- # Steps for creating gem
1
+ # Steps for creating gem in local environment
2
+
3
+ # remove existing gem file
4
+ rm -f jarbler-*.gem
5
+
2
6
  rake test
3
7
  if [ $? -ne 0 ]; then
4
8
  echo "Tests failed."
@@ -11,7 +15,7 @@ if [ $? -ne 0 ]; then
11
15
  exit 1
12
16
  fi
13
17
 
14
- gem install jarbler-0.1.0.gem
18
+ gem install `ls jarbler-*.gem`
15
19
  if [ $? -ne 0 ]; then
16
20
  echo "Gem install failed."
17
21
  exit 1
data/jarbler.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["Peter@ramm-oberhermsdorf.de"]
10
10
 
11
11
  spec.summary = "Pack a Ruby app into a Java jar file"
12
- spec.description = "Pack Ruby combined with jRuby runtime into a jar file to simply run the app on any Java platform by '> java -jar file.jar'"
12
+ spec.description = "Pack a Ruby app combined with jRuby runtime and all its Gem dependencies into a jar file to simply run the app on any Java platform by '> java -jar file.jar'"
13
13
  spec.homepage = "https://github.com/rammpeter/jarbler"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.6.0"
@@ -27,13 +27,16 @@ import java.util.Map;
27
27
  import java.util.HashMap;
28
28
  import java.lang.reflect.Field;
29
29
  import java.io.FileWriter;
30
+ import java.security.CodeSource;
31
+ import java.security.ProtectionDomain;
30
32
 
31
33
  class JarMain {
32
34
 
33
35
  // executed by java -jar <jar file name>
34
36
  // No arguments are passed
35
37
  public static void main(String[] args) {
36
- debug("Start java process in jar file");
38
+ debug("Start java process in jar file "+jar_file_name());
39
+ debug("JVM: "+System.getProperty("java.vm.vendor")+" "+System.getProperty("java.vm.name")+" "+System.getProperty("java.vm.version")+" "+System.getProperty("java.home"));
37
40
  if (args.length > 0) {
38
41
  debug("Java command line arguments are: ");
39
42
  for (String arg : args) {
@@ -225,4 +228,18 @@ class JarMain {
225
228
  fw.write("BUNDLE_WITHOUT: test:development\n");
226
229
  fw.close();
227
230
  }
231
+
232
+ private static String jar_file_name() {
233
+ String jarFileName = "";
234
+
235
+ try {
236
+ ProtectionDomain protectionDomain = JarMain.class.getProtectionDomain();
237
+ CodeSource codeSource = protectionDomain.getCodeSource();
238
+ URL location = codeSource.getLocation();
239
+ jarFileName = new File(location.toURI()).getName();
240
+ } catch (Exception e) {
241
+ e.printStackTrace();
242
+ }
243
+ return jarFileName;
244
+ }
228
245
  }
@@ -1,6 +1,9 @@
1
+ require 'rubygems'
2
+ require 'rubygems/dependency_installer'
1
3
  require 'bundler'
2
4
  require 'find'
3
5
  require 'fileutils'
6
+ require 'yaml'
4
7
 
5
8
  module Jarbler
6
9
  class Builder
@@ -8,18 +11,15 @@ module Jarbler
8
11
  # Should be executed in application directory of Rails/Ruby application
9
12
  # @return [void]
10
13
  def build_jar
11
- # create a temporary directory for staging
12
- staging_dir = Dir.mktmpdir
14
+ debug "Running with Ruby version '#{RUBY_VERSION}' on platform '#{RUBY_PLATFORM}'. Engine '#{RUBY_ENGINE}' version '#{RUBY_ENGINE_VERSION}'"
13
15
 
14
- jarbler_lib_dir = __dir__
16
+ @config = nil # Ensure config is read from file or default. Necessary for testing only because of caching
17
+ staging_dir = Dir.mktmpdir # create a temporary directory for staging
15
18
  app_root = Dir.pwd
16
19
  debug "Project dir: #{app_root}"
17
20
 
18
- # TODO: transform to internal bundler API call (check if jruby is installed + install if not)
19
- exec_command "gem install --no-doc jruby-jars -v #{config.jruby_version}" # Ensure that jruby-jars are installed in the requested version
20
- gem_search_locations = collect_gem_search_locations(app_root)
21
- ruby_version = copy_jruby_jars_to_staging(staging_dir, gem_search_locations) # Copy the jruby jars to the staging directory
22
- exec_command "javac -nowarn -Xlint:deprecation -source 8 -target 8 -d #{staging_dir} #{jarbler_lib_dir}/JarMain.java" # Compile the Java files
21
+ ruby_version = copy_jruby_jars_to_staging(staging_dir) # Copy the jruby jars to the staging directory
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
25
25
  FileUtils.mkdir_p("#{staging_dir}/app_root")
@@ -30,14 +30,8 @@ module Jarbler
30
30
  # Get the needed Gems
31
31
  raise "Gemfile.lock not found in #{app_root}" unless File.exist?("#{app_root}/Gemfile.lock")
32
32
 
33
- gem_target_location = "#{staging_dir}/gems/jruby/#{ruby_version}"
34
- FileUtils.mkdir_p("#{gem_target_location}/gems")
35
- FileUtils.mkdir_p("#{gem_target_location}/specifications")
36
-
37
- needed_gems = gem_dependencies # get the full names of the dependencies
38
- needed_gems.each do |gem_full_name|
39
- copy_gem_to_staging(gem_full_name, gem_target_location, gem_search_locations)
40
- end
33
+ # Copy the needed Gems to the staging directory
34
+ copy_needed_gems_to_staging(staging_dir, ruby_version)
41
35
 
42
36
  Dir.chdir(staging_dir) do
43
37
  # create the manifest file
@@ -74,70 +68,73 @@ module Jarbler
74
68
  file_utils_copy(config.jar_name, app_root)
75
69
  puts "Created jar file #{app_root}/#{config.jar_name}"
76
70
  end
77
-
71
+ rescue Exception => e
72
+ puts "Error: #{e.message}"
73
+ puts e.backtrace.join("\n")
74
+ raise
75
+ ensure
78
76
  # remove temporary directory staging_dir
79
- FileUtils.remove_entry staging_dir
80
-
77
+ if ENV['DEBUG']
78
+ puts "Temporary directory #{staging_dir} not removed because of debug mode"
79
+ else
80
+ FileUtils.remove_entry staging_dir if staging_dir
81
+ end
81
82
  end
82
83
 
83
84
  private
84
85
 
85
- # Find the locations where Gems are installed
86
- # @param [String] app_root Application root directory
87
- # @return [Array] Array of Gem locations
88
- def collect_gem_search_locations(app_root)
89
- # All active search locations for Gems
90
- Bundler.setup
91
- possible_gem_search_locations = Gem.paths.path
92
- debug "Possible Gem locations: #{possible_gem_search_locations}"
93
- gem_search_locations = []
94
- # Check where inside this location the gems may be installed
95
- possible_gem_search_locations.each do |gem_search_location|
96
- if File.exist?(gem_search_location) && File.directory?(gem_search_location)
97
- valid_gem_search_location = nil # No valid path found yet
98
- Find.find(gem_search_location) do |path|
99
- if File.directory?(path) && File.exist?("#{path}/specifications") && File.exist?("#{path}/gems")
100
- valid_gem_search_location = path # Found a valid path
101
- Find.prune # Do not search deeper
102
- end
103
- end
104
- if valid_gem_search_location
105
- gem_search_locations << valid_gem_search_location
106
- else
107
- debug "No valid gem location found in #{gem_search_location}"
108
- end
109
- else
110
- debug("Gem location #{gem_search_location} does not exist or is not a directory")
86
+
87
+ # Check if there is an additional local bundle path in .bundle/config
88
+ # @param rails_root [String] the rails root directory
89
+ # @return [String] the local bundle path or nil if not configured
90
+ def bundle_config_bundle_path(rails_root)
91
+ bundle_path = nil # default
92
+ if File.exist?("#{rails_root}/.bundle/config")
93
+ bundle_config = YAML.load_file("#{rails_root}/.bundle/config")
94
+ if bundle_config && bundle_config['BUNDLE_PATH']
95
+ bundle_path = "#{rails_root}/#{bundle_config['BUNDLE_PATH']}"
96
+ debug "Local Gem path configured in #{rails_root}/.bundle/config: #{bundle_path}"
111
97
  end
112
98
  end
113
- debug "Valid Gem locations: #{gem_search_locations}"
114
- gem_search_locations
99
+ bundle_path
115
100
  end
116
101
 
117
- # Copy the Gem elements to the staging directory
118
- # @param [String] gem_full_name Full name of the Gem including version and platform
119
- # @param [String] staging_dir Path to the staging directory
120
- # @param [Array] gem_search_locations Array of Gem locations
102
+ # Copy the needed Gems to the staging directory
103
+ # @param staging_dir [String] the staging directory
104
+ # @param ruby_version [String] the corresponding ruby version of the jruby jars version
121
105
  # @return [void]
122
- def copy_gem_to_staging(gem_full_name, gem_target_location, gem_search_locations)
123
- gem_search_locations.each do |gem_search_location|
124
- gem_dir = "#{gem_search_location}/gems/#{gem_full_name}"
125
- if File.exist?(gem_dir)
126
- file_utils_copy(gem_dir, "#{gem_target_location}/gems")
127
- file_utils_copy("#{gem_search_location}/specifications/#{gem_full_name}.gemspec", "#{gem_target_location}/specifications")
128
- return
106
+ def copy_needed_gems_to_staging(staging_dir, ruby_version)
107
+ gem_target_location = "#{staging_dir}/gems/jruby/#{ruby_version}"
108
+ FileUtils.mkdir_p("#{gem_target_location}/gems")
109
+ FileUtils.mkdir_p("#{gem_target_location}/specifications")
110
+ FileUtils.mkdir_p("#{gem_target_location}/bundler/gems")
111
+
112
+ needed_gems = gem_dependencies # get the full names of the dependencies
113
+ needed_gems.each do |needed_gem|
114
+ # Get the location of the needed gem
115
+ spec = Gem::Specification.find_by_name(needed_gem[:name], needed_gem[:version])
116
+ raise "Gem #{needed_gem[:full_name]} not found for copying" unless spec
117
+ debug "Found gem #{needed_gem[:full_name]} version #{needed_gem[:version]} in #{spec.gem_dir}"
118
+
119
+ # differentiate between Gems from git/bundler and Gems from rubygems
120
+ if spec.source.is_a?(Bundler::Source::Git)
121
+ # Copy the Gem from bundler/gems including the gemspec
122
+ file_utils_copy(spec.gem_dir, "#{gem_target_location}/bundler/gems")
123
+ else # Gem is from rubygems
124
+ # copy the Gem and gemspec separately
125
+ file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems")
126
+ file_utils_copy("#{spec.gem_dir}/../../specifications/#{needed_gem[:full_name]}.gemspec", "#{gem_target_location}/specifications")
129
127
  end
130
128
  end
131
- raise "Gem #{gem_name} (#{gem_version}) not found in any of the following locations:\n#{gem_search_locations.join("\n")}"
132
129
  end
133
130
 
134
131
  # Read the default/production dependencies from Gemfile.lock and Gemfile
135
- # @return [Array] Array with full names of dependencies
132
+ # @return [Array] Array with Hashes containing: name, version, full_name
136
133
  def gem_dependencies
137
134
  needed_gems = []
138
135
  lockfile_specs = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)).specs
139
136
 
140
- Bundler.setup # Load Gems specified in Gemfile
137
+ Bundler.setup # Load Gems specified in Gemfile, ensure that Gem path also includes the Gems loaded into bundler dir
141
138
  # filter Gems needed for production
142
139
  gemfile_specs = Bundler.definition.dependencies.select do |d|
143
140
  d.groups.include?(:default) || d.groups.include?(:production)
@@ -148,28 +145,30 @@ module Jarbler
148
145
  # find lockfile record for Gemfile spec
149
146
  lockfile_spec = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == gemfile_spec.name }
150
147
  if lockfile_spec
151
- needed_gems << lockfile_spec.full_name unless needed_gems.include?(lockfile_spec.full_name)
148
+ unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec.full_name)
149
+ needed_gems << { full_name: lockfile_spec.full_name, name: lockfile_spec.name, version: lockfile_spec.version }
150
+ end
152
151
  debug "Direct Gem dependency: #{lockfile_spec.full_name}"
153
152
  add_indirect_dependencies(lockfile_specs, lockfile_spec, needed_gems)
154
153
  else
155
154
  debug "Gem #{gemfile_spec.name} not found in Gemfile.lock"
156
155
  end
157
156
  end
158
- needed_gems.uniq.sort
157
+ needed_gems.uniq.sort{|a,b| a[:full_name] <=> b[:full_name]}
159
158
  end
160
159
 
161
160
  # recurively find all indirect dependencies
162
161
  # @param [Array] lockfile_specs Array of Bundler::LockfileParser::Spec objects
163
162
  # @param [Bundler::LockfileParser::Spec] lockfile_spec current lockfile spec to check for their dependencies
164
- # @param [Array] needed_gems Array with full names of already found dependencies, add findings here
163
+ # @param [Array] needed_gems Array with Hashes containing: name, version, full_name
165
164
  # @return [void]
166
165
  def add_indirect_dependencies(lockfile_specs, lockfile_spec, needed_gems)
167
166
  lockfile_spec.dependencies.each do |lockfile_spec_dep|
168
167
  lockfile_spec_found = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == lockfile_spec_dep.name }
169
168
  if lockfile_spec_found
170
169
  debug "Indirect Gem dependency from #{lockfile_spec.full_name}: #{lockfile_spec_found.full_name}"
171
- unless needed_gems.include?(lockfile_spec_found.full_name)
172
- needed_gems << lockfile_spec_found.full_name
170
+ unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec_found.full_name)
171
+ needed_gems << { full_name: lockfile_spec_found.full_name, name: lockfile_spec_found.name, version: lockfile_spec_found.version }
173
172
  add_indirect_dependencies(lockfile_specs, lockfile_spec_found, needed_gems)
174
173
  end
175
174
  else
@@ -177,12 +176,18 @@ module Jarbler
177
176
  end
178
177
  end
179
178
  end
179
+
180
+ # Output debug message if DEBUG environment variable is set
181
+ # @param [String] msg Message to output
182
+ # @return [void]
180
183
  def debug(msg)
181
184
  puts msg if ENV['DEBUG']
182
185
  end
183
186
 
187
+ # Get the config object
188
+ # @return [Config] the config object
184
189
  def config
185
- unless defined? @config
190
+ if !defined?(@config) || @config.nil?
186
191
  @config = Config.create
187
192
  debug("Config attributes:")
188
193
  @config.instance_variables.each do |var|
@@ -195,18 +200,21 @@ module Jarbler
195
200
 
196
201
  # Copy the jruby-jars to the staging directory
197
202
  # @param [String] staging_dir Path to the staging directory
198
- # @param [Array] gem_search_locations Array of Gem locations to look for jRuby jars
199
203
  # @return [String] the ruby version of the jRuby jars
200
- def copy_jruby_jars_to_staging(staging_dir, gem_search_locations)
201
- jruby_jars_location = nil
202
- gem_search_locations.each do |gem_search_location|
203
- gem_dir = "#{gem_search_location}/gems/jruby-jars-#{config.jruby_version}"
204
- if File.exist?(gem_dir)
205
- jruby_jars_location = gem_dir
206
- break
207
- end
208
- end
209
- raise "Could not determine location of jRuby jars for release '#{config.jruby_version}' in the following locations:\n#{gem_search_locations}" unless jruby_jars_location
204
+ def copy_jruby_jars_to_staging(staging_dir)
205
+
206
+ # Ensure that jruby-jars gem is installed, otherwise install it. Accepts also bundler path in .bundle/config
207
+ installer = Gem::DependencyInstaller.new
208
+ installed = installer.install('jruby-jars', config.jruby_version)
209
+ raise "jruby-jars gem not installed in version #{config.jruby_version}" if installed.empty?
210
+
211
+ jruby_jars_location = installed[0]&.full_gem_path
212
+ debug "jRuby jars installed at: #{jruby_jars_location}"
213
+
214
+ # Get the location of the jruby-jars gem
215
+ # spec = Gem::Specification.find_by_name('jruby-jars', config.jruby_version)
216
+ # jruby_jars_location = spec.gem_dir
217
+
210
218
  file_utils_copy("#{jruby_jars_location}/lib/jruby-core-#{config.jruby_version}-complete.jar", staging_dir)
211
219
  file_utils_copy("#{jruby_jars_location}/lib/jruby-stdlib-#{config.jruby_version}.jar", staging_dir)
212
220
 
@@ -219,7 +227,9 @@ module Jarbler
219
227
  ruby_version
220
228
  end
221
229
 
222
- # Execute the command and return the output
230
+ # Execute the command in OS and return the output
231
+ # @param [String] command Command to execute
232
+ # @return [String] the output of the command
223
233
  def exec_command(command)
224
234
  lines = `#{command}`
225
235
  raise "Command \"#{command}\"failed with return code #{$?} and output:\n#{lines}" unless $?.success?
@@ -228,6 +238,9 @@ module Jarbler
228
238
  end
229
239
 
230
240
  # Copy file or directory with error handling
241
+ # @param [String] source Path to the source file or directory
242
+ # @param [String] destination Path to the destination file or directory
243
+ # @return [void]
231
244
  def file_utils_copy(source, destination)
232
245
  if File.exist?(source) && File.directory?(source)
233
246
  FileUtils.cp_r(source, destination)
@@ -1,9 +1,12 @@
1
+ require 'rubygems'
2
+ require 'json'
3
+
1
4
  module Jarbler
2
5
  class Config
3
6
  attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params
4
7
 
5
8
  CONFIG_FILE = 'config/jarble.rb'
6
- # create instence of Config class with defaults or from config file
9
+ # create instance of Config class with defaults or from config file
7
10
  # Should be called from rails/ruby root directory
8
11
  def self.create
9
12
  if File.exist?(CONFIG_FILE)
@@ -90,12 +93,18 @@ module Jarbler
90
93
  else
91
94
  # no .ruby-version file, use jRuby version of the latest Gem
92
95
  # Fetch the gem specification from Rubygems.org
93
- command = "gem search --remote jruby-jars"
94
- lines = `#{command}`
95
- raise "Command \"#{command}\" failed with return code #{$?} and output:\n#{lines}" unless $?.success?
96
- jruby_jars_line = lines.match(/^jruby-jars \((.*)\)/)
97
- raise "No jruby-jars gem found in rubygems.org!" unless jruby_jars_line
98
- self.jruby_version = /\((.*?)\)/.match(jruby_jars_line.to_s)[1]
96
+ # search for the gem and get the JSON response
97
+ response = Gem::SpecFetcher.fetcher.search_for_dependency(Gem::Dependency.new('jruby-jars'))
98
+ # extract the versions from the response
99
+ self.jruby_version = response&.first&.first&.first&.version&.to_s
100
+ raise "Unable to determine the latest available version of jruby-jars gem!\Rsponse = #{response.inspect}" unless self.jruby_version
101
+
102
+ #command = "gem search --remote jruby-jars"
103
+ #lines = `#{command}`
104
+ #raise "Command \"#{command}\" failed with return code #{$?} and output:\n#{lines}" unless $?.success?
105
+ #jruby_jars_line = lines.match(/^jruby-jars \((.*)\)/)
106
+ #raise "No jruby-jars gem found in rubygems.org!" unless jruby_jars_line
107
+ #self.jruby_version = /\((.*?)\)/.match(jruby_jars_line.to_s)[1]
99
108
  debug "jRuby version from latest jruby-jars gem: #{jruby_version}"
100
109
  end
101
110
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.1.2"
5
- VERSION_DATE = "2023-04-24"
4
+ VERSION = "0.1.4"
5
+ VERSION_DATE = "2023-04-28"
6
6
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
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-04-24 00:00:00.000000000 Z
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Pack Ruby combined with jRuby runtime into a jar file to simply run the
14
- app on any Java platform by '> java -jar file.jar'
13
+ description: Pack a Ruby app combined with jRuby runtime and all its Gem dependencies
14
+ into a jar file to simply run the app on any Java platform by '> java -jar file.jar'
15
15
  email:
16
16
  - Peter@ramm-oberhermsdorf.de
17
17
  executables:
@@ -19,7 +19,6 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - ".ruby-version"
23
22
  - CHANGELOG.md
24
23
  - Gemfile
25
24
  - LICENSE
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-3.2.2