toys-core 0.11.1 → 0.11.2

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: 1f26779ccf17122c41c4c52f5d16ca9630e9936e8251e9fb8ee94e2f35902ed5
4
- data.tar.gz: 9f192532b5a5e384662881ce422422d81275ae5993721d98c8aec3a77df05bae
3
+ metadata.gz: 37117af06be544465a07f95706310e3b8de1ad4dbc58f53e113b2595eed70e47
4
+ data.tar.gz: 6e27a716c74435ff2060838dbde56af35b4df93dcdc671051397755f478cc233
5
5
  SHA512:
6
- metadata.gz: 0a265cf80f60bfe2d6cebb4ba9a3674aa7060a47187b77c5d8e879cde28480d7e09dc4dc365944e6fcba09ddb817553a4ce2e0f9db3ecab93d1e06316ba5fb6e
7
- data.tar.gz: 151b37988b3dc14a06e2ee4cf85c941dcb46b345d44d66940a307d9968eccb6ca5d52eb386eaa87a07582968e9e5693b8c89149d314e2f620022a1f1bf6226fc
6
+ metadata.gz: a9dc2dc2e8287fbdb1c7695ed9111360d7bfcfc17167c6b790b170843988acb198daa8d99050d910ee5ea41876b2bb6c2e22cbab9629e322c9e7687f90a34c99
7
+ data.tar.gz: '03283300b1140b477ae56276a066953eb4fc6c71aa2a14b2e0fbe66cc9934c3afbd30862349ee922d98c4e0b9e80e74e50ba180bddc939dec99ead630eb7ddf2'
@@ -1,10 +1,14 @@
1
1
  # Release History
2
2
 
3
- ### 0.11.1 / 2020-08-24
3
+ ### v0.11.2 / 2020-09-06
4
+
5
+ * FIXED: Fix a JRuby-specific race condition when capturing exec streams
6
+
7
+ ### v0.11.1 / 2020-08-24
4
8
 
5
9
  * DOCS: Minor documentation tweaks.
6
10
 
7
- ### 0.11.0 / 2020-08-21
11
+ ### v0.11.0 / 2020-08-21
8
12
 
9
13
  * ADDED: The load path can be truncated using the `truncate_load_path!` directive.
10
14
  * IMPROVED: Generated help for delegates now includes the information for the target tool, plus subtools of the delegate.
@@ -14,7 +18,7 @@
14
18
  * FIXED: Exec::Result correctly reports processes that terminated due to signals.
15
19
  * FIXED: Fixed a rare Exec capture failure that resulted from a race condition when closing streams.
16
20
 
17
- ### 0.10.5 / 2020-07-18
21
+ ### v0.10.5 / 2020-07-18
18
22
 
19
23
  * IMPROVED: The bundler mixin silences bundler output during bundle setup.
20
24
  * IMPROVED: The bundler mixin allows toys and toys-core to be in the Gemfile. It checks their version requirements against the running Toys version, and either adds the corret version to the bundle or raises IncompatibleToysError.
@@ -22,24 +26,24 @@
22
26
  * FIXED: Some cases of transitive dependency handling by the bundler mixin.
23
27
  * FIXED: Fixed a crash when computing suggestions, when running with a bundle on Ruby 2.6 or earlier.
24
28
 
25
- ### 0.10.4 / 2020-07-11
29
+ ### v0.10.4 / 2020-07-11
26
30
 
27
31
  * IMPROVED: Bundler integration can now handle Toys itself being in the bundle, as long as the version requirements cover the running Toys version.
28
32
  * IMPROVED: Passing `static: true` to the `:bundler` mixin installs the bundle at definition rather than execution time.
29
33
 
30
- ### 0.10.3 / 2020-07-04
34
+ ### v0.10.3 / 2020-07-04
31
35
 
32
36
  * FIXED: The `exec_separate_tool` method in the `:exec` mixin no longer throws ENOEXEC on Windows.
33
37
 
34
- ### 0.10.2 / 2020-07-03
38
+ ### v0.10.2 / 2020-07-03
35
39
 
36
40
  * FIXED: The load path no longer loses the toys and toys-core directories after a bundle install.
37
41
 
38
- ### 0.10.1 / 2020-03-07
42
+ ### v0.10.1 / 2020-03-07
39
43
 
40
44
  * FIXED: Setting `:exit_on_nonzero_status` explicitly to false now works as expected.
41
45
 
42
- ### 0.10.0 / 2020-02-24
46
+ ### v0.10.0 / 2020-02-24
43
47
 
44
48
  Functional changes:
45
49
 
@@ -69,16 +73,16 @@ Internal interface changes:
69
73
  * CHANGED: `Toys::CLI.default_logger` removed and replaced with `Toys::CLI.default_logger_factory`. In general, global loggers for CLI are now discouraged because they are not thread-safe.
70
74
  * CHANGED: `Toys::Loader` uses an internal monitor rather than including `MonitorMixin`.
71
75
 
72
- ### 0.9.4 / 2020-01-26
76
+ ### v0.9.4 / 2020-01-26
73
77
 
74
78
  * FIXED: Crash in the loader when a non-ruby file appears in a toys directory
75
79
 
76
- ### 0.9.3 / 2020-01-05
80
+ ### v0.9.3 / 2020-01-05
77
81
 
78
82
  * FIXED: `delegate_to` directive could crash if an overriding tool has already been defined.
79
83
  * FIXED: A Ruby 2.7 warning when reporting a Toys file syntax error.
80
84
 
81
- ### 0.9.2 / 2020-01-03
85
+ ### v0.9.2 / 2020-01-03
82
86
 
83
87
  * IMPROVED: Mixins can now take real keyword arguments, and will pass them on properly to `on_initialize` and `on_include` blocks.
84
88
  * CHANGED: `Toys::Utils::Exec` and the `:exec` mixin methods now take real keyword arguments rather than an `opts` hash. This means you should use keywords (or the double-splat operator) to avoid a deprecation warning on Ruby 2.7.
@@ -86,11 +90,11 @@ Internal interface changes:
86
90
  * IMPROVED: `Toys::Loader` is now thread-safe. This means it is now possible for a single `Toys::CLI` to run multiple tools in different threads.
87
91
  * IMPROVED: There is now a class for middleware specs, making possible a nicer syntax for building a middleware stack.
88
92
 
89
- ### 0.9.1 / 2019-12-22
93
+ ### v0.9.1 / 2019-12-22
90
94
 
91
95
  * IMPROVED: `delegate_to` and `alias_tool` can take symbols as well as strings.
92
96
 
93
- ### 0.9.0 / 2019-12-02
97
+ ### v0.9.0 / 2019-12-02
94
98
 
95
99
  Functional changes:
96
100
 
@@ -113,12 +117,12 @@ Internal interface changes:
113
117
  * ADDED: `Toys::Tool#delegate_to` causes the tool to delegate to another tool.
114
118
  * ADDED: The `Toys::Context::Key::DELEGATED_FROM` key provides the delegating context, if any.
115
119
 
116
- ### 0.8.1 / 2019-11-19
120
+ ### v0.8.1 / 2019-11-19
117
121
 
118
122
  * FIXED: Listing subtools would crash if a broken alias was present.
119
123
  * DOCUMENTATION: Switched from redcarpet to kramdown, and tried to make some structural fixes.
120
124
 
121
- ### 0.8.0 / 2019-06-20
125
+ ### v0.8.0 / 2019-06-20
122
126
 
123
127
  This is a major update with significant new features and a bunch of fixes. It also includes a significant amount of internal reorganization and cleanup, some of which resulted in backward incompatible changes. Basic use should not be affected. All signifiant features planned for beta are now implemented.
124
128
 
@@ -217,17 +221,17 @@ Changes to internal interfaces:
217
221
  * ADDED: Range acceptor (`Acceptor::Range`) which validates against a range.
218
222
  * ADDED: Class methods `Acceptor.create` and `Acceptor.lookup_well_known`.
219
223
 
220
- ### 0.7.0 / 2019-01-23
224
+ ### v0.7.0 / 2019-01-23
221
225
 
222
226
  * ADDED: Flag groups, which enforce policies around which flags are required.
223
227
  * CHANGED: Flags within a group are sorted in help screens.
224
228
  * CHANGED: Canonical flag within a flag definition is now the first rather than the last.
225
229
 
226
- ### 0.6.1 / 2019-01-07
230
+ ### v0.6.1 / 2019-01-07
227
231
 
228
232
  * FIXED: The presence of aliases caused subtool listing to crash.
229
233
 
230
- ### 0.6.0 / 2018-10-22
234
+ ### v0.6.0 / 2018-10-22
231
235
 
232
236
  * CHANGED: Replaced Toys::Definition::DataFinder with Toys::Definition::SourceInfo.
233
237
  * CHANGED: Removed Toys::Definition#find_data. Use Toys::Definition#source_info and call find_data.
@@ -236,7 +240,7 @@ Changes to internal interfaces:
236
240
  from subtool lists.
237
241
  * IMPROVED: Optionally omit non-runnable namespaces from recursive subtool lists.
238
242
 
239
- ### 0.5.0 / 2018-10-07
243
+ ### v0.5.0 / 2018-10-07
240
244
 
241
245
  * FIXED: Template instantiation was failing if the hosting tool was priority-masked.
242
246
  * ADDED: Several additional characters can optionally be used as tool path delimiters.
@@ -246,31 +250,31 @@ Changes to internal interfaces:
246
250
  * IMPROVED: The tool directive can now take an array as the tool name.
247
251
  * IMPROVED: The tool directive can now take an `if_defined` argument.
248
252
 
249
- ### 0.4.5 / 2018-08-05
253
+ ### v0.4.5 / 2018-08-05
250
254
 
251
255
  * CHANGED: Dropped preload file feature
252
256
 
253
- ### 0.4.4 / 2018-07-21
257
+ ### v0.4.4 / 2018-07-21
254
258
 
255
259
  * FIXED: Utils::Exec wasn't closing streams after copying.
256
260
  * IMPROVED: Utils::Exec::Controller can capture or redirect the remainder of a controlled stream.
257
261
  * ADDED: Terminal#ask
258
262
 
259
- ### 0.4.3 / 2018-07-13
263
+ ### v0.4.3 / 2018-07-13
260
264
 
261
265
  * IMPROVED: Utils::Exec methods can now spawn subprocesses in the background
262
266
  * IMPROVED: Utils::Exec capture methods can now yield a controller
263
267
 
264
- ### 0.4.2 / 2018-07-08
268
+ ### v0.4.2 / 2018-07-08
265
269
 
266
270
  * FIXED: Raise an error rather than cause unexpected behavior if a mixin is included twice.
267
271
  * IMPROVED: The `include?` method extended to support mixin names in a tool dsl.
268
272
 
269
- ### 0.4.1 / 2018-07-03
273
+ ### v0.4.1 / 2018-07-03
270
274
 
271
275
  * FIXED: Terminal#confirm uppercased "N" for the wrong default.
272
276
 
273
- ### 0.4.0 / 2018-07-03
277
+ ### v0.4.0 / 2018-07-03
274
278
 
275
279
  Now declaring this alpha quality. Backward-incompatible changes are still
276
280
  possible from this point, but I'll try to avoid them.
@@ -282,13 +286,13 @@ possible from this point, but I'll try to avoid them.
282
286
  * IMPROVED: Utils::Gems installation is now much faster.
283
287
  * FIXED: Utils::Gems didn't reset the specifications on Ruby 2.3.
284
288
 
285
- ### 0.3.11 / 2018-07-02
289
+ ### v0.3.11 / 2018-07-02
286
290
 
287
291
  * CHANGED: Require Ruby 2.3 or later
288
292
  * CHANGED: Renamed "set" directive to "static" to reduce confusion with Tool#set.
289
293
  * ADDED: Convenience methods for getting option values
290
294
 
291
- ### 0.3.10 / 2018-06-30
295
+ ### v0.3.10 / 2018-06-30
292
296
 
293
297
  * CHANGED: Dropped Tool#option. Use Tool#get instead.
294
298
  * CHANGED: "run" directive renamed to "to_run"
@@ -297,11 +301,11 @@ possible from this point, but I'll try to avoid them.
297
301
  * ADDED: Mixins can provide initializers
298
302
  * ADDED: Loader can load an inline block
299
303
 
300
- ### 0.3.9.1 / 2018-06-24
304
+ ### v0.3.9.1 / 2018-06-24
301
305
 
302
306
  * FIXED: Built-in flags were interfering with disable_argument_parsing
303
307
 
304
- ### 0.3.9 / 2018-06-24
308
+ ### v0.3.9 / 2018-06-24
305
309
 
306
310
  * CHANGED: Cli#add_search_path_hierarchy changed the behavior of the base/terminate param
307
311
  * CHANGED: Removed alias_as directive since it's incompatible with selective loading.
@@ -310,7 +314,7 @@ possible from this point, but I'll try to avoid them.
310
314
  * ADDED: Exec#exec_proc and Exec#exec_tool that supports all the stream redirects
311
315
  * IMPROVED: Acceptors can be looked up recursively in the same way as mixins and templates
312
316
 
313
- ### 0.3.8 / 2018-06-10
317
+ ### v0.3.8 / 2018-06-10
314
318
 
315
319
  * CHANGED: Renamed helpers to mixins.
316
320
  * CHANGED: ModuleLookup is now a customizable class and can have multiple sources.
@@ -320,11 +324,11 @@ possible from this point, but I'll try to avoid them.
320
324
  * IMPROVED: Exec raises an error if passed an unknown option.
321
325
  * IMPROVED: Exec now accepts nearly all the same stream specifications as Process#spawn.
322
326
 
323
- ### 0.3.7.1 / 2018-05-30
327
+ ### v0.3.7.1 / 2018-05-30
324
328
 
325
329
  * No changes.
326
330
 
327
- ### 0.3.7 / 2018-05-30
331
+ ### v0.3.7 / 2018-05-30
328
332
 
329
333
  * CHANGED: Execution runs in the same scope as the DSL, which lets us use normal methods instead of helper-blocks.
330
334
  * CHANGED: Renamed "script" to "run", and allow setting of runnable by defining a "run" method
@@ -337,7 +341,7 @@ possible from this point, but I'll try to avoid them.
337
341
  * ADDED: Helper modules scoped to the tool hierarchy
338
342
  * ADDED: Utility that installs and activates third-party gems.
339
343
 
340
- ### 0.3.6 / 2018-05-21
344
+ ### v0.3.6 / 2018-05-21
341
345
 
342
346
  * CHANGED: Renamed show_version middleware to show_root_version.
343
347
  * CHANGED: Reworked set_default_descriptions interface for more flexibility.
@@ -349,14 +353,14 @@ possible from this point, but I'll try to avoid them.
349
353
  * IMPROVED: Support custom acceptors.
350
354
  * IMPROVED: Highline helper automatically sets use_color based on the type of stdout.
351
355
 
352
- ### 0.3.5 / 2018-05-15
356
+ ### v0.3.5 / 2018-05-15
353
357
 
354
358
  * CHANGED: Exec logic now lives in a utils class.
355
359
  * CHANGED: Moved flag and arg blocks from Tool into the DSL.
356
360
  * CHANGED: Renamed `execute do` to `script do`, and Tool#executor to Tool#script.
357
361
  * IMPROVED: Help display can use `less` if available.
358
362
 
359
- ### 0.3.4 / 2018-05-14
363
+ ### v0.3.4 / 2018-05-14
360
364
 
361
365
  * CHANGED: Renamed switch to flag
362
366
  * CHANGED: Renamed Utils::Usage to Utils::HelpText
@@ -378,7 +382,7 @@ possible from this point, but I'll try to avoid them.
378
382
  * ADDED: Alias DSL methods `required`, `optional`, and `remaining`.
379
383
  * FIXED: Finish definitions for subtools since the desc may depend on it
380
384
 
381
- ### 0.3.3 / 2018-05-09
385
+ ### v0.3.3 / 2018-05-09
382
386
 
383
387
  * CHANGED: Renamed file_utils helper to fileutils.
384
388
  * CHANGED: Renamed `doc:` parameter to `docs:`.
@@ -391,7 +395,7 @@ possible from this point, but I'll try to avoid them.
391
395
  * IMPROVED: Usage can now customize the left column width and indent
392
396
  * IMPROVED: Newlines in documentation are properly indented
393
397
 
394
- ### 0.3.2 / 2018-05-07
398
+ ### v0.3.2 / 2018-05-07
395
399
 
396
400
  * CHANGED: Split core engine out into "toys-core" from the "toys" gem.
397
401
  * CHANGED: Renamed path types to "search" and "config" paths, and restricted the former to the CLI.
@@ -9,7 +9,7 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.11.1"
12
+ VERSION = "0.11.2"
13
13
  end
14
14
 
15
15
  ## @private deprecated
@@ -492,7 +492,8 @@ module Toys
492
492
  #
493
493
  class Controller
494
494
  ## @private
495
- def initialize(name, controller_streams, captures, pid, join_threads, result_callback)
495
+ def initialize(name, controller_streams, captures, pid, join_threads,
496
+ result_callback, mutex)
496
497
  @name = name
497
498
  @in = controller_streams[:in]
498
499
  @out = controller_streams[:out]
@@ -508,6 +509,7 @@ module Toys
508
509
  end
509
510
  @join_threads = join_threads
510
511
  @result_callback = result_callback
512
+ @mutex = mutex
511
513
  @result = nil
512
514
  end
513
515
 
@@ -575,7 +577,10 @@ module Toys
575
577
  stream = stream_for(which)
576
578
  @join_threads << ::Thread.new do
577
579
  begin
578
- @captures[which] = stream.read
580
+ data = stream.read
581
+ @mutex.synchronize do
582
+ @captures[which] = data
583
+ end
579
584
  ensure
580
585
  stream.close
581
586
  end
@@ -940,6 +945,7 @@ module Toys
940
945
  @parent_streams = []
941
946
  @block = block
942
947
  @default_stream = @config_opts[:background] ? :null : :inherit
948
+ @mutex = ::Mutex.new
943
949
  end
944
950
 
945
951
  def execute
@@ -977,7 +983,7 @@ module Toys
977
983
  end
978
984
  @child_streams.each(&:close)
979
985
  Controller.new(@config_opts[:name], @controller_streams, @captures, pid,
980
- @join_threads, @config_opts[:result_callback])
986
+ @join_threads, @config_opts[:result_callback], @mutex)
981
987
  end
982
988
 
983
989
  def start_process
@@ -1284,7 +1290,10 @@ module Toys
1284
1290
  stream = make_out_pipe(key)
1285
1291
  @join_threads << ::Thread.new do
1286
1292
  begin
1287
- @captures[key] = stream.read
1293
+ data = stream.read
1294
+ @mutex.synchronize do
1295
+ @captures[key] = data
1296
+ end
1288
1297
  ensure
1289
1298
  stream.close
1290
1299
  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.11.1
4
+ version: 0.11.2
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-08-24 00:00:00.000000000 Z
11
+ date: 2020-09-06 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.1/file.CHANGELOG.html
72
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.2/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.1
75
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.2
76
76
  post_install_message:
77
77
  rdoc_options: []
78
78
  require_paths: