bosh-workspace 0.8.1 → 0.8.2

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: 6fb508481c57fa872d5d518608450a9c0747307a
4
- data.tar.gz: 7fe9a93d76ec7097a551c994d683aa1d8c74811f
3
+ metadata.gz: 290b3ecf5a7051d219af45ab33a538491527f1a3
4
+ data.tar.gz: 1d7cc914221bbacb25461533a5f5eca4083b6267
5
5
  SHA512:
6
- metadata.gz: 7251cdc365208e92f87eeb8a3166a773b6fbf28de55cb1673b42d95100c6e12572859f79a1b6fe5b18afaf2deb07635a88d3a32eacd49b2ebcc293a6e5b5f290
7
- data.tar.gz: 20096fa74e4f9c1676999cc5701bd83ae99653a3d7f6b5b26c2dc10d2ec385da0c884c4cda21f15abe66f5a69a358d24e7c61bccd54dccf74cc2fc3a13ec6817
6
+ metadata.gz: dcdb19410a9cc91a8d8d1aa8ab97b2a092e45e16e6dd856203584221722220428bbbf595cf89d904f2745c9a6addaa9ac043cb0584cbafb6443bd491aac815be
7
+ data.tar.gz: 6033879b801cdcaa201e3d526ce0bb2eb2782ff9c7b5ebfe50d80b91870e94891e7af5d888e6c1f8fdb8c5a497f84b56389b0792081dfd62023dbdd2e8ed3da0
@@ -13,12 +13,21 @@ module Bosh::Workspace
13
13
  }
14
14
  end
15
15
 
16
- STEMCELL_VERSION = /^\d+\.\d+$/
16
+ class StemcellVersionValidator < Membrane::Schemas::Base
17
+ def validate(object)
18
+ return if object.is_a? Integer
19
+ return if object.is_a? Float
20
+ return if object == "latest"
21
+ return if object.to_s =~ /^\d+\.\d+$/
22
+ raise Membrane::SchemaValidationError.new(
23
+ "Should match: latest, version.patch or version. Given: #{object}")
24
+ end
25
+ end
17
26
 
18
27
  STEMCELL_SCHEMA = Membrane::SchemaParser.parse do
19
28
  {
20
29
  "name" => String,
21
- "version" => enum(Integer, STEMCELL_VERSION, "latest"),
30
+ "version" => StemcellVersionValidator.new
22
31
  }
23
32
  end
24
33
 
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Manifests
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
  end
5
5
  end
@@ -123,18 +123,25 @@ describe Bosh::Workspace::ProjectDeployment do
123
123
  it { should_not match(/version/i) }
124
124
  end
125
125
 
126
- context "patch version" do
126
+ context "patch version string" do
127
127
  let(:missing) { "name" }
128
128
  let(:stemcell_version) { "2719.1" }
129
129
  it { should match(/name.*missing/i) }
130
130
  it { should_not match(/version/i) }
131
131
  end
132
132
 
133
+ context "patch version float" do
134
+ let(:missing) { "name" }
135
+ let(:stemcell_version) { 2719.1 }
136
+ it { should match(/name.*missing/i) }
137
+ it { should_not match(/version/i) }
138
+ end
139
+
133
140
  context "invalid version" do
134
141
  let(:missing) { "name" }
135
142
  let(:stemcell_version) { "foo" }
136
143
  it { should match(/name.*missing/i) }
137
- it { should match(/version.*doesn't validate/i) }
144
+ it { should match(/version.*should match/i) }
138
145
  end
139
146
  end
140
147
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-workspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Koster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-01 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_cli