OSDN Git Service

adds the drillbook::attribute_type_test recipe.
authorwhitestar <whitestar@gaea.test>
Mon, 30 Jan 2017 13:42:51 +0000 (22:42 +0900)
committerwhitestar <whitestar@gaea.test>
Mon, 30 Jan 2017 13:42:51 +0000 (22:42 +0900)
cookbooks/drillbook/attributes/default.rb
cookbooks/drillbook/recipes/attribute_type_test.rb [new file with mode: 0644]
roles/drillbook.rb

index 739ed0d..0f7cacc 100644 (file)
 #
 
 # Attribute Tests
+default['drillbook']['type'] = {
+  'Fixnum'    => 1,
+  'String'    => 'String',
+  'Symbol'    => :Symbol,
+  'TrueClass' => true,
+  'Array'     => ['Array'],
+  'Hash'      => { 'key' => 'value' },
+}
+
 [
   [1,  default],
   [5,  force_default],
diff --git a/cookbooks/drillbook/recipes/attribute_type_test.rb b/cookbooks/drillbook/recipes/attribute_type_test.rb
new file mode 100644 (file)
index 0000000..88f168a
--- /dev/null
@@ -0,0 +1,28 @@
+#
+# Cookbook Name:: drillbook
+# Recipe:: attribute_type_test
+#
+# Copyright 2017, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+result = "Attribute Type Test\n"
+node['drillbook']['type'].each {|key, value|
+  result += "#{key}: #{value.class}\n"
+}
+
+log result
+
+symbol_comp = node['drillbook']['type']['Symbol'] == :Symbol
+log "symbol_comp: #{symbol_comp}"
index 76f5db4..7d7542e 100644 (file)
@@ -5,6 +5,7 @@ run_list(
   'recipe[drillbook::default]',
   'recipe[drillbook::guard_test]',
   'recipe[drillbook::attribute_test]',
+  'recipe[drillbook::attribute_type_test]',
 )
 
 #env_run_lists()