rbcm 0.0.10 → 0.0.11

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: ba856611e3af9f4f13e7ed546987c0033ec5a4fb0155a68a9a6edbe4a4f68c60
4
- data.tar.gz: 42545b973f0eff3689e807898579ceda9c62b3a362a9e1ad4b7e9f2a81d1e221
3
+ metadata.gz: d9edabb3d5cffb1432c1a69c840e0c1a51fc3f5303c746cc1dcfa5ed08973f21
4
+ data.tar.gz: aff2d28a1feccb2bfca5e173e09e082e4e41944b994b7138e1ffb22127269bf9
5
5
  SHA512:
6
- metadata.gz: edfdafa164f3c571b0262620c462837dfd3b9d9029667ff4ed4596284107a586775238d25ab92a5f0a6535d4e9007645c65cafaecccbc18578eeee43de367eae
7
- data.tar.gz: 6e5f2a500540299697e2a8becb9630551a04587283f0a51b72fc0b169106a2c83429b409965e85038a8ffe9cd4a5cf183daa6c01d023007da5945f368d41bef0
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
- render checking: action.check.join("; ")
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
- out prefix + "project: #{@rbcm.project.files.count} ruby files, #{@rbcm.project.templates.count} templates"
87
- out prefix + " #{@rbcm.project.directories.count} directories, #{@rbcm.project.other.count} other files"
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[0..-2] + Diffy::Diff.new(
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]}")
@@ -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..60].to_s.gsub("\n"," \\ ")}#{"\e[2m\e[1m…\e[21m\e[22m" if v.length > 60}"
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
@@ -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
@@ -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
 
@@ -62,7 +62,6 @@ class Project
62
62
  @other << file_path.sub(@path, "")
63
63
  end
64
64
  end
65
- log "templates: #{@templates.each.path}"
66
65
  else
67
66
  @files = [
68
67
  Project::ProjectFile.new(
@@ -60,13 +60,13 @@ class RBCM
60
60
  end
61
61
 
62
62
  def parse
63
- log "parsing nodes"
63
+ # parsing nodes
64
64
  nodes.values.each.parse
65
- log "parsing additions"
65
+ # parsing additions
66
66
  nodes.values.each do |node|
67
67
  node.sandbox.evaluate node.additions
68
68
  end
69
- log "parsing 'cap!'"
69
+ # parsing 'cap!'
70
70
  nodes.values.each do |node|
71
71
  node.capabilities.each{|capability| node.sandbox.send "#{capability.name}!"}
72
72
  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.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Wiegand