autobuild 1.20.0 → 1.21.0

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: 3b347c81cc5ac09e4f967df3dd5f53bca82fb3ba2a1a4a2e76b1b2d20ba19869
4
- data.tar.gz: 6eaa54db5306f069ce5e9809b708df1bb4c5def84dc1553c953a3e38319cbf26
3
+ metadata.gz: ab39a53575bd73cfcf5468577e0a331dcb0ffac4cd3a44a56d6485b0185d8d9c
4
+ data.tar.gz: 5612683a6a53e89787892fc54bb0f1b2e7f98251b1204d1986b115afd57bd536
5
5
  SHA512:
6
- metadata.gz: ccefa69f82809031debaeee77adde985c2de4d88c738e9b439cf7e839bc511f2f4c757486625f88a91541d97c16566217a544831c35924ea76cae98920d9f59d
7
- data.tar.gz: 9f4b9b5c38e9072104dc052c630ca7a49a915331526cdbc624d2ef725eef44987b97b97667ebcafead9afb145fcbb3cee5a921f699aed101ec99efd611c28352
6
+ metadata.gz: 278baf14e748956b8f45e65e13b5156b875559d36ac2a973afa0a82de1840e7faa02d6f4bb5179c2d4c811048e69673d916c70d757b625d7586a4bc192653893
7
+ data.tar.gz: 65ad33b5793db30fd126101e1bb36e933265cc0727845c97e866295e4248b3de9b5f0b93e07dc6046adf4f791085687fb568c633e426f6b648d8991bd0ee22f2
@@ -4,6 +4,8 @@ rvm:
4
4
  - '2.3'
5
5
  - '2.4'
6
6
  - '2.5'
7
+ - '2.6'
8
+ - '2.7'
7
9
  - 'jruby-9.1.15.0'
8
10
  matrix:
9
11
  allow_failures:
@@ -23,11 +23,12 @@ Gem::Specification.new do |s|
23
23
  s.files = `git ls-files -z`.split("\x0")
24
24
  .reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
 
26
- s.add_runtime_dependency 'pastel', '~> 0.7.0', '>= 0.7.0'
27
- s.add_runtime_dependency "rake", "~> 12.0", ">= 12.3.0"
28
- s.add_runtime_dependency 'tty-cursor', '~> 0.5.0'
29
- s.add_runtime_dependency 'tty-prompt', '~> 0.15.0'
30
- s.add_runtime_dependency 'tty-screen', '~> 0.6.4'
26
+ s.add_runtime_dependency "concurrent-ruby", "~> 1.1"
27
+ s.add_runtime_dependency "pastel", "~> 0.7.0"
28
+ s.add_runtime_dependency "rake", "~> 13.0"
29
+ s.add_runtime_dependency 'tty-cursor', '~> 0.7.0'
30
+ s.add_runtime_dependency 'tty-prompt', '~> 0.21.0'
31
+ s.add_runtime_dependency 'tty-screen', '~> 0.8.0'
31
32
  s.add_runtime_dependency "utilrb", "~> 3.0", ">= 3.0"
32
33
  s.add_development_dependency "fakefs"
33
34
  s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
@@ -1,3 +1,6 @@
1
+ require "concurrent/atomic/atomic_boolean"
2
+ require "concurrent/array"
3
+
1
4
  module Autobuild
2
5
  # Management of the progress display
3
6
  class ProgressDisplay
@@ -5,7 +8,7 @@ def initialize(io, color: ::Autobuild.method(:color))
5
8
  @io = io
6
9
  @cursor = TTY::Cursor
7
10
  @last_formatted_progress = []
8
- @progress_messages = []
11
+ @progress_messages = Concurrent::Array.new
9
12
 
10
13
  @silent = false
11
14
  @color = color
@@ -14,6 +17,15 @@ def initialize(io, color: ::Autobuild.method(:color))
14
17
  @next_progress_display = Time.at(0)
15
18
  @progress_mode = :single_line
16
19
  @progress_period = 0.1
20
+
21
+ @message_queue = Queue.new
22
+ @forced_progress_display = Concurrent::AtomicBoolean.new(false)
23
+ end
24
+
25
+ def synchronize(&block)
26
+ result = @display_lock.synchronize(&block)
27
+ refresh_display
28
+ result
17
29
  end
18
30
 
19
31
  # Set the minimum time between two progress messages
@@ -86,17 +98,9 @@ def message(message, *args, io: @io, force: false)
86
98
  return if silent? && !force
87
99
 
88
100
  io = args.pop if args.last.respond_to?(:to_io)
101
+ @message_queue << [message, args, io]
89
102
 
90
- @display_lock.synchronize do
91
- if @progress_mode == :single_line
92
- io.print @cursor.clear_screen_down
93
- end
94
- io.puts @color.call(message, *args)
95
-
96
- io.flush if @io != io
97
- display_progress
98
- @io.flush
99
- end
103
+ refresh_display
100
104
  end
101
105
 
102
106
  def progress_start(key, *args, done_message: nil)
@@ -105,13 +109,13 @@ def progress_start(key, *args, done_message: nil)
105
109
  formatted_message = @color.call(*args)
106
110
  @progress_messages << [key, formatted_message]
107
111
  if progress_enabled?
108
- @display_lock.synchronize do
109
- display_progress(consider_period: false)
110
- end
112
+ @forced_progress_display.make_true
111
113
  else
112
114
  message " #{formatted_message}"
113
115
  end
114
116
 
117
+ refresh_display
118
+
115
119
  if block_given?
116
120
  begin
117
121
  result = yield
@@ -125,46 +129,69 @@ def progress_start(key, *args, done_message: nil)
125
129
  end
126
130
 
127
131
  def progress(key, *args)
128
- @display_lock.synchronize do
129
- found = false
130
- @progress_messages.map! do |msg_key, msg|
131
- if msg_key == key
132
- found = true
133
- [msg_key, @color.call(*args)]
134
- else
135
- [msg_key, msg]
136
- end
132
+ found = false
133
+ @progress_messages.map! do |msg_key, msg|
134
+ if msg_key == key
135
+ found = true
136
+ [msg_key, @color.call(*args)]
137
+ else
138
+ [msg_key, msg]
137
139
  end
138
- @progress_messages << [key, @color.call(*args)] unless found
139
- display_progress
140
140
  end
141
+ @progress_messages << [key, @color.call(*args)] unless found
142
+
143
+ refresh_display
141
144
  end
142
145
 
143
146
  def progress_done(key, display_last = true, message: nil)
144
- changed = @display_lock.synchronize do
145
- current_size = @progress_messages.size
146
- @progress_messages.delete_if do |msg_key, msg|
147
- if msg_key == key
148
- message = msg if display_last && !message
149
- true
150
- end
147
+ current_size = @progress_messages.size
148
+ @progress_messages.delete_if do |msg_key, msg|
149
+ if msg_key == key
150
+ message = msg if display_last && !message
151
+ true
151
152
  end
152
- current_size != @progress_messages.size
153
153
  end
154
+ changed = current_size != @progress_messages.size
154
155
 
155
156
  if changed
156
157
  if message
157
158
  message(" #{message}")
158
- # Note: message calls display_progress already
159
+ # Note: message updates the display already
159
160
  else
160
- @display_lock.synchronize do
161
- display_progress
162
- end
161
+ refresh_display
163
162
  end
164
163
  true
165
164
  end
166
165
  end
167
166
 
167
+ def refresh_display
168
+ return unless @display_lock.try_lock
169
+
170
+ begin
171
+ refresh_display_under_lock
172
+ ensure
173
+ @display_lock.unlock
174
+ end
175
+ end
176
+
177
+ def refresh_display_under_lock
178
+ # Display queued messages
179
+ until @message_queue.empty?
180
+ message, args, io = @message_queue.pop
181
+ if @progress_mode == :single_line
182
+ io.print @cursor.clear_screen_down
183
+ end
184
+ io.puts @color.call(message, *args)
185
+
186
+ io.flush if @io != io
187
+ end
188
+
189
+ # And re-display the progress
190
+ display_progress(consider_period: @forced_progress_display.false?)
191
+ @forced_progress_display.make_false
192
+ @io.flush
193
+ end
194
+
168
195
  def display_progress(consider_period: true)
169
196
  return unless progress_enabled?
170
197
  return if consider_period && (@next_progress_display > Time.now)
@@ -47,6 +47,10 @@ def self.progress_display_enabled?
47
47
  @display.progress_enabled?
48
48
  end
49
49
 
50
+ def self.progress_display_synchronize(&block)
51
+ @display.synchronize(&block)
52
+ end
53
+
50
54
  # @deprecated use {progress_display_mode=} instead
51
55
  def self.progress_display_enabled=(value)
52
56
  @display.progress_enabled = value
@@ -73,7 +73,8 @@ def coverage_source_dir
73
73
  def coverage_target_dir
74
74
  if @coverage_target_dir
75
75
  File.expand_path(@coverage_target_dir, package.prefix)
76
- else File.join(target_dir, 'coverage')
76
+ elsif (target_dir = self.target_dir)
77
+ File.join(target_dir, 'coverage')
77
78
  end
78
79
  end
79
80
 
@@ -30,6 +30,7 @@ def initialize(name, package, install_on_error: false)
30
30
  @target_dir = nil
31
31
  @install_on_error = install_on_error
32
32
 
33
+ @no_results = false
33
34
  @invoked = false
34
35
  @success = false
35
36
  @installed = false
@@ -58,6 +59,23 @@ def source_dir
58
59
  # not install anything
59
60
  attr_writer :target_dir
60
61
 
62
+ # Controls whether this utility generates results or not
63
+ #
64
+ # By default, Autobuild assumes that utilities generate report or
65
+ # artifact files, that are saved in {#target_dir}. Set this flag to
66
+ # true to disable this behavior, in which case the only report will
67
+ # be the console output during run
68
+ #
69
+ # @see no_results?
70
+ attr_writer :no_results
71
+
72
+ # Whether this utility generates results or not
73
+ #
74
+ # @see no_results=
75
+ def no_results?
76
+ @no_results
77
+ end
78
+
61
79
  # Absolute path to where the utility product files have to be installed.
62
80
  # Returns nil if {target_dir} is not set.
63
81
  #
@@ -108,13 +126,13 @@ def call_task_block
108
126
  yield if block_given?
109
127
  @success = true
110
128
  rescue StandardError => e
111
- install if install_on_error? && !@installed && target_dir
129
+ install if install_on_error? && !@installed && !no_results?
112
130
  raise
113
131
  end
114
132
 
115
133
  # Allow the user to install manually in the task
116
134
  # block
117
- install if !@installed && target_dir
135
+ install if !@installed && !no_results?
118
136
  rescue StandardError => e
119
137
  @success = false
120
138
 
@@ -138,7 +156,7 @@ def call_task_block
138
156
  #
139
157
  # @return [Boolean]
140
158
  def available?
141
- @available && (source_dir && @task)
159
+ @available && @task && (no_results? || source_dir)
142
160
  end
143
161
 
144
162
  # True if this utility should be executed
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.20.0".freeze unless defined? Autobuild::VERSION
2
+ VERSION = "1.21.0".freeze unless defined? Autobuild::VERSION
3
3
  end
metadata CHANGED
@@ -1,33 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pastel
14
+ name: concurrent-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.0
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.7.0
19
+ version: '1.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pastel
29
+ requirement: !ruby/object:Gem::Requirement
26
30
  requirements:
27
31
  - - "~>"
28
32
  - !ruby/object:Gem::Version
29
33
  version: 0.7.0
30
- - - ">="
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
31
39
  - !ruby/object:Gem::Version
32
40
  version: 0.7.0
33
41
  - !ruby/object:Gem::Dependency
@@ -36,62 +44,56 @@ dependencies:
36
44
  requirements:
37
45
  - - "~>"
38
46
  - !ruby/object:Gem::Version
39
- version: '12.0'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 12.3.0
47
+ version: '13.0'
43
48
  type: :runtime
44
49
  prerelease: false
45
50
  version_requirements: !ruby/object:Gem::Requirement
46
51
  requirements:
47
52
  - - "~>"
48
53
  - !ruby/object:Gem::Version
49
- version: '12.0'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 12.3.0
54
+ version: '13.0'
53
55
  - !ruby/object:Gem::Dependency
54
56
  name: tty-cursor
55
57
  requirement: !ruby/object:Gem::Requirement
56
58
  requirements:
57
59
  - - "~>"
58
60
  - !ruby/object:Gem::Version
59
- version: 0.5.0
61
+ version: 0.7.0
60
62
  type: :runtime
61
63
  prerelease: false
62
64
  version_requirements: !ruby/object:Gem::Requirement
63
65
  requirements:
64
66
  - - "~>"
65
67
  - !ruby/object:Gem::Version
66
- version: 0.5.0
68
+ version: 0.7.0
67
69
  - !ruby/object:Gem::Dependency
68
70
  name: tty-prompt
69
71
  requirement: !ruby/object:Gem::Requirement
70
72
  requirements:
71
73
  - - "~>"
72
74
  - !ruby/object:Gem::Version
73
- version: 0.15.0
75
+ version: 0.21.0
74
76
  type: :runtime
75
77
  prerelease: false
76
78
  version_requirements: !ruby/object:Gem::Requirement
77
79
  requirements:
78
80
  - - "~>"
79
81
  - !ruby/object:Gem::Version
80
- version: 0.15.0
82
+ version: 0.21.0
81
83
  - !ruby/object:Gem::Dependency
82
84
  name: tty-screen
83
85
  requirement: !ruby/object:Gem::Requirement
84
86
  requirements:
85
87
  - - "~>"
86
88
  - !ruby/object:Gem::Version
87
- version: 0.6.4
89
+ version: 0.8.0
88
90
  type: :runtime
89
91
  prerelease: false
90
92
  version_requirements: !ruby/object:Gem::Requirement
91
93
  requirements:
92
94
  - - "~>"
93
95
  - !ruby/object:Gem::Version
94
- version: 0.6.4
96
+ version: 0.8.0
95
97
  - !ruby/object:Gem::Dependency
96
98
  name: utilrb
97
99
  requirement: !ruby/object:Gem::Requirement
@@ -274,8 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
276
  - !ruby/object:Gem::Version
275
277
  version: '0'
276
278
  requirements: []
277
- rubyforge_project:
278
- rubygems_version: 2.7.6.2
279
+ rubygems_version: 3.1.2
279
280
  signing_key:
280
281
  specification_version: 4
281
282
  summary: Library to handle build systems and import mechanisms