cli-ui 2.2.0 → 2.2.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: 8f063229317bef21e8a24f2190dd907c1a1080eefad787871dc8f07b95a3c31b
4
- data.tar.gz: 6379c4023ca55081b2d5260ce79ed9615c304c7ab099b9318883a04ef4d11e1e
3
+ metadata.gz: 1edd90ccd15771c59e43d39ad0004ed99d20b0ff1b68a63cc73b9beea480cb30
4
+ data.tar.gz: '096a40c20c1e2fb8e0bcf68b6fb0f8542d5b0d5c578c11e4b6248507efaeace2'
5
5
  SHA512:
6
- metadata.gz: 07f5f6b944ceeadd42359bc5c3edde469fb034641ad0ea274306097ec2471af1d8b6fb1fbc85f5d30c43ddb1472b6af1ee1688a921deea6404cbf642239d4ffe
7
- data.tar.gz: 25c645e1b2c6078e3ace849ef02ff85b727e88df4dedfa4baf200a56760369cf440ca435fe8ca18e3e24f301dfa80e772e48c6ccdf12a5dd9b6e4c2d5b4ae353
6
+ metadata.gz: ebd356d3f38fa275e66180f3c621a408b36fc4f1ad9965e7bd7b6b2dfef0768364e9175cbeefe5b4964d26c44b3e95cf2e2825a007e1e6a78eeb537704ee024c
7
+ data.tar.gz: 40da4c348dd7aa86ab14697abc1172947c63fedc8b1b40b7938fdc65c24e63c71b4d40819f8e6f925059444a33d689e906edd66c68b26c6bd454735436c7c935
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CLI
4
4
  module UI
5
- VERSION = '2.2.0'
5
+ VERSION = '2.2.1'
6
6
  end
7
7
  end
@@ -0,0 +1,75 @@
1
+ # Copyright (c) 2014 Boris Bera
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ # Sourced from https://github.com/dotboris/reentrant_mutex
25
+
26
+ class ReentrantMutex < Mutex
27
+ def initialize
28
+ @count_mutex = Mutex.new
29
+ @counts = Hash.new(0)
30
+
31
+ super
32
+ end
33
+
34
+ def synchronize
35
+ raise ThreadError, 'Must be called with a block' unless block_given?
36
+
37
+ begin
38
+ lock
39
+ yield
40
+ ensure
41
+ unlock
42
+ end
43
+ end
44
+
45
+ def lock
46
+ c = increase_count Thread.current
47
+ super if c <= 1
48
+ end
49
+
50
+ def unlock
51
+ c = decrease_count Thread.current
52
+ if c <= 0
53
+ super
54
+ delete_count Thread.current
55
+ end
56
+ end
57
+
58
+ def count
59
+ @count_mutex.synchronize { @counts[Thread.current] }
60
+ end
61
+
62
+ private
63
+
64
+ def increase_count(thread)
65
+ @count_mutex.synchronize { @counts[thread] += 1 }
66
+ end
67
+
68
+ def decrease_count(thread)
69
+ @count_mutex.synchronize { @counts[thread] -= 1 }
70
+ end
71
+
72
+ def delete_count(thread)
73
+ @count_mutex.synchronize { @counts.delete(thread) }
74
+ end
75
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-04-17 00:00:00.000000000 Z
13
+ date: 2023-04-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -79,6 +79,7 @@ files:
79
79
  - lib/cli/ui/widgets/base.rb
80
80
  - lib/cli/ui/widgets/status.rb
81
81
  - lib/cli/ui/wrap.rb
82
+ - vendor/reentrant_mutex.rb
82
83
  homepage: https://github.com/shopify/cli-ui
83
84
  licenses:
84
85
  - MIT