toys-core 0.13.0 → 0.13.1

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: 68a552244c25e03216c7bf958a7ccd2a35bb7fb3795a02e77c4a839b7720e258
4
- data.tar.gz: 58513ce7d5d60646a1b9e51235d04df470ee5d9317a9a72048a8e95872227da0
3
+ metadata.gz: 7d34e973aef54758dbd85e689d69bd68660024a41e344c40bdc64b84459e5b31
4
+ data.tar.gz: 1c488073e098663bf9b2e6b9434c8c1932eeb66411855a4810cb57eca4ea1445
5
5
  SHA512:
6
- metadata.gz: 299c193de07d0802046029c7b305a1e4cecac715eee32d259a917b6ecc2505975ba10a2aca90b510036076d9f32b58849a02381ae61837336eee5361cd2126ea
7
- data.tar.gz: b42a4d81db4a71a136deafd4a62f0e7087325097a1c3e7473a5b7edda699b08ee1c8d81377765a70d8a18fd0a2693874781418f9953ca52f92cced670bec1421
6
+ metadata.gz: '09e199be2b41bc50a6a8e2d8a03f91be92c2f04f022abc5a6a64f4077f745a445777369e4a20787a4754fe8b709e5cfde138e65eee84ec3f4f6d21ca089072fc'
7
+ data.tar.gz: b874efa699f0c7d76ffaa6848fb30668d830b9a1b8a342fed13283586829069cefdbe7a379a90749c365c510affa06394d82d21e601c3b6bd868f001f4287350
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ### v0.13.1 / 2022-03-01
4
+
5
+ * FIXED: Toys::Utils::Gems no longer fails to install a bundle if it had locked to a different version of a builtin gem
6
+
3
7
  ### v0.13.0 / 2022-02-08
4
8
 
5
9
  Toys-Core 0.13.0 is a major release with significant improvements to the git cache, along with compatibility improvements and bug fixes.
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.13.0"
12
+ VERSION = "0.13.1"
13
13
  end
14
14
 
15
15
  ##
@@ -372,16 +372,24 @@ module Toys
372
372
  end
373
373
 
374
374
  def modified_gemfile_content(gemfile_path)
375
- is_running_toys = ::Toys.const_defined?(:VERSION)
376
375
  content = [::File.read(gemfile_path)]
377
- content << "has_toys_dep = dependencies.any? { |dep| dep.name == 'toys' }" unless is_running_toys
378
- content << "dependencies.delete_if { |dep| dep.name == 'toys-core' || dep.name == 'toys' }"
379
- repo_root = ::File.dirname(::File.dirname(::Toys::CORE_LIB_PATH)) if ::ENV["TOYS_DEV"]
380
- path = repo_root ? ::File.join(repo_root, "toys-core") : nil
381
- content << "gem 'toys-core', #{::Toys::Core::VERSION.inspect}, path: #{path.inspect}"
382
- path = repo_root ? ::File.join(repo_root, "toys") : nil
383
- guard = is_running_toys ? "" : " if has_toys_dep"
384
- content << "gem 'toys', #{::Toys::Core::VERSION.inspect}, path: #{path.inspect}#{guard}"
376
+
377
+ custom_paths = {}
378
+ if ::ENV["TOYS_DEV"]
379
+ repo_root = ::File.dirname(::File.dirname(::Toys::CORE_LIB_PATH))
380
+ custom_paths["toys-core"] = ::File.join(repo_root, "toys-core")
381
+ custom_paths["toys"] = ::File.join(repo_root, "toys")
382
+ end
383
+
384
+ loaded_gems = ::Gem.loaded_specs.values.sort_by(&:name)
385
+ content << "toys_loaded_gems = #{loaded_gems.map(&:name).inspect}"
386
+ content << "dependencies.delete_if { |dep| toys_loaded_gems.include?(dep.name) }"
387
+ loaded_gems.each do |spec|
388
+ path = custom_paths[spec.name]
389
+ path_suffix = path ? ", path: '#{path}'" : ""
390
+ content << "gem '#{spec.name}', '= #{spec.version}'#{path_suffix}"
391
+ end
392
+
385
393
  content
386
394
  end
387
395
 
@@ -422,13 +430,16 @@ module Toys
422
430
  args << "--retry=#{retries}" if retries.positive?
423
431
  bundler_bin = ::Gem.bin_path("bundler", "bundle", ::Bundler::VERSION)
424
432
  result = exec_util.exec_ruby([bundler_bin, "install"] + args)
425
- if result.error?
426
- terminal.puts("Failed to install. Trying update...")
427
- result = exec_util.exec_ruby([bundler_bin, "update"] + args)
428
- unless result.success?
429
- raise ::Bundler::InstallError, "Failed to install or update bundle: #{gemfile_path}"
430
- end
431
- end
433
+ return if result.success?
434
+ terminal.puts("Failed to install. Trying update...")
435
+ result = exec_util.exec_ruby([bundler_bin, "update"] + args)
436
+ return if result.success?
437
+ terminal.puts("Failed to update. Trying update with clean lockfile...")
438
+ lockfile_path = find_lockfile_path(gemfile_path)
439
+ ::File.delete(lockfile_path) if ::File.exist?(lockfile_path)
440
+ result = exec_util.exec_ruby([bundler_bin, "update"] + args)
441
+ return if result.success?
442
+ raise ::Bundler::InstallError, "Failed to install or update bundle: #{gemfile_path}"
432
443
  end
433
444
  end
434
445
  end
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.13.0
4
+ version: 0.13.1
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-02-08 00:00:00.000000000 Z
11
+ date: 2022-03-01 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.
@@ -76,10 +76,10 @@ homepage: https://github.com/dazuma/toys
76
76
  licenses:
77
77
  - MIT
78
78
  metadata:
79
- changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.13.0/file.CHANGELOG.html
79
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.13.1/file.CHANGELOG.html
80
80
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys-core
81
81
  bug_tracker_uri: https://github.com/dazuma/toys/issues
82
- documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.13.0
82
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.13.1
83
83
  post_install_message:
84
84
  rdoc_options: []
85
85
  require_paths: