deploy_pin 1.3.8 → 1.4.0
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/lib/deploy_pin/collector.rb +23 -16
- data/lib/deploy_pin/version.rb +1 -1
- data/lib/deploy_pin.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2862b9b718d5a1ce6d6b6af0c10846f1915d7c0a70f13e68c96b2f69d1304bcc
|
4
|
+
data.tar.gz: c849c787465e4022faf6f10674ce53c7e67c71b68f1a2921de3f3e71ae64f8ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6bfd839077a2ca9ccdc75232fb376707ac87475bc6504f365991d01fdd4da81c15617605cc746fb8b1ada5a6dc3da8465b2382b9811f108accbc9a45080e6ff
|
7
|
+
data.tar.gz: f7ef8afae96a3ab5802a5f91de36248637c8eb003a7cbfdb168006373e65c5669360f9cf618f51daff082d41efe34b6ce2c0172cca7e8570717c793a8bc05542
|
data/lib/deploy_pin/collector.rb
CHANGED
@@ -9,28 +9,15 @@ module DeployPin
|
|
9
9
|
@identifiers = identifiers
|
10
10
|
end
|
11
11
|
|
12
|
+
# :reek:TooManyStatements
|
12
13
|
def run
|
13
14
|
# cache tasks
|
14
15
|
_tasks = tasks
|
15
16
|
_tasks.each_with_index do |task, index|
|
16
|
-
|
17
|
-
executable = _tasks[0..index].none? { |_task| task.eql?(_task) }
|
18
|
-
|
19
|
-
DeployPin.run_formatter.call(index, _tasks.count, task, executable, true)
|
20
|
-
|
21
|
-
# run if executable
|
22
|
-
if executable
|
23
|
-
duration = execution_duration do
|
24
|
-
run_with_timeout(task) { task.run }
|
25
|
-
end
|
26
|
-
|
27
|
-
DeployPin.run_formatter.call(index, _tasks.count, task, executable, false, duration)
|
28
|
-
end
|
29
|
-
|
30
|
-
# mark each task as done
|
31
|
-
task.mark unless task.done?
|
17
|
+
DeployPin.task_wrapper.call(task, -> { process(_tasks, task, index) })
|
32
18
|
end
|
33
19
|
end
|
20
|
+
# :reek:TooManyStatements
|
34
21
|
|
35
22
|
def list
|
36
23
|
_tasks = tasks
|
@@ -53,6 +40,26 @@ module DeployPin
|
|
53
40
|
|
54
41
|
private
|
55
42
|
|
43
|
+
# :reek:FeatureEnvy
|
44
|
+
# :reek:TooManyStatements
|
45
|
+
def process(cached_tasks, task, index)
|
46
|
+
# run only uniq tasks
|
47
|
+
executable = cached_tasks[0..index].none? { |_task| task.eql?(_task) }
|
48
|
+
|
49
|
+
DeployPin.run_formatter.call(index, cached_tasks.count, task, executable, true)
|
50
|
+
|
51
|
+
# run if executable
|
52
|
+
if executable
|
53
|
+
duration = execution_duration { run_with_timeout(task) { task.run } }
|
54
|
+
DeployPin.run_formatter.call(index, cached_tasks.count, task, executable, false, duration)
|
55
|
+
end
|
56
|
+
|
57
|
+
# mark each task as done
|
58
|
+
task.mark unless task.done?
|
59
|
+
end
|
60
|
+
# :reek:TooManyStatements
|
61
|
+
# :reek:FeatureEnvy
|
62
|
+
|
56
63
|
# :reek:UtilityFunction
|
57
64
|
def files
|
58
65
|
Dir["#{DeployPin.tasks_path}/*.rb"]
|
data/lib/deploy_pin/version.rb
CHANGED
data/lib/deploy_pin.rb
CHANGED
@@ -19,14 +19,15 @@ module DeployPin
|
|
19
19
|
statement_timeout
|
20
20
|
run_formatter
|
21
21
|
list_formatter
|
22
|
+
task_wrapper
|
22
23
|
].freeze
|
23
24
|
|
24
25
|
OPTIONS.each do |option|
|
25
26
|
instance_eval %{
|
26
27
|
def #{option}(val = nil)
|
27
|
-
return
|
28
|
+
return @#{option} unless val.present?
|
28
29
|
|
29
|
-
|
30
|
+
@#{option} = val
|
30
31
|
end
|
31
32
|
}, __FILE__, __LINE__ - 6
|
32
33
|
end
|
@@ -34,4 +35,10 @@ module DeployPin
|
|
34
35
|
def self.setup(&block)
|
35
36
|
instance_eval(&block)
|
36
37
|
end
|
38
|
+
|
39
|
+
def self.setup_defaults!
|
40
|
+
@task_wrapper = ->(_task, task_runner) { task_runner.call }
|
41
|
+
end
|
42
|
+
|
43
|
+
setup_defaults!
|
37
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_pin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Sych
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|