toys-core 0.14.2 → 0.14.4

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: de679852961f700752c16ccbec8b08bf28390070ce6e7a29f6d34bf6dd9a1ba3
4
- data.tar.gz: b149a5af7458b8ef26bb2a12dcc3ede565af9450780e8de7d132576550c65217
3
+ metadata.gz: 98a66e07f9f052b2011ab3d960dd8b8bff11f3f03a3c6de67e0d14b1507421ee
4
+ data.tar.gz: c6712de855eb63cb80eba5b32c956590a2b50d2944079df0ad4e58c9c8e7c8c4
5
5
  SHA512:
6
- metadata.gz: f7dc86145d43b4c778da09c6f31195a89aa62eab6a2bb4ef2efe1100b18863b17854540f07711c255c9eb95f8f2232c53808bdef87e0237fd8ec541c0bbc79cd
7
- data.tar.gz: 50f4c29636dca1fe75c94a7d53dc23315ba6f49e5f7e1ac39e13cd4f0459fbdf57b3eccee159558476042f9a8aaa831f7bcf3c86bb2dd976b02f63e029fe67a8
6
+ metadata.gz: e6be869c95ca6a9c4a7451581b04a656fe8d11f4b10d7a9197c4719fda776720bc07124295683d21bf81a19a0d5a3366fb0b31f5ffd92dd6b518aab3a18cc6d8
7
+ data.tar.gz: 0f48bdb37ce11ee8f3ece13b7ba8e4f85633b566b68d2ba15cd18ef26ddcd9b0455b49e2f56bef7b0f240cfde4d5e461b81a05965ec77928cd4d09a974794c8d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ### v0.14.4 / 2023-01-23
4
+
5
+ * FIXED: Fixed missing require when "toys/utils/xdg" or "toys/utils/git_cache" is required without the rest of toys-core
6
+
7
+ ### v0.14.3 / 2022-12-29
8
+
9
+ * FIXED: Exit with a code -1 if a non-integer exit code is thrown
10
+ * FIXED: The sh command in the Exec utility returns -1 if the exit code cannot be determined
11
+ * FIXED: Update Bundler integration to support Bundler 2.4 and Ruby 3.2
12
+ * FIXED: Fix for installing bundler on older Rubies
13
+ * FIXED: Fixed XDG defaults on JRuby 9.4
14
+
3
15
  ### v0.14.2 / 2022-10-09
4
16
 
5
17
  * ADDED: The tool directive supports the delegate_relative argument, as a preferred alternative over alias_tool.
data/lib/toys/context.rb CHANGED
@@ -309,7 +309,7 @@ module Toys
309
309
  # @return [void]
310
310
  #
311
311
  def exit(code = 0)
312
- throw :result, code
312
+ Context.exit(code)
313
313
  end
314
314
 
315
315
  ##
@@ -321,6 +321,7 @@ module Toys
321
321
  # @return [void]
322
322
  #
323
323
  def self.exit(code = 0)
324
+ code = -1 unless code.is_a?(::Integer)
324
325
  throw :result, code
325
326
  end
326
327
 
data/lib/toys/core.rb CHANGED
@@ -9,7 +9,7 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.14.2"
12
+ VERSION = "0.14.4"
13
13
  end
14
14
 
15
15
  ##
@@ -427,7 +427,7 @@ module Toys
427
427
  #
428
428
  def sh(cmd, **opts, &block)
429
429
  opts = opts.merge(background: false)
430
- exec(cmd, **opts, &block).exit_code
430
+ exec(cmd, **opts, &block).exit_code || -1
431
431
  end
432
432
 
433
433
  ##
@@ -188,7 +188,7 @@ module Toys
188
188
  gemfile_path = ::File.absolute_path(gemfile_path)
189
189
  Gems.synchronize do
190
190
  if configure_gemfile(gemfile_path)
191
- activate("bundler", "~> 2.2")
191
+ activate("bundler", *bundler_version_requirements)
192
192
  require "bundler"
193
193
  setup_bundle(gemfile_path, groups: groups, retries: retries)
194
194
  end
@@ -309,7 +309,7 @@ module Toys
309
309
  modified_gemfile_path = create_modified_gemfile(gemfile_path)
310
310
  begin
311
311
  attempt_setup_bundle(modified_gemfile_path, groups)
312
- rescue ::Bundler::GemNotFound, ::Bundler::VersionConflict
312
+ rescue *bundler_exceptions
313
313
  ::Bundler.reset!
314
314
  restore_toys_libs
315
315
  install_bundle(modified_gemfile_path, retries: retries)
@@ -321,6 +321,25 @@ module Toys
321
321
  restore_toys_libs
322
322
  end
323
323
 
324
+ def bundler_exceptions
325
+ @bundler_exceptions ||= begin
326
+ exceptions = [::Bundler::GemNotFound]
327
+ exceptions << ::Bundler::VersionConflict if ::Bundler.const_defined?(:VersionConflict)
328
+ exceptions << ::Bundler::SolveFailure if ::Bundler.const_defined?(:SolveFailure)
329
+ exceptions
330
+ end
331
+ end
332
+
333
+ def bundler_version_requirements
334
+ if ::RUBY_VERSION < "2.6"
335
+ [">= 2.2", "< 2.4"]
336
+ elsif ::RUBY_VERSION < "3"
337
+ [">= 2.2", "< 2.5"]
338
+ else
339
+ ["~> 2.2"]
340
+ end
341
+ end
342
+
324
343
  def attempt_setup_bundle(modified_gemfile_path, groups)
325
344
  ::ENV["BUNDLE_GEMFILE"] = modified_gemfile_path
326
345
  ::Bundler.configure
@@ -3,6 +3,7 @@
3
3
  require "digest"
4
4
  require "fileutils"
5
5
  require "json"
6
+ require "toys/compat"
6
7
  require "toys/utils/exec"
7
8
  require "toys/utils/xdg"
8
9
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "toys/compat"
4
+
3
5
  module Toys
4
6
  module Utils
5
7
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toys-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-09 00:00:00.000000000 Z
11
+ date: 2023-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Toys-Core is the command line tool framework underlying Toys. It can
14
14
  be used to create command line executables using the Toys DSL and classes.
@@ -78,10 +78,10 @@ homepage: https://github.com/dazuma/toys
78
78
  licenses:
79
79
  - MIT
80
80
  metadata:
81
- changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.2/file.CHANGELOG.html
81
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.4/file.CHANGELOG.html
82
82
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys-core
83
83
  bug_tracker_uri: https://github.com/dazuma/toys/issues
84
- documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.2
84
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.4
85
85
  post_install_message:
86
86
  rdoc_options: []
87
87
  require_paths: