configmonkey_cli 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/configmonkey_cli/application/manifest.rb +2 -1
- data/lib/configmonkey_cli/application/manifest_actions/copy.rb +18 -2
- data/lib/configmonkey_cli/application/manifest_actions/invoke.rb +2 -2
- data/lib/configmonkey_cli/application/manifest_actions/template.rb +8 -12
- data/lib/configmonkey_cli/version.rb +1 -1
- 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: 391f6c9bbafb6e640823708c4cff1f0b5955436a65b986f4254c916784ad6816
|
4
|
+
data.tar.gz: eec65f85b8b493b2b7230905fa374de3652f1390124ed03feca376814200f38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41fae277325b89e41e69295403e6128a69a401f070a20ee4ca536a9a55bbcfd937268883b550617083aa5e21f6458213cba961fba5ddbd4dd7e26c07875be117
|
7
|
+
data.tar.gz: ee4cf475e8415e90ec9afe0177cc6e7ec3c2d17eacb28c681cbf389816eadd60202e5cfb23634b27c92400b6545b716ff5293021a56016bfbdd07a16be8ef0a8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -206,7 +206,8 @@ module ConfigmonkeyCli
|
|
206
206
|
|
207
207
|
def push_action *args
|
208
208
|
if $cm_current_action_index
|
209
|
-
|
209
|
+
$cm_current_action_index += 1
|
210
|
+
@actions.insert $cm_current_action_index, [@host_constraint.dup] + args
|
210
211
|
else
|
211
212
|
@actions.push [@host_constraint.dup] + args
|
212
213
|
end
|
@@ -22,15 +22,31 @@ module ConfigmonkeyCli
|
|
22
22
|
|
23
23
|
def destructive
|
24
24
|
absolute_source = File.join(thor.source_paths[0], @source)
|
25
|
+
has_changed = !File.exist?(@destination)
|
26
|
+
|
27
|
+
if @opts[:after_change] && File.exist?(@destination)
|
28
|
+
has_changed = File.binread(absolute_source) != File.binread(@destination)
|
29
|
+
end
|
30
|
+
|
25
31
|
if FileTest.directory?(absolute_source)
|
26
|
-
|
32
|
+
_perform_directory(@source, @destination, @opts)
|
27
33
|
else
|
28
|
-
|
34
|
+
_perform_file(@source, @destination, @opts)
|
29
35
|
if @opts[:chmod] && File.exist?(absolute_source) && File.exist?(@destination)
|
30
36
|
mode = @opts[:chmod] == true ? File.stat(absolute_source).mode - 0100000 : @opts[:chmod]
|
31
37
|
thor.chmod(@destination, mode) unless mode == File.stat(@destination).mode - 0100000
|
32
38
|
end
|
33
39
|
end
|
40
|
+
|
41
|
+
@opts[:after_change].call if has_changed && @opts[:after_change]
|
42
|
+
end
|
43
|
+
|
44
|
+
def _perform_directory(source, destination, opts)
|
45
|
+
thor.directory(source, destination, opts)
|
46
|
+
end
|
47
|
+
|
48
|
+
def _perform_file(source, destination, opts)
|
49
|
+
thor.copy_file(source, destination, opts)
|
34
50
|
end
|
35
51
|
end
|
36
52
|
end
|
@@ -23,10 +23,10 @@ module ConfigmonkeyCli
|
|
23
23
|
lines = res.split("\n")
|
24
24
|
if code.exitstatus.zero?
|
25
25
|
say padded("#{c "[OK]", :green} #{lines[0]}", :black)
|
26
|
-
lines[1..-1].each{|l| say padded(" #{l}") }
|
26
|
+
lines[1..-1].each{|l| say padded(" #{l}") } if lines.length > 1
|
27
27
|
else
|
28
28
|
say padded("[#{code.exitstatus}] #{lines[0]}", :red)
|
29
|
-
lines[1..-1].each{|l| say padded(" #{l}") }
|
29
|
+
lines[1..-1].each{|l| say padded(" #{l}") } if lines.length > 1
|
30
30
|
raise "Invoked process exited with status #{code.exitstatus}: #{res}" if opts[:fail]
|
31
31
|
end
|
32
32
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ConfigmonkeyCli
|
2
2
|
class Application
|
3
3
|
module ManifestAction
|
4
|
-
class Template <
|
4
|
+
class Template < Copy
|
5
5
|
def init hargs_and_opts = {}
|
6
6
|
@args, @opts = args_and_opts(hargs_and_opts)
|
7
7
|
end
|
@@ -20,17 +20,13 @@ module ConfigmonkeyCli
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
mode = @opts[:chmod] == true ? File.stat(absolute_source).mode - 0100000 : @opts[:chmod]
|
31
|
-
thor.chmod(@destination, mode) unless mode == File.stat(@destination).mode - 0100000
|
32
|
-
end
|
33
|
-
end
|
23
|
+
def _perform_directory(source, destination, opts)
|
24
|
+
status :invalid, :red, "directory not allowed for template", :red
|
25
|
+
end
|
26
|
+
|
27
|
+
def _perform_file(source, destination, opts)
|
28
|
+
hostname = app.opts[:hostname]
|
29
|
+
thor.template(@source, @destination, @opts.merge(context: binding))
|
34
30
|
end
|
35
31
|
end
|
36
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configmonkey_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Pachnit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|