Grid環境構築用のChefリポジトリです。
Revisión | 2c79a3f748247d026de6eb48f36b082821275bda (tree) |
---|---|
Tiempo | 2017-01-21 15:06:35 |
Autor | whitestar <whitestar@gaea...> |
Commiter | whitestar |
adds attributes test.
@@ -0,0 +1,2 @@ | ||
1 | +~FC001 | |
2 | +~FC019 |
@@ -0,0 +1,37 @@ | ||
1 | +AllCops: | |
2 | + Exclude: | |
3 | + - vendor/**/* | |
4 | + | |
5 | +AlignParameters: | |
6 | + Enabled: false | |
7 | +LineLength: | |
8 | + Enabled: false | |
9 | +Lint/UnusedBlockArgument: | |
10 | + Enabled: false | |
11 | +Metrics/AbcSize: | |
12 | + Enabled: false | |
13 | +Style/BlockComments: | |
14 | + Enabled: false | |
15 | +Style/BlockDelimiters: | |
16 | + Enabled: false | |
17 | +Style/ExtraSpacing: | |
18 | + Enabled: false | |
19 | +Style/FileName: | |
20 | + Enabled: false | |
21 | +Style/LeadingCommentSpace: | |
22 | + Enabled: false | |
23 | +Style/RescueModifier: | |
24 | + Enabled: false | |
25 | +Style/SpaceBeforeFirstArg: | |
26 | + Enabled: false | |
27 | +Style/TrailingCommaInLiteral: | |
28 | + EnforcedStyleForMultiline: comma | |
29 | +Style/WordArray: | |
30 | + Enabled: false | |
31 | + | |
32 | +#Style/AccessorMethodName: | |
33 | +# Enabled: false | |
34 | +#Style/MethodLength: | |
35 | +# Max: 30 | |
36 | +#Style/ModuleLength: | |
37 | +# Max: 150 |
@@ -0,0 +1,23 @@ | ||
1 | +# | |
2 | +# Copyright 2017 whitestar | |
3 | +# | |
4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | +# you may not use this file except in compliance with the License. | |
6 | +# You may obtain a copy of the License at | |
7 | +# | |
8 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | +# | |
10 | +# Unless required by applicable law or agreed to in writing, software | |
11 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | +# See the License for the specific language governing permissions and | |
14 | +# limitations under the License. | |
15 | +# | |
16 | + | |
17 | +#grid_chef_repo = 'git://git.osdn.jp/gitroot/metasearch/grid-chef-repo.git' | |
18 | + | |
19 | +# for ver. 3.x | |
20 | +#source 'https://berks-api.io.example.com:6280' | |
21 | +source 'https://supermarket.chef.io' | |
22 | + | |
23 | +metadata |
@@ -1,12 +1,9 @@ | ||
1 | 1 | # CHANGELOG for drillbook |
2 | 2 | |
3 | -This file is used to list changes made in each version of drillbook. | |
3 | +0.1.1 | |
4 | +----- | |
5 | +- adds attributes test. | |
4 | 6 | |
5 | -## 0.1.0: | |
6 | - | |
7 | -* Initial release of drillbook | |
8 | - | |
9 | -- - - | |
10 | -Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. | |
11 | - | |
12 | -The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. | |
7 | +0.1.0 | |
8 | +----- | |
9 | +- Initial release of drillbook |
@@ -0,0 +1,23 @@ | ||
1 | +require 'rspec/core/rake_task' | |
2 | +require 'rubocop/rake_task' | |
3 | +require 'foodcritic' | |
4 | + | |
5 | +namespace :style do | |
6 | + desc 'Run Ruby style checks' | |
7 | + RuboCop::RakeTask.new(:ruby) | |
8 | + | |
9 | + desc 'Run Chef style checks' | |
10 | + FoodCritic::Rake::LintTask.new(:chef) do |t| | |
11 | + t.options = { | |
12 | + fail_tags: ['any'], | |
13 | + } | |
14 | + end | |
15 | +end | |
16 | + | |
17 | +desc 'Run all style checks' | |
18 | +task style: ['style:chef', 'style:ruby'] | |
19 | + | |
20 | +desc 'Run ChefSpec examples' | |
21 | +RSpec::Core::RakeTask.new(:spec) | |
22 | + | |
23 | +task default: ['style', 'spec'] |
@@ -0,0 +1,33 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: drillbook | |
3 | +# Attributes:: default | |
4 | +# | |
5 | +# Copyright 2017, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +# Attribute Tests | |
21 | +[ | |
22 | + [1, default], | |
23 | + [5, force_default], | |
24 | + [7, normal], | |
25 | + [9, override], | |
26 | + [13, force_override], | |
27 | +].each {|pos, method| | |
28 | + (pos..14).each {|num| | |
29 | + method['drillbook']["case#{num}"] = pos | |
30 | + method['drillbook']["case-array#{num}"] = [pos] | |
31 | + method['drillbook']["case-empty#{num}"] = ['initial'] if pos == 1 | |
32 | + } | |
33 | +} |
@@ -5,3 +5,5 @@ license 'Apache 2.0' | ||
5 | 5 | description 'Installs/Configures drillbook' |
6 | 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
7 | 7 | version '0.1.1' |
8 | +source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' | |
9 | +issues_url 'https://osdn.jp/projects/metasearch/ticket' |
@@ -0,0 +1,47 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: drillbook | |
3 | +# Recipe:: attribute_test | |
4 | +# | |
5 | +# Copyright 2017, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +# Attribute Tests | |
21 | +[ | |
22 | + [2, node.default], | |
23 | + [6, node.force_default], | |
24 | + [8, node.normal], | |
25 | + [10, node.override], | |
26 | + [14, node.force_override], | |
27 | +].each {|pos, method| | |
28 | + (pos..14).each {|num| | |
29 | + method['drillbook']["case#{num}"] = pos | |
30 | + method['drillbook']["case-array#{num}"] = [pos] | |
31 | + method['drillbook']["case-empty#{num}"] = [] if pos == num | |
32 | + } | |
33 | +} | |
34 | + | |
35 | +result = '' | |
36 | +result_a = '' | |
37 | +result_e = '' | |
38 | + | |
39 | +(1..14).each {|num| | |
40 | + result += "node['drillbook']['case#{num}']: " + node['drillbook']["case#{num}"].to_s + "\n" | |
41 | + result_a += "node['drillbook']['case-array#{num}']: " + node['drillbook']["case-array#{num}"].to_s + "\n" | |
42 | + result_e += "node['drillbook']['case-empty#{num}']: " + node['drillbook']["case-empty#{num}"].to_s + "\n" | |
43 | +} | |
44 | + | |
45 | +log result | |
46 | +log result_a | |
47 | +log result_e |
@@ -24,4 +24,3 @@ java_ark 'jdk' do | ||
24 | 24 | action :remove |
25 | 25 | end |
26 | 26 | =end |
27 | - |
@@ -114,4 +114,3 @@ log 'not_if true, not_if true, not_if true, only_if false' do | ||
114 | 114 | not_if { true } |
115 | 115 | only_if { false } |
116 | 116 | end |
117 | - |
@@ -0,0 +1,24 @@ | ||
1 | +name 'drillbook' | |
2 | +description 'Drillbook Test Environment' | |
3 | + | |
4 | +#cookbook_versions "couchdb" => "= 11.0.0" | |
5 | + | |
6 | +attrs = { 'drillbook' => {}, } | |
7 | +pos = 3 | |
8 | +(pos..14).each {|num| | |
9 | + attrs['drillbook']["case#{num}"] = pos | |
10 | + attrs['drillbook']["case-array#{num}"] = [pos] | |
11 | + attrs['drillbook']["case-empty#{num}"] = [] if pos == num | |
12 | +} | |
13 | + | |
14 | +default_attributes(attrs) | |
15 | + | |
16 | +attrs = { 'drillbook' => {}, } | |
17 | +pos = 12 | |
18 | +(pos..14).each {|num| | |
19 | + attrs['drillbook']["case#{num}"] = pos | |
20 | + attrs['drillbook']["case-array#{num}"] = [pos] | |
21 | + attrs['drillbook']["case-empty#{num}"] = [] if pos == num | |
22 | +} | |
23 | + | |
24 | +override_attributes(attrs) |
@@ -0,0 +1,6 @@ | ||
1 | +{ | |
2 | + "chef_environment": "drillbook", | |
3 | + "run_list": [ | |
4 | + "role[drillbook]" | |
5 | + ] | |
6 | +} |
@@ -0,0 +1,30 @@ | ||
1 | +name 'drillbook' | |
2 | +description 'Drillbook Test Role.' | |
3 | + | |
4 | +run_list( | |
5 | + 'recipe[drillbook::default]', | |
6 | + 'recipe[drillbook::guard_test]', | |
7 | + 'recipe[drillbook::attribute_test]', | |
8 | +) | |
9 | + | |
10 | +#env_run_lists() | |
11 | + | |
12 | +attrs = { 'drillbook' => {}, } | |
13 | +pos = 4 | |
14 | +(pos..14).each {|num| | |
15 | + attrs['drillbook']["case#{num}"] = pos | |
16 | + attrs['drillbook']["case-array#{num}"] = [pos] | |
17 | + attrs['drillbook']["case-empty#{num}"] = [] if pos == num | |
18 | +} | |
19 | + | |
20 | +default_attributes(attrs) | |
21 | + | |
22 | +attrs = { 'drillbook' => {}, } | |
23 | +pos = 11 | |
24 | +(pos..14).each {|num| | |
25 | + attrs['drillbook']["case#{num}"] = pos | |
26 | + attrs['drillbook']["case-array#{num}"] = [pos] | |
27 | + attrs['drillbook']["case-empty#{num}"] = [] if pos == num | |
28 | +} | |
29 | + | |
30 | +override_attributes(attrs) |