rbcm 0.0.9 → 0.0.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/app/action/file.rb +1 -7
- data/app/action/list.rb +5 -0
- data/app/cli.rb +14 -12
- data/app/lib/params.rb +1 -1
- data/app/node/sandbox.rb +1 -11
- data/app/project/project.rb +10 -7
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba856611e3af9f4f13e7ed546987c0033ec5a4fb0155a68a9a6edbe4a4f68c60
|
4
|
+
data.tar.gz: 42545b973f0eff3689e807898579ceda9c62b3a362a9e1ad4b7e9f2a81d1e221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edfdafa164f3c571b0262620c462837dfd3b9d9029667ff4ed4596284107a586775238d25ab92a5f0a6535d4e9007645c65cafaecccbc18578eeee43de367eae
|
7
|
+
data.tar.gz: 6e5f2a500540299697e2a8becb9630551a04587283f0a51b72fc0b169106a2c83429b409965e85038a8ffe9cd4a5cf183daa6c01d023007da5945f368d41bef0
|
data/app/action/file.rb
CHANGED
@@ -24,13 +24,7 @@ class Action::File < Action
|
|
24
24
|
@content ||= if @params[:content]
|
25
25
|
@params[:content].to_s
|
26
26
|
elsif @params[:template]
|
27
|
-
|
28
|
-
# @params[:template]
|
29
|
-
# ).render context: @params[:context]
|
30
|
-
# Node::Template.new(
|
31
|
-
# name: @params[:template]
|
32
|
-
# ).render context: @params[:context]
|
33
|
-
project_file.project.templates_.for(self).render(
|
27
|
+
project_file.project.templates.for(self).render(
|
34
28
|
context: @params[:context]
|
35
29
|
)
|
36
30
|
end
|
data/app/action/list.rb
CHANGED
@@ -25,6 +25,11 @@ class ActionList < Array
|
|
25
25
|
ActionList.new select{|action| action.path == path}
|
26
26
|
end
|
27
27
|
|
28
|
+
def node node_name
|
29
|
+
return self unless node_name
|
30
|
+
ActionList.new select{|action| action.job.node.name == node_name}
|
31
|
+
end
|
32
|
+
|
28
33
|
def checkable
|
29
34
|
ActionList.new select.checkable?
|
30
35
|
end
|
data/app/cli.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
class CLI
|
2
|
-
def initialize
|
3
|
-
|
2
|
+
def initialize argv
|
3
|
+
args = Hash[ argv.join(' ').scan(/--?([^=\s]+)(?:[=\s](\S+))?/) ]
|
4
|
+
puts "ARGS #{args}"
|
4
5
|
render section: "RBCM starting", first: true
|
5
6
|
# bootstrap
|
6
|
-
@rbcm = rbcm = RBCM.new
|
7
|
+
@rbcm = rbcm = RBCM.new argv[0] || `pwd`.chomp
|
7
8
|
render :project
|
8
9
|
render :capabilities
|
9
10
|
# parse
|
@@ -11,13 +12,13 @@ class CLI
|
|
11
12
|
render :nodes
|
12
13
|
# check
|
13
14
|
render section: "CHECKING #{rbcm.actions.checkable.count} actions on #{rbcm.nodes.count} nodes"
|
14
|
-
rbcm.actions.each do |action|
|
15
|
+
rbcm.actions.node(args["node"]).each do |action|
|
15
16
|
check action
|
16
17
|
end
|
17
18
|
# approve
|
18
19
|
render section: "APPROVING #{rbcm.actions.approvable.count}/#{rbcm.actions.unneccessary.count} actions"
|
19
20
|
approve rbcm.actions.unneccessary.resolve_triggers
|
20
|
-
while action = rbcm.actions.approvable.resolve_triggers.first
|
21
|
+
while action = rbcm.actions.node(args["node"]).approvable.resolve_triggers.first
|
21
22
|
approve action
|
22
23
|
if action.approved?
|
23
24
|
approve action.siblings
|
@@ -31,7 +32,6 @@ class CLI
|
|
31
32
|
end
|
32
33
|
# finish
|
33
34
|
render :applied
|
34
|
-
puts "┗━━──"
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -46,7 +46,7 @@ class CLI
|
|
46
46
|
[actions].flatten(1).each do |action|
|
47
47
|
@action = action
|
48
48
|
render :title, color: (action.obsolete ? :green : :yellow)
|
49
|
-
render :command if action.class == Action::Command
|
49
|
+
#render :command if action.class == Action::Command
|
50
50
|
next if not action.approvable?
|
51
51
|
render :siblings if action.siblings.any?
|
52
52
|
render :source if action.source.flatten.compact.any?
|
@@ -77,9 +77,9 @@ class CLI
|
|
77
77
|
out "#{first ? nil : "┗━━──"}\n\n┏━━#{format :invert, :bold}#{" "*16}#{section}#{" "*16}#{format}━──\n┃"
|
78
78
|
elsif element == :title
|
79
79
|
triggerd_by = "#{format :trigger, :bold} #{@action.triggered_by.join(", ")} " if @action.triggered_by.any?
|
80
|
-
|
81
|
-
"#{
|
82
|
-
"
|
80
|
+
tags = "#{format :tag}#{"tags: " if @action.tags.any?}#{@action.tags.join(", ")}#{format}"
|
81
|
+
out "┣━ #{triggerd_by}#{format color, :bold} #{@action.chain.flatten.compact.join(" > ")} #{format} #{tags}" +
|
82
|
+
"\n#{prefix}#{format}#{format :params}#{@action.job.params if @action.job}#{format}"
|
83
83
|
elsif element == :capabilities
|
84
84
|
out prefix + "capabilities: #{Node::Sandbox.capabilities.join(", ")}"
|
85
85
|
elsif element == :project
|
@@ -116,7 +116,7 @@ class CLI
|
|
116
116
|
).to_s(:color).split("\n").join("\n#{prefix[0..-2]}")
|
117
117
|
elsif element == :approved
|
118
118
|
string = @action.approved? ? "#{format :green} APPROVED" : "#{format :red} DECLINED"
|
119
|
-
|
119
|
+
out "#{prefix} #{string} #{format} "
|
120
120
|
elsif element.class == String
|
121
121
|
out prefix + "#{element}"
|
122
122
|
elsif checking
|
@@ -126,7 +126,9 @@ class CLI
|
|
126
126
|
elsif element == :applied
|
127
127
|
out prefix
|
128
128
|
out "┣━\ #{format :green, :bold} #{@rbcm.actions.succeeded.count} secceeded #{format}"
|
129
|
-
out "┣━\ #{format :red, :bold} #{@rbcm.actions.failed.count} failed #{format}"
|
129
|
+
out "┣━\ #{format :red, :bold} #{@rbcm.actions.failed.count} failed #{format}" if @rbcm.actions.failed.any?
|
130
|
+
out "┗━━──"
|
131
|
+
|
130
132
|
else
|
131
133
|
end
|
132
134
|
end
|
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[0..60].to_s.gsub("\n"," \\ ")}#{"\e[2m\e[1m…\e[21m\e[22m" if v.length > 60}"
|
24
24
|
}
|
25
25
|
].flatten(1).join("\e[2m\e[1m, \e[21m\e[22m")
|
26
26
|
end
|
data/app/node/sandbox.rb
CHANGED
@@ -111,21 +111,11 @@ class Node::Sandbox
|
|
111
111
|
|
112
112
|
def dir path="", templates:, context: {}, tags: nil, trigger: nil, triggered_by: nil
|
113
113
|
__cache tags: tags, trigger: trigger, triggered_by: triggered_by, working_dirs: working_dir do
|
114
|
-
@node.rbcm.project.
|
115
|
-
# binding.pry
|
116
|
-
# sleep 1
|
114
|
+
@node.rbcm.project.templates.under("#{working_dir}/#{templates}").each do |template|
|
117
115
|
file template.clean_full_path.gsub(/#{working_dir}/),
|
118
116
|
template: template.clean_path,
|
119
117
|
context: context
|
120
118
|
end
|
121
|
-
|
122
|
-
# @node.rbcm.project.templates.select{ |template|
|
123
|
-
# /^#{working_dir}/.match? template
|
124
|
-
# }.each do |template|
|
125
|
-
# file path + template.gsub(/^#{working_dir}\/#{templates}/,"").gsub(".erb", "").gsub(".mustache", ""),
|
126
|
-
# template: template,
|
127
|
-
# context: context
|
128
|
-
# end
|
129
119
|
end
|
130
120
|
end
|
131
121
|
|
data/app/project/project.rb
CHANGED
@@ -2,15 +2,14 @@ class Project
|
|
2
2
|
def initialize path, template_engines: [:mustache, :erb], addon: false
|
3
3
|
@path = path
|
4
4
|
@files = []
|
5
|
-
@templates =
|
6
|
-
@templates_ = Project::TemplateList.new
|
5
|
+
@templates = Project::TemplateList.new
|
7
6
|
@other = []
|
8
7
|
@directories = []
|
9
8
|
@template_engines = template_engines
|
10
9
|
load_files path
|
11
10
|
end
|
12
11
|
|
13
|
-
attr_reader :path, :files, :templates, :other, :directories, :
|
12
|
+
attr_reader :path, :files, :templates, :other, :directories, :templates
|
14
13
|
|
15
14
|
def capabilities
|
16
15
|
files.each.capabilities.flatten.compact
|
@@ -53,8 +52,7 @@ class Project
|
|
53
52
|
path: file_path
|
54
53
|
)
|
55
54
|
elsif @template_engines.include? file_path.split(".").last.to_sym
|
56
|
-
@templates
|
57
|
-
@templates_.append Project::Template.new(
|
55
|
+
@templates.append Project::Template.new(
|
58
56
|
project: self,
|
59
57
|
path: file_path
|
60
58
|
)
|
@@ -64,9 +62,14 @@ class Project
|
|
64
62
|
@other << file_path.sub(@path, "")
|
65
63
|
end
|
66
64
|
end
|
67
|
-
log "templates: #{@templates}"
|
65
|
+
log "templates: #{@templates.each.path}"
|
68
66
|
else
|
69
|
-
@files = [
|
67
|
+
@files = [
|
68
|
+
Project::ProjectFile.new(
|
69
|
+
project: self,
|
70
|
+
path: path
|
71
|
+
)
|
72
|
+
]
|
70
73
|
end
|
71
74
|
raise "ERROR: empty project" unless @files.any?
|
72
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbcm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Wiegand
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.2.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: git
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.4.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.4.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|