gclouder_undefined_resources 0.2.5 → 0.3.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40af15953719621949d13f39d2bee5d890ae2a55
|
4
|
+
data.tar.gz: b61d2d60aacd5c5023930fb938b7aaae13a3fcb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cc34cdf89b64dfd75373010e14855b93aedb832cef7f8aed4115c45f1fc3fe841d2392477023a2f37cb0ec54325a238e6c7c5071a53ecf25fcb6f71821e4f5a
|
7
|
+
data.tar.gz: 8acc4dd94d2748f4608b5919b845a4dc7e0bb10d7c874650d7f9e63a3db493c3fd0f0da208a98b7baeb5875420df07df0e8ae412d36efb9190553026ebdf7b90
|
@@ -98,7 +98,8 @@ module GClouderUndefinedResources
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def display_report
|
101
|
-
status_types = @resources.group_by { |resource| resource.
|
101
|
+
status_types = @resources.group_by { |resource| resource.status_and_description }
|
102
|
+
status_types = status_types.sort_by { |_, resources| resources.length }
|
102
103
|
|
103
104
|
return if status_types.empty?
|
104
105
|
|
@@ -106,7 +107,7 @@ module GClouderUndefinedResources
|
|
106
107
|
puts " report"
|
107
108
|
puts
|
108
109
|
status_types.each do |status_type, resources|
|
109
|
-
puts " #{status_type} - #{resources.length}"
|
110
|
+
puts " #{status_type[0]} - #{resources.length} - #{status_type[1]}"
|
110
111
|
end
|
111
112
|
puts
|
112
113
|
end
|
@@ -95,29 +95,71 @@ module GClouderUndefinedResources
|
|
95
95
|
false
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
def custom_marker?(type)
|
99
|
+
filter.key?("marker")
|
100
|
+
end
|
101
|
+
|
102
|
+
def marker(marker, type)
|
103
|
+
if filters.dig("markers", marker.to_s).nil?
|
104
|
+
raise StandardError, "undefined marker type: #{marker}"
|
105
|
+
end
|
106
|
+
|
107
|
+
if filters.dig("markers", marker.to_s, type.to_s).nil?
|
108
|
+
raise StandardError, "undefined type for marker '#{marker}': #{type}"
|
109
|
+
end
|
110
|
+
|
111
|
+
if filters.dig("markers", marker.to_s, type.to_s, "description")
|
112
|
+
description = filters["markers"][marker.to_s][type.to_s]["description"]
|
113
|
+
else
|
114
|
+
description = nil
|
115
|
+
end
|
116
|
+
|
117
|
+
symbol = filters["markers"][marker.to_s][type.to_s]["symbol"]
|
118
|
+
colour = filters["markers"][marker.to_s][type.to_s]["colour"]
|
119
|
+
|
120
|
+
[symbol.send(colour), description]
|
121
|
+
end
|
122
|
+
|
99
123
|
def status
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
124
|
+
status_and_description[0]
|
125
|
+
end
|
126
|
+
|
127
|
+
def filter_description
|
128
|
+
description = status_and_description[1]
|
129
|
+
if description
|
130
|
+
"# #{description}".gray
|
131
|
+
else
|
132
|
+
"# filter has no description".gray
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def status_and_description
|
137
|
+
if self.defined? && !self.filtered?
|
138
|
+
return marker(:unfiltered_default, :defined)
|
139
|
+
end
|
140
|
+
|
141
|
+
if !self.defined? && !self.filtered?
|
142
|
+
return marker(:unfiltered_default, :undefined)
|
143
|
+
end
|
144
|
+
|
145
|
+
if self.defined? && self.filtered?
|
146
|
+
if custom_marker?(:defined)
|
147
|
+
return marker(filter["marker"], :defined)
|
107
148
|
else
|
108
|
-
|
109
|
-
filter["mark"]["unfiltered"]["symbol"].send(filter["mark"]["unfiltered"]["colour"])
|
110
|
-
else
|
111
|
-
Symbols.x_filtered
|
112
|
-
end
|
149
|
+
return marker(:filtered_default, :defined)
|
113
150
|
end
|
114
|
-
|
115
|
-
|
116
|
-
|
151
|
+
end
|
152
|
+
|
153
|
+
if !self.defined? && self.filtered?
|
154
|
+
if custom_marker?(:undefined)
|
155
|
+
return marker(filter["marker"], :undefined)
|
117
156
|
else
|
118
|
-
|
157
|
+
return marker(:filtered_default, :undefined)
|
119
158
|
end
|
120
159
|
end
|
160
|
+
|
161
|
+
# shouldn't reach this
|
162
|
+
raise StandardError, "there was a problem establishing resource state"
|
121
163
|
end
|
122
164
|
|
123
165
|
def filter
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gclouder_undefined_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|