deploy_pin 1.0.2 → 1.0.3

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: 281ae9423c7de13dbe04f59abd29e3720f88bc45124ea92791c9e4298f71a19b
4
- data.tar.gz: 95ae741f1ff26dcdcc51ee6733e1fbfcdec39c5a43c269a4eab9dc0a0accca92
3
+ metadata.gz: 1f5e269526d154387064c2c9fd9d1014bbbfda16535fd01c572eab890f58fe2a
4
+ data.tar.gz: d891eead06e94bdea1cb5033e99f290a12219402fa8f3eaea4cfbc6d971b937c
5
5
  SHA512:
6
- metadata.gz: 6f876383c72821cf3e1dfb479f0e5663a54a3d455bae1af9d49eddf70d26c941b0a69c92bfdbb611f7ed2bbbc54f30306a6f69396fe5e96f7d3449ddecbe451d
7
- data.tar.gz: 3d2a64afc3ac0487e3b0776e196bf81d24e20c70cf89a576f4d9b804a37f56c1e3e7ef8333c4a64819a63fde5d4e89167fdb54eba1fe29307fbffae65a4301a1
6
+ metadata.gz: 58d60a88a350239da715e3e7d3182afbadbd43c4c6da92c4e44dbe26c34541b68df0abcc908a04a07108ea92d3bb7fea4a0092803db490bff4a83bad8bd903e4
7
+ data.tar.gz: 56435db402d2cd35b67332021bf9ee6c444a1461e394eaf4eb1ee18a2423088d28f02ba1bdbeb1c50dd32dea49e2bdda993b1131a43b5ff40f9077fa4b017e81
@@ -1,3 +1,5 @@
1
- class DeployPin::Engine < ::Rails::Engine
2
- isolate_namespace DeployPin
1
+ module DeployPin
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace DeployPin
4
+ end
3
5
  end
@@ -1,44 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # executes tasks
4
- module DeployPin::Runner
5
- def self.run(groups:)
6
- tasks = pending(groups: groups)
7
- tasks.each_with_index do |task, index|
8
- puts "[#{index + 1}/#{tasks.count}] Task UUID #{task.uuid}"
9
- task.run
10
- puts ""
4
+ module DeployPin
5
+ module Runner
6
+ def self.run(groups:)
7
+ tasks = pending(groups: groups)
8
+ tasks.each_with_index do |task, index|
9
+ puts "[#{index + 1}/#{tasks.count}] Task UUID #{task.uuid}"
10
+ task.run
11
+ puts ""
12
+ end
11
13
  end
12
- end
13
14
 
14
- def self.list(groups:)
15
- pending(groups: groups).each_with_index do |task, index|
16
- puts "======= Task ##{index} ========"
17
- puts task.script
18
- puts ""
19
- end
15
+ def self.list(groups:)
16
+ pending(groups: groups).each_with_index do |task, index|
17
+ puts "======= Task ##{index} ========"
18
+ puts task.script
19
+ puts ""
20
+ end
20
21
 
21
- puts "======= summary ========"
22
- puts "tasks number: #{pending(groups: groups).count}"
23
- end
22
+ puts "======= summary ========"
23
+ puts "tasks number: #{pending(groups: groups).count}"
24
+ end
24
25
 
25
- def self.pending(groups:)
26
- files = Dir["#{DeployPin.tasks_path}/*.rb"]
26
+ def self.pending(groups:)
27
+ files = Dir["#{DeployPin.tasks_path}/*.rb"]
27
28
 
28
- # get done records uuids
29
- records = DeployPin::Record.pluck(:uuid)
29
+ # get done records uuids
30
+ records = DeployPin::Record.pluck(:uuid)
30
31
 
31
- files.map do |file|
32
- task = DeployPin::Task.new(file)
33
- task.parse_file
32
+ files.map do |file|
33
+ task = DeployPin::Task.new(file)
34
+ task.parse_file
34
35
 
35
- # task is done
36
- next if records.include?(task.uuid)
36
+ # task is done
37
+ next if records.include?(task.uuid)
37
38
 
38
- # group mismatch
39
- next unless groups.include?(task.group)
39
+ # group mismatch
40
+ next unless groups.include?(task.group)
40
41
 
41
- task
42
- end.compact.sort # sort by group position in config
42
+ task
43
+ end.compact.sort # sort by group position in config
44
+ end
43
45
  end
44
46
  end
@@ -1,40 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Task wrapper
4
- class DeployPin::Task
5
- attr_reader :file,
6
- :group,
7
- :uuid,
8
- :script
4
+ module DeployPin
5
+ class Task
6
+ attr_reader :file,
7
+ :group,
8
+ :uuid,
9
+ :script
9
10
 
10
- def initialize(file)
11
- @file = file
12
- @uuid = nil
13
- @group = nil
14
- @script = ""
15
- end
11
+ def initialize(file)
12
+ @file = file
13
+ @uuid = nil
14
+ @group = nil
15
+ @script = ""
16
+ end
16
17
 
17
- def run
18
- eval(@script)
19
- end
18
+ def run
19
+ eval(@script)
20
+ end
20
21
 
21
- def parse_file
22
- @script = File.read(file)
23
- @script.lines[0] =~ /\A# (\d+):(\w+)/
24
- @uuid = $1
25
- @group = $2
26
- end
22
+ def parse_file
23
+ @script = File.read(file)
24
+ @script.lines[0] =~ /\A# (\d+):(\w+)/
25
+ @uuid = $1
26
+ @group = $2
27
+ end
27
28
 
28
- def details
29
- puts @uuid, @group, @script
30
- end
29
+ def details
30
+ puts @uuid, @group, @script
31
+ end
31
32
 
32
- # for sorting
33
- def <=>(task_b)
34
- group_index <=> task_b.group_index
35
- end
33
+ # for sorting
34
+ def <=>(task_b)
35
+ group_index <=> task_b.group_index
36
+ end
36
37
 
37
- def group_index
38
- DeployPin.groups.index(group)
38
+ def group_index
39
+ DeployPin.groups.index(group)
40
+ end
39
41
  end
40
42
  end
@@ -1,3 +1,3 @@
1
1
  module DeployPin
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
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.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rafael