toys-core 0.11.3 → 0.11.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: 2345d22178ad2ca256a6099f3b359abaf6641248c3a29256000e40204c618802
4
- data.tar.gz: e9874795dd5057d7eca70164f221ec923c0ac17862146f1a9f15cba3c1cfc4e8
3
+ metadata.gz: 387c4a7088a856603e671a0c6156982eaa5639a41d1168a7912892b6ca9ca822
4
+ data.tar.gz: f47e0683edea4d3fcfa848e0517299648c0d6a0564b7d9316405487ed2e6d4dd
5
5
  SHA512:
6
- metadata.gz: 852717f2545a44143185d168c374d871ba9495ccece98161b880d8fdf75b0f5929a97998f3d193c700963717c406567f3f365d73f9c6ad5af13270317b2a5a74
7
- data.tar.gz: 3c2bb70a9512f058a9ead3feb55c4c658f7ac3357c51f39c47cb9bef081c1c5f876d08f8f45a2d0d716e6a884d22b156c64664177306041e85e411a18075ebd0
6
+ metadata.gz: f1a9e2501458d1c8cebeafc044a6fe9f4de131c687df533e73a8567aa81afef2a5ed02fbb769e0da9ed7f4632c2c4f9046efec21281a3bc8c8072437d4ecb844
7
+ data.tar.gz: f9c22a3b8d531825353d9eebc70735b3bdfddfc8f22ce55bc8bf62685bbbf9443fbb6d875b7671d70f8ee2ca1eb0990238d2b35b92289b5c1c3b7e392bae9537
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ### v0.11.4 / 2020-10-11
4
+
5
+ * FIXED: Doesn't modify bundler lockfiles when adding Toys to a bundle
6
+
3
7
  ### v0.11.3 / 2020-09-13
4
8
 
5
9
  * FIXED: The Exec library recognizes the argv0 option, and logs it appropriately
@@ -9,7 +9,7 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.11.3"
12
+ VERSION = "0.11.4"
13
13
  end
14
14
 
15
15
  ## @private deprecated
@@ -185,7 +185,8 @@ module Toys
185
185
  if configure_gemfile(gemfile_path)
186
186
  activate("bundler", "~> 2.1")
187
187
  require "bundler"
188
- setup_bundle(gemfile_path, groups || [])
188
+ lockfile_path = find_lockfile_path(gemfile_path)
189
+ setup_bundle(gemfile_path, lockfile_path, groups || [])
189
190
  end
190
191
  end
191
192
  end
@@ -287,21 +288,46 @@ module Toys
287
288
  true
288
289
  end
289
290
 
290
- def setup_bundle(gemfile_path, groups)
291
+ def find_lockfile_path(gemfile_path)
292
+ if ::File.basename(gemfile_path) == "gems.rb"
293
+ ::File.join(::File.dirname(gemfile_path), "gems.locked")
294
+ else
295
+ gemfile_path + ".lock"
296
+ end
297
+ end
298
+
299
+ def setup_bundle(gemfile_path, lockfile_path, groups)
300
+ old_lockfile_contents = save_old_lockfile(lockfile_path)
291
301
  begin
292
- modify_bundle_definition(gemfile_path)
302
+ modify_bundle_definition(gemfile_path, lockfile_path)
293
303
  ::Bundler.ui.silence { ::Bundler.setup(*groups) }
294
304
  rescue ::Bundler::GemNotFound, ::Bundler::VersionConflict
295
305
  restore_toys_libs
296
306
  install_bundle(gemfile_path)
307
+ old_lockfile_contents = save_old_lockfile(lockfile_path)
297
308
  ::Bundler.reset!
298
- modify_bundle_definition(gemfile_path)
309
+ modify_bundle_definition(gemfile_path, lockfile_path)
299
310
  ::Bundler.ui.silence { ::Bundler.setup(*groups) }
300
311
  end
301
312
  restore_toys_libs
313
+ ensure
314
+ restore_old_lockfile(lockfile_path, old_lockfile_contents)
315
+ end
316
+
317
+ def save_old_lockfile(lockfile_path)
318
+ return nil unless ::File.readable?(lockfile_path) && ::File.writable?(lockfile_path)
319
+ ::File.read(lockfile_path)
320
+ end
321
+
322
+ def restore_old_lockfile(lockfile_path, contents)
323
+ if contents
324
+ ::File.open(lockfile_path, "w") do |file|
325
+ file.write(contents)
326
+ end
327
+ end
302
328
  end
303
329
 
304
- def modify_bundle_definition(gemfile_path)
330
+ def modify_bundle_definition(gemfile_path, lockfile_path)
305
331
  builder = ::Bundler::Dsl.new
306
332
  builder.eval_gemfile(gemfile_path)
307
333
  toys_gems = ["toys-core"]
@@ -312,7 +338,7 @@ module Toys
312
338
  add_gem_to_definition(builder, "toys")
313
339
  toys_gems << "toys"
314
340
  end
315
- definition = builder.to_definition(gemfile_path + ".lock", { gems: toys_gems })
341
+ definition = builder.to_definition(lockfile_path, { gems: toys_gems })
316
342
  ::Bundler.instance_variable_set(:@definition, definition)
317
343
  end
318
344
 
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.11.3
4
+ version: 0.11.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: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-10-11 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.
@@ -69,10 +69,10 @@ homepage: https://github.com/dazuma/toys
69
69
  licenses:
70
70
  - MIT
71
71
  metadata:
72
- changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.3/file.CHANGELOG.html
72
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.4/file.CHANGELOG.html
73
73
  source_code_uri: https://github.com/dazuma/toys
74
74
  bug_tracker_uri: https://github.com/dazuma/toys/issues
75
- documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.3
75
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.4
76
76
  post_install_message:
77
77
  rdoc_options: []
78
78
  require_paths:
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.1.2
91
+ rubygems_version: 3.1.4
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Framework for creating command line executables