gclouder_undefined_resources 0.3.0 → 0.3.1

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: 40af15953719621949d13f39d2bee5d890ae2a55
4
- data.tar.gz: b61d2d60aacd5c5023930fb938b7aaae13a3fcb2
3
+ metadata.gz: 6f77332989bb3d36e465dad1f4a13ff6bca51a8d
4
+ data.tar.gz: 6bacef5eff72edea0528d8aa238ec4804fb48ef0
5
5
  SHA512:
6
- metadata.gz: 0cc34cdf89b64dfd75373010e14855b93aedb832cef7f8aed4115c45f1fc3fe841d2392477023a2f37cb0ec54325a238e6c7c5071a53ecf25fcb6f71821e4f5a
7
- data.tar.gz: 8acc4dd94d2748f4608b5919b845a4dc7e0bb10d7c874650d7f9e63a3db493c3fd0f0da208a98b7baeb5875420df07df0e8ae412d36efb9190553026ebdf7b90
6
+ metadata.gz: 488372d684f5562b201b5604d084d5eefb6497032863bfaf12d6c9c8e860ee0dca8489a6a68f7b80b9f33b04888bcca32c45778fd4d612bf94a1b4cc98787eb0
7
+ data.tar.gz: 5622e9a870a3c7a30b4513a145bfda618d3e63104d1f7a2e6f03875e563e9941b984aace2dc083169f61c33d624287cb71c0524564138b17ca8fe98db8ef4486
@@ -63,8 +63,8 @@ module GClouderUndefinedResources
63
63
  end
64
64
  end
65
65
 
66
+ # display: region, zone, type, name
66
67
  def display_by_location
67
- # display: region, zone, type, name
68
68
  regions = @resources.group_by { |resource| resource.region }
69
69
 
70
70
  regions.each do |region, resources_by_region|
@@ -20,11 +20,20 @@ module GClouderUndefinedResources
20
20
  def_delegator :@data, :[]
21
21
 
22
22
  def region
23
+ # if location is set and its "global" then return..
24
+ return if (@data.key?("location") && @data["location"] == "global")
25
+
26
+ #match = @data["location"].downcase if @data.key?("location") && !match[1]
27
+ puts @data["location"] if @data.key?("location")
28
+
29
+ # if no selfLink exists then it's not possible to establish the region
23
30
  return unless @data.key?("selfLink")
31
+
32
+ # establish region from from selfLink
24
33
  match = @data["selfLink"].match(/.*\/regions\/([^\/]+)/)
25
- match = @data["location"].downcase if @data.key?("location") && !match[1]
26
- return unless @data.key?("location") && @data["location"] == "global"
27
34
  return match[1] if match
35
+
36
+ # if region cant be established but a zone exists, then take region from zone string
28
37
  zone[0..-3] if zone
29
38
  end
30
39
 
@@ -36,7 +45,7 @@ module GClouderUndefinedResources
36
45
 
37
46
  def global?
38
47
  return true if zone.nil? && region.nil?
39
- return true if @data.key?("location") && @data["location"] == "global"
48
+ #return true if @data.key?("location") && @data["location"] == "global"
40
49
  return unless @data.key?("selfLink")
41
50
  !@data["selfLink"].match(/.*\/projects\/[^\/]+\/global/).nil?
42
51
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module GClouderUndefinedResources
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
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.3.0
4
+ version: 0.3.1
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-09 00:00:00.000000000 Z
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop