deploy_pin 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a67cacd26a838e6202af534aae73f3c513fd433c3fd7444d62f36158b740496
4
- data.tar.gz: 10402c41e8fd45e00dbe20d4dd106d30470016ca14eb17042e071f15e3d1c6b5
3
+ metadata.gz: beedccf959c1df1669e8e914178bddcf87f06d405a9d661b4dc04916ea373dff
4
+ data.tar.gz: 8c274e35437e927a03dc6160c4aec78ab1b520a66620f182e36d7795304e20f0
5
5
  SHA512:
6
- metadata.gz: a50cc8b2502e60ced24dcd635f6ee363a66faf8e6086deae8b2feda38c1c0fde4324cca84de45718c219719c09363e4eb8022736abdb00dc0680d0c97d98e203
7
- data.tar.gz: d2903e743536fe443b68a5449b6f2ea62e9214fa3a4c85a40bed76effd90fe3e41c3258cf87c53e79a071a28de63ad0f9096eb3e6da1e2b8c07fc2ccaa74c9bc
6
+ metadata.gz: 3a645d647360b34c97c45b063b9d99ea900702cebb6fbf1c5fc39f9736d3f005f64b8b6e4c42d5040e02837aca73321dd2d3ab2a8642cef2efa82bc5c78aaf7b
7
+ data.tar.gz: 55d5b51f9b8b7a21c2877bbf237daed1392e1a36ef6f885b3d56a8f0dcaf3eefe8f86895dfac7280aca36dc8bffeb3fef20a931ce90ad9e4a0bd82514dd800c8
@@ -26,14 +26,16 @@ module DeployPin
26
26
  end
27
27
 
28
28
  def run
29
- count = tasks.count
29
+ # cache tasks
30
+ _tasks = tasks
31
+ _tasks.each_with_index do |task, index|
32
+ # run only uniq tasks
33
+ executable = _tasks[0..index].none? { |_task| task.eql?(_task) }
30
34
 
31
- tasks.each_with_index do |task, index|
32
- yield(index, count, task)
35
+ # run if executable
36
+ task.run if executable
33
37
 
34
- # run only uniq tasks
35
- # task.run if tasks.none? { |_task| task.eql?(_task) }
36
- task.run
38
+ yield(index, _tasks.count, task, executable)
37
39
 
38
40
  # mark each task as done
39
41
  task.mark
@@ -41,10 +43,9 @@ module DeployPin
41
43
  end
42
44
 
43
45
  def list
44
- count = tasks.count
45
-
46
- tasks.each_with_index do |task, index|
47
- yield(index, count, task)
46
+ _tasks = tasks
47
+ _tasks.each_with_index do |task, index|
48
+ yield(index, _tasks.count, task)
48
49
  end
49
50
  end
50
51
  end
@@ -4,32 +4,36 @@
4
4
  module DeployPin
5
5
  module Runner
6
6
  def self.run(groups:)
7
- DeployPin::Collector.new(groups: groups).run do |index, count, task|
8
- puts("[#{index + 1}/#{count}] Task #{task.title} #{task.uuid}##{task.group}")
7
+ DeployPin::Collector.new(groups: groups).run do |index, count, task, executable|
8
+ self.print("[#{index + 1}/#{count}] Task #{task.title} #{task.uuid}##{task.group} (#{executable ? 'run' : 'skip'})")
9
9
  end
10
10
  end
11
11
 
12
12
  def self.list(groups:)
13
13
  DeployPin::Collector.new(groups: groups).list do |index, count, task|
14
- puts("======= Task ##{index} ========".white)
14
+ self.print("======= Task ##{index} ========".white)
15
15
 
16
16
  # print details
17
17
  task.details.each do |key, value|
18
- puts "#{key}:\t\t#{value}"
18
+ self.print("#{key}:\t\t#{value}")
19
19
  end
20
20
 
21
- puts("")
22
- puts("<<<")
23
- puts task.script.strip.green
24
- puts(">>>")
25
- puts("")
21
+ self.print("")
22
+ self.print("<<<")
23
+ self.print task.script.strip.green
24
+ self.print(">>>")
25
+ self.print("")
26
26
  end
27
27
  end
28
28
 
29
29
  def self.summary(groups:)
30
30
  # print summary
31
- puts("======= summary ========")
32
- puts("tasks number: #{DeployPin::Collector.new(groups: groups).tasks.count}")
31
+ self.print("======= Summary ========")
32
+ self.print("tasks number: #{DeployPin::Collector.new(groups: groups).tasks.count}")
33
+ end
34
+
35
+ def self.print(msg)
36
+ puts(msg) unless Rails.env.test?
33
37
  end
34
38
  end
35
39
  end
@@ -54,7 +54,8 @@ module DeployPin
54
54
  end
55
55
 
56
56
  def eql?(task_b)
57
- script == task_b.script
57
+ # same script & different uuid
58
+ script == task_b.script && uuid != task_b.uuid
58
59
  end
59
60
 
60
61
  protected
@@ -1,3 +1,3 @@
1
1
  module DeployPin
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_pin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rafael
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.12.0
95
+ version: 0.16.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.12.0
102
+ version: 0.16.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: bundler
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -223,7 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubygems_version: 3.0.2
226
+ rubyforge_project:
227
+ rubygems_version: 2.7.6
227
228
  signing_key:
228
229
  specification_version: 4
229
230
  summary: pin some task around deployment