serverkit 0.2.2 → 0.2.3

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: b3236f3d4ad0dbab87e87f35c9afbdb165591f1c
4
- data.tar.gz: 3374bf2a87f000bf63358af4b5e40dc0051d086a
3
+ metadata.gz: e5b26c6d22c758ec66cc5435e50d8289c591da71
4
+ data.tar.gz: 3324355b6866cbff2a99117b0643449617f54eb0
5
5
  SHA512:
6
- metadata.gz: 163de635af19fdffa01010cf04c8bce58a5876789343a265aa0d641e60e1b04e8037840df5729c89ddf03dd57e34552a3a48a70379beefdec2782600b7a2a533
7
- data.tar.gz: 8866a193ae71db7d4f97bf71e01258f8ff04f615a0392ba6177abcfd2bb85e876fb84e9d1e421d501d082c79339533aa9b63b70365d1e3793f619fa75aeeb536
6
+ metadata.gz: 5a7e75d9406ddfc9266015b7cf210bf25069bc5142747f06e99bb51ee72c3df1342ed644d099114fd9354c05e82a6ea3bc396a33d4d7d1c3deb11ab78a248052
7
+ data.tar.gz: 50816a5d8ad6bccadf3e1359edc4a3d4c0280cbcb72231be70bd6aa2dc6873c6d30692b134da1f146f8a97ad2ad35b72ac38ed58317b42b847722362440f19f9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.3
2
+ - Support multiple types on TypeValidator
3
+ - Fix validation bug on missing type resource
4
+
1
5
  ## 0.2.2
2
6
  - Change action name: `serverkit diff` -> `serverkit check`
3
7
  - Load gems from Gemfile before running action
data/README.md CHANGED
@@ -169,6 +169,8 @@ A resource must have a type property. Currently the following types are availabl
169
169
  - recipe
170
170
  - service
171
171
  - symlink
172
+ - [defaults](https://github.com/r7kamura/serverkit-defaults)
173
+ - [rbenv_ruby](https://github.com/r7kamura/serverkit-rbenv)
172
174
 
173
175
  ### Example
174
176
  An example package resource that has id, type, and name attributes.
@@ -5,7 +5,7 @@ module Serverkit
5
5
  class MissingActionNameArgumentError < Base
6
6
  # @return [String]
7
7
  def to_s
8
- abort "Missing action name argument"
8
+ "Missing action name argument"
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Serverkit
5
5
  class MissingRecipePathArgumentError < Base
6
6
  # @return [String]
7
7
  def to_s
8
- abort "Missing recipe path argument"
8
+ "Missing recipe path argument"
9
9
  end
10
10
  end
11
11
  end
@@ -39,7 +39,9 @@ module Serverkit
39
39
 
40
40
  # @return [String] (e.g. "File", "Symlink")
41
41
  def resource_class_name
42
- type.camelize
42
+ if type.is_a?(String)
43
+ type.camelize
44
+ end
43
45
  end
44
46
 
45
47
  # @note Expected to return String in normal case
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -6,8 +6,9 @@ class TypeValidator < ActiveModel::EachValidator
6
6
  end
7
7
 
8
8
  def validate_each(record, attribute, value)
9
- unless value.is_a?(options[:with])
10
- record.errors.add(attribute, "must be a #{options[:with]}, not #{value.class}")
9
+ classes = options[:in] || [options[:with]]
10
+ if classes.all? { |klass| !value.is_a?(klass) }
11
+ record.errors.add(attribute, "must be a #{classes.join(' or ')}, not a #{value.class}")
11
12
  end
12
13
  end
13
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -251,4 +251,3 @@ signing_key:
251
251
  specification_version: 4
252
252
  summary: Configuration management toolkit for IT automation.
253
253
  test_files: []
254
- has_rdoc: