toys-core 0.11.3 → 0.11.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/toys/core.rb +1 -1
- data/lib/toys/utils/gems.rb +32 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387c4a7088a856603e671a0c6156982eaa5639a41d1168a7912892b6ca9ca822
|
4
|
+
data.tar.gz: f47e0683edea4d3fcfa848e0517299648c0d6a0564b7d9316405487ed2e6d4dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a9e2501458d1c8cebeafc044a6fe9f4de131c687df533e73a8567aa81afef2a5ed02fbb769e0da9ed7f4632c2c4f9046efec21281a3bc8c8072437d4ecb844
|
7
|
+
data.tar.gz: f9c22a3b8d531825353d9eebc70735b3bdfddfc8f22ce55bc8bf62685bbbf9443fbb6d875b7671d70f8ee2ca1eb0990238d2b35b92289b5c1c3b7e392bae9537
|
data/CHANGELOG.md
CHANGED
data/lib/toys/core.rb
CHANGED
data/lib/toys/utils/gems.rb
CHANGED
@@ -185,7 +185,8 @@ module Toys
|
|
185
185
|
if configure_gemfile(gemfile_path)
|
186
186
|
activate("bundler", "~> 2.1")
|
187
187
|
require "bundler"
|
188
|
-
|
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
|
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(
|
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.
|
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-
|
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.
|
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.
|
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.
|
91
|
+
rubygems_version: 3.1.4
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Framework for creating command line executables
|