itamae 1.1.9 → 1.1.10
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/CHANGELOG.md +6 -0
- data/lib/itamae/cli.rb +2 -0
- data/lib/itamae/recipe_children.rb +31 -2
- data/lib/itamae/runner.rb +9 -0
- data/lib/itamae/version.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 616cfc3511d0ccaed6104add74b3502120fc80a5
|
4
|
+
data.tar.gz: fdec38243e8406d3646df667690fd19129ff61cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22cec5cb03fe430522b6afbd3f2159ff626f79cc8787d398224d69a6a78dd9ef801c937e0a056cd015d840113080a9b42b4c0afe60c268e87007173f34501b5b
|
7
|
+
data.tar.gz: 300eead221e03c2e58c6604e150a6d1149646d826bfb1266fb527ceeed8dcdef0ad88790a70c6c2b0bf2b8775ea464b5f9ba3e7d809e33b3a29ffc5113d85e59
|
data/CHANGELOG.md
CHANGED
data/lib/itamae/cli.rb
CHANGED
@@ -15,6 +15,7 @@ module Itamae
|
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "local RECIPE [RECIPE...]", "Run Itamae locally"
|
18
|
+
option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
|
18
19
|
option :node_json, type: :string, aliases: ['-j']
|
19
20
|
option :node_yaml, type: :string, aliases: ['-y']
|
20
21
|
option :dry_run, type: :boolean, aliases: ['-n']
|
@@ -28,6 +29,7 @@ module Itamae
|
|
28
29
|
end
|
29
30
|
|
30
31
|
desc "ssh RECIPE [RECIPE...]", "Run Itamae via ssh"
|
32
|
+
option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
|
31
33
|
option :node_json, type: :string, aliases: ['-j']
|
32
34
|
option :node_yaml, type: :string, aliases: ['-y']
|
33
35
|
option :dry_run, type: :boolean, aliases: ['-n']
|
@@ -39,11 +39,17 @@ module Itamae
|
|
39
39
|
end.flatten
|
40
40
|
end
|
41
41
|
|
42
|
-
def recipes
|
42
|
+
def recipes(options = {})
|
43
|
+
options = {recursive: true}.merge(options)
|
44
|
+
|
43
45
|
self.select do |item|
|
44
46
|
item.is_a?(Recipe)
|
45
47
|
end.map do |recipe|
|
46
|
-
[
|
48
|
+
if options[:recursive]
|
49
|
+
[recipe] + recipe.children.recipes
|
50
|
+
else
|
51
|
+
recipe
|
52
|
+
end
|
47
53
|
end.flatten
|
48
54
|
end
|
49
55
|
|
@@ -57,5 +63,28 @@ module Itamae
|
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
66
|
+
|
67
|
+
# returns dependencies graph in DOT
|
68
|
+
def deps_in_dot
|
69
|
+
result = ""
|
70
|
+
result << "digraph recipes {\n"
|
71
|
+
result << _deps_in_dot
|
72
|
+
result << "}"
|
73
|
+
|
74
|
+
result
|
75
|
+
end
|
76
|
+
|
77
|
+
def _deps_in_dot
|
78
|
+
result = ""
|
79
|
+
|
80
|
+
recipes(recursive: false).each do |recipe|
|
81
|
+
recipe.children.recipes(recursive: false).each do |child_recipe|
|
82
|
+
result << %{ "#{recipe.path}" -> "#{child_recipe.path}";\n}
|
83
|
+
end
|
84
|
+
result << recipe.children._deps_in_dot
|
85
|
+
end
|
86
|
+
|
87
|
+
result
|
88
|
+
end
|
60
89
|
end
|
61
90
|
end
|
data/lib/itamae/runner.rb
CHANGED
@@ -12,6 +12,15 @@ module Itamae
|
|
12
12
|
|
13
13
|
runner = self.new(node_from_options(options))
|
14
14
|
runner.load_recipes(recipe_files)
|
15
|
+
|
16
|
+
if dot_file = options[:dot]
|
17
|
+
Logger.info "Writing dependency graph in DOT to #{dot_file}..."
|
18
|
+
open(dot_file, 'w') do |f|
|
19
|
+
f.write(runner.children.deps_in_dot)
|
20
|
+
end
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
15
24
|
runner.run(dry_run: options[:dry_run])
|
16
25
|
end
|
17
26
|
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.10
|