itamae 1.1.22 → 1.1.23

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: 7efcc0396e05beaf599275ab88cf1b20ed65d47a
4
- data.tar.gz: 9edcaac351f83ffbb98eef6cad3a1d195c0cb7c3
3
+ metadata.gz: 877cf46f9675f8b9b8e9615cef0c1c7154bbe0fa
4
+ data.tar.gz: 8c7c8e3e409bb88f83b2178c111c4996038a4258
5
5
  SHA512:
6
- metadata.gz: 16b5b28f6080716683a502e8cb80be696fa3f92a6041741856fb0636a246eae76af79660f281c57deac34745864b29514c054d0df68378da81ca9c0eebf7542e
7
- data.tar.gz: 76977772addd4da398b207f28e6be09cbfe59bdf9be33289b906c93e45e4f8171771eb1edfbb28d3dbd8b4e067b817e937902bb88e08fd5088db7d007ccfde1f
6
+ metadata.gz: 917ad0313c47117455810ceccea1465f94e130f5af055efeaab40c9d088a735102d03888e458ca0426f46365ea97f934a2e9e88f00229e2a52899793009f5b8c
7
+ data.tar.gz: 39c6aea9db965e4d8471bdf668173d1d05cc9b99c8c44cf2e4c9ef18d6ec158cb280563933ad53ada836e44b0df735d6e44fd0913ebc4e50f84ac74c103e93d1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.1.23
2
+
3
+ Feature
4
+
5
+ - Validate node attributes by `Node#validate!`
6
+
1
7
  ## v1.1.22
2
8
 
3
9
  Improvements
data/itamae.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "specinfra", ">= 2.18.2"
22
22
  spec.add_runtime_dependency "hashie"
23
23
  spec.add_runtime_dependency "ansi"
24
+ spec.add_runtime_dependency "schash", "~> 0.1.0"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.3"
26
27
  spec.add_development_dependency "rake"
data/lib/itamae/node.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'itamae'
2
2
  require 'hashie'
3
3
  require 'json'
4
+ require 'schash'
4
5
 
5
6
  module Itamae
6
7
  class Node < Hashie::Mash
8
+ ValidationError = Class.new(StandardError)
9
+
7
10
  def reverse_merge(other_hash)
8
11
  Hashie::Mash.new(other_hash).merge(self)
9
12
  end
@@ -23,6 +26,16 @@ module Itamae
23
26
  end
24
27
  val
25
28
  end
29
+
30
+ def validate!(&block)
31
+ errors = Schash::Validator.new(&block).validate(self)
32
+ unless errors.empty?
33
+ errors.each do |error|
34
+ Logger.error "'#{error.position.join('->')}' #{error.message}"
35
+ end
36
+ raise ValidationError
37
+ end
38
+ end
26
39
  end
27
40
  end
28
41
 
@@ -16,6 +16,13 @@ module Itamae
16
16
  end
17
17
  end
18
18
 
19
+ def show_differences
20
+ current.mode = current.mode.rjust(4, '0') if current.mode
21
+ attributes.mode = attributes.mode.rjust(4, '0') if attributes.mode
22
+
23
+ super
24
+ end
25
+
19
26
  def set_current_attributes
20
27
  exist = run_specinfra(:check_file_is_directory, attributes.path)
21
28
  current.exist = exist
@@ -1 +1 @@
1
- 1.1.22
1
+ 1.1.23
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.22
4
+ version: 1.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: schash
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement