rbcm 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cli.rb +18 -9
- data/app/lib/params.rb +1 -1
- data/app/node/file.rb +1 -1
- data/app/node/sandbox.rb +2 -0
- data/app/project/project.rb +0 -1
- data/app/rbcm.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9edabb3d5cffb1432c1a69c840e0c1a51fc3f5303c746cc1dcfa5ed08973f21
|
4
|
+
data.tar.gz: aff2d28a1feccb2bfca5e173e09e082e4e41944b994b7138e1ffb22127269bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d3455d8aea26ff4cdc0d8fd20eb099cbd0deabf304af6fbba79d14e1e761f25688be0abce0892d287676827814e41c525bf4f80a94e07561ecba2de0192ea3
|
7
|
+
data.tar.gz: 4ca7161c7075c30824ef18a9bf8e5731260fd51e1f1943ccd303d99707ed2cf086fa05212356e7727ad232bdbd7c5b5134a9d13d2f96b7bdbfd5b89c94054a38
|
data/app/cli.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class CLI
|
2
2
|
def initialize argv
|
3
|
-
args = Hash[ argv.join(' ').scan(/--?([^=\s]+)(?:[=\s](\S+))?/) ]
|
4
|
-
puts "ARGS #{args}"
|
5
3
|
render section: "RBCM starting", first: true
|
4
|
+
args = Hash[ argv.join(' ').scan(/--?([^=\s]+)(?:[=\s](\S+))?/) ]
|
5
|
+
render :args, content: args
|
6
6
|
# bootstrap
|
7
7
|
@rbcm = rbcm = RBCM.new argv[0] || `pwd`.chomp
|
8
8
|
render :project
|
@@ -38,7 +38,11 @@ class CLI
|
|
38
38
|
|
39
39
|
def check action
|
40
40
|
@action = action
|
41
|
-
|
41
|
+
if action.class == Action::Command
|
42
|
+
render checking: action.check.join("; ") if action.checkable?
|
43
|
+
elsif action.class == Action::File
|
44
|
+
render checking: action.job.params[0]
|
45
|
+
end
|
42
46
|
action.check!
|
43
47
|
end
|
44
48
|
|
@@ -46,7 +50,6 @@ class CLI
|
|
46
50
|
[actions].flatten(1).each do |action|
|
47
51
|
@action = action
|
48
52
|
render :title, color: (action.obsolete ? :green : :yellow)
|
49
|
-
#render :command if action.class == Action::Command
|
50
53
|
next if not action.approvable?
|
51
54
|
render :siblings if action.siblings.any?
|
52
55
|
render :source if action.source.flatten.compact.any?
|
@@ -71,21 +74,27 @@ class CLI
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
|
-
def render element=nil, section: nil, color: nil, first: false, response: nil, checking: nil
|
77
|
+
def render element=nil, section: nil, color: nil, first: false, response: nil, checking: nil, content: nil
|
75
78
|
prefix = "┃ "
|
76
79
|
if section
|
77
80
|
out "#{first ? nil : "┗━━──"}\n\n┏━━#{format :invert, :bold}#{" "*16}#{section}#{" "*16}#{format}━──\n┃"
|
81
|
+
elsif element == :args
|
82
|
+
out "#{prefix}ARGUMENTS #{content.to_s}"
|
78
83
|
elsif element == :title
|
79
84
|
triggerd_by = "#{format :trigger, :bold} #{@action.triggered_by.join(", ")} " if @action.triggered_by.any?
|
80
85
|
tags = "#{format :tag}#{"tags: " if @action.tags.any?}#{@action.tags.join(", ")}#{format}"
|
81
86
|
out "┣━ #{triggerd_by}#{format color, :bold} #{@action.chain.flatten.compact.join(" > ")} #{format} #{tags}" +
|
82
87
|
"\n#{prefix}#{format}#{format :params}#{@action.job.params if @action.job}#{format}"
|
83
88
|
elsif element == :capabilities
|
84
|
-
out prefix + "capabilities: #{Node::Sandbox.capabilities.join(", ")}"
|
85
89
|
elsif element == :project
|
86
|
-
|
87
|
-
|
90
|
+
([@rbcm.project] + @rbcm.project.all_addons).each do |project|
|
91
|
+
out "┣━ #{project.class}#{" #{project.type}: #{project.name}" if project.class == Addon}"
|
92
|
+
out prefix + "#{project.files.count} ruby files, #{project.templates.count} templates #{project.directories.count} directories, #{project.other.count} other files"
|
93
|
+
out prefix + "capabilities: #{project.capabilities.join(", ")}"
|
94
|
+
out prefix + "templates: #{project.templates.each.clean_path.join(", ")}"
|
95
|
+
end
|
88
96
|
elsif element == :nodes
|
97
|
+
out "┣━ NODES #{@rbcm.nodes.count}"
|
89
98
|
out prefix + @rbcm.nodes.values.collect{ |node|
|
90
99
|
name = node.name.to_s.+(":").ljust(@rbcm.nodes.keys.each.length.max+1, " ")
|
91
100
|
jobs = node.jobs.count.to_s.rjust(@rbcm.nodes.values.collect{|node| node.jobs.count}.max.digits.count, " ")
|
@@ -110,7 +119,7 @@ class CLI
|
|
110
119
|
"triggered: #{format :trigger} #{@action.triggered.join(", ")} \e[0m;" +
|
111
120
|
" again: #{@action.trigger.-(@action.triggered).join(", ")}"
|
112
121
|
elsif element == :diff
|
113
|
-
out prefix
|
122
|
+
out prefix + Diffy::Diff.new(
|
114
123
|
@action.job.node.files[@action.path].content,
|
115
124
|
@action.content
|
116
125
|
).to_s(:color).split("\n").join("\n#{prefix[0..-2]}")
|
data/app/lib/params.rb
CHANGED
@@ -20,7 +20,7 @@ class Params
|
|
20
20
|
"#{param}"
|
21
21
|
},
|
22
22
|
named.collect{ |k, v|
|
23
|
-
"\e[2m\e[1m#{k}:\e[21m\e[22m #{v[0..
|
23
|
+
"\e[2m\e[1m#{k}:\e[21m\e[22m #{v.to_s[0..54].gsub("\n"," \\ ")}#{"\e[2m\e[1m…\e[21m\e[22m" if v.to_s.length > 54}"
|
24
24
|
}
|
25
25
|
].flatten(1).join("\e[2m\e[1m, \e[21m\e[22m")
|
26
26
|
end
|
data/app/node/file.rb
CHANGED
@@ -8,7 +8,7 @@ class Node::NodeFile
|
|
8
8
|
|
9
9
|
def content
|
10
10
|
@content ||= (
|
11
|
-
log "DOWNLOADING #{@filesystem.node.name}: '#{@path}'"
|
11
|
+
# log "DOWNLOADING #{@filesystem.node.name}: '#{@path}'"
|
12
12
|
response = @filesystem.node.remote.execute("cat '#{@path}'")
|
13
13
|
response = "" if response.exitstatus != 0
|
14
14
|
response
|
data/app/node/sandbox.rb
CHANGED
@@ -106,6 +106,8 @@ class Node::Sandbox
|
|
106
106
|
params: Params.new([path], named),
|
107
107
|
state: @cache.collect{|k,v| [k, v.dup]}.to_h
|
108
108
|
)
|
109
|
+
run "chmod #{named[:mode]} #{path}",
|
110
|
+
check: "stat -c '%a' * #{path} | grep -q #{named[:mode]}" if named[:mode]
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
data/app/project/project.rb
CHANGED
data/app/rbcm.rb
CHANGED
@@ -60,13 +60,13 @@ class RBCM
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def parse
|
63
|
-
|
63
|
+
# parsing nodes
|
64
64
|
nodes.values.each.parse
|
65
|
-
|
65
|
+
# parsing additions
|
66
66
|
nodes.values.each do |node|
|
67
67
|
node.sandbox.evaluate node.additions
|
68
68
|
end
|
69
|
-
|
69
|
+
# parsing 'cap!'
|
70
70
|
nodes.values.each do |node|
|
71
71
|
node.capabilities.each{|capability| node.sandbox.send "#{capability.name}!"}
|
72
72
|
end
|