bosh-template 1.3160.0 → 1.3163.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a465225d5a46f6f041b6af16bb76b63634fc06a5
4
- data.tar.gz: 85a1a5a2cd654b411fdc32dbf7f7268f54961c0c
3
+ metadata.gz: 66e942af6e7b300cb16b77b148946fd7037b2a97
4
+ data.tar.gz: 3c1305057415a08db55d29f1b8f3496305aba731
5
5
  SHA512:
6
- metadata.gz: 27378c946b7b8f62322836cfa70f2810c6631ba96411b4d68d323689275d5bc1bf99423aa50ac943a28f8ce355918f5f54489e57ad4fc4341cec506072d9e238
7
- data.tar.gz: 3f7b6135d20617c21e1def036389e3e780e74c72f1f233c3b3a500ecfa3a5b953c14a3c7512d6c4791af325d5954a541b96b901587f782fe6c28e33a332b5a61
6
+ metadata.gz: e0f478ccdff9ca89597f9b4798325031920e066d395f89aa606f9f620e546ad2768523e333a9959cdbbdc49e07d856ff7905056f85236978c0f0680dc127453b
7
+ data.tar.gz: 8e4a0d435d05697a5ec9f4180108df608db19de6924f0574b784be7ad0a05abb55a17ab41579e486cde88265f296e02c7a0101d93ffc8fdf1b858fed9b3ce7a4
@@ -1,6 +1,7 @@
1
1
  require 'ostruct'
2
2
  require 'bosh/template/evaluation_failed'
3
3
  require 'bosh/template/unknown_property'
4
+ require 'bosh/template/unknown_link'
4
5
  require 'bosh/template/property_helper'
5
6
 
6
7
  module Bosh
@@ -42,6 +43,8 @@ module Bosh
42
43
  @spec = openstruct(spec)
43
44
  @raw_properties = spec['properties'] || {}
44
45
  @properties = openstruct(@raw_properties)
46
+
47
+ @links = spec['links'] || {}
45
48
  end
46
49
 
47
50
  # @return [Binding] Template binding
@@ -88,6 +91,13 @@ module Bosh
88
91
  raise UnknownProperty.new(names)
89
92
  end
90
93
 
94
+ def link(name)
95
+ result = lookup_property(@links, name)
96
+ return result unless result.nil?
97
+
98
+ raise UnknownLink.new(name)
99
+ end
100
+
91
101
  # Run a block of code if all given properties are defined
92
102
  # @param [Array<String>] names Property names
93
103
  # @yield [Object] property values
@@ -0,0 +1,9 @@
1
+ module Bosh
2
+ module Template
3
+ class UnknownLink < StandardError
4
+ def initialize(name)
5
+ super("Can't find link '#{name}'")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Template
3
- VERSION = '1.3160.0'
3
+ VERSION = '1.3163.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3160.0
4
+ version: 1.3163.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semi_semantic
@@ -80,6 +80,7 @@ files:
80
80
  - lib/bosh/template/evaluation_failed.rb
81
81
  - lib/bosh/template/property_helper.rb
82
82
  - lib/bosh/template/renderer.rb
83
+ - lib/bosh/template/unknown_link.rb
83
84
  - lib/bosh/template/unknown_property.rb
84
85
  - lib/bosh/template/version.rb
85
86
  homepage: https://github.com/cloudfoundry/bosh