ansible_spec 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e860c7053344a34b1907264a715ae6336dd5f6ac
4
- data.tar.gz: ef8fac0266f20909ec8aabb7488ff603607fdbe6
3
+ metadata.gz: d5c5766164945b71de78de3396370ec97e4e15b4
4
+ data.tar.gz: 9d492a8f97f9ca39f75c7ff5976ed50f25165ba6
5
5
  SHA512:
6
- metadata.gz: cf7f29b8d481259c395eff714155b7d1280d37dd3c7c966e85c56fa26f0b7c6349ecad7c14822692c5b6643542580e5365f6ccb6c618a80c5cd25ba6e984388b
7
- data.tar.gz: a11ff18b9e6dba65082e862d9470dec01e24b553f14d6d0e617d90c77502befa4486f2d9bccec3429aba6b91134403f847a22ac2e738fd08d9d6b3b519166821
6
+ metadata.gz: 10a085f6d9032b544180a6f63e1d016e085397b84d750787afe99aa7ae7aae769af2213120b676a0199e56dc693075104c399b6c051e8e1d61daeae343912a62
7
+ data.tar.gz: 612a7cc90293e939587e5c5f5f962c3409a9bc012304eff5196dd754d5a14c71bb41a54c870a2cbdd2b855f5d56aea7af0d3e8575af37bfbd293b6070b26fbed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
+ # v0.2.3
2
+ - Fix [#47 NoMethodError: undefined method 'each' for nil:NilClass if inventory has "roles"=>[]](https://github.com/volanja/ansible_spec/issues/47) by [phiche](https://github.com/phiche)
3
+
4
+ # v0.2.2
5
+ - Fix [#43 Enable to set only either of `PLAYBOOK` or `INVENTORY`.](https://github.com/volanja/ansible_spec/issues/43) by [akagisho](https://github.com/akagisho)
6
+ - Fix [#45 ansible_spec cannot use ec2.py dynamic inventory](https://github.com/volanja/ansible_spec/issues/45) by [phiche](https://github.com/phiche)
7
+
1
8
  # v0.2.1
2
- - fix #27 check name on playbook
9
+ - fix [#27 check name on playbook](https://github.com/volanja/ansible_spec/issues/27)
3
10
  - Add Test
4
11
  - 2.1.6
5
12
  - 2.2.2
@@ -10,7 +17,7 @@
10
17
  - 2.2.1
11
18
 
12
19
  # v0.2
13
- - fix #24 Support ENV
20
+ - fix [#24 Support ENV](https://github.com/volanja/ansible_spec/issues/24)
14
21
 
15
22
  ```
16
23
  Example:
@@ -19,7 +26,7 @@ $ PLAYBOOK=site.yml INVENTORY=hosts rake serverspec:Ansible-Sample-TDD
19
26
 
20
27
  # v0.1.1
21
28
 
22
- fix #22
29
+ fix [#22 NameError: uninitialized constant AnsibleSpec::Open3](https://github.com/volanja/ansible_spec/issues/22)
23
30
 
24
31
 
25
32
  # v0.1
data/README.md CHANGED
@@ -62,6 +62,10 @@ Example:
62
62
 
63
63
  ```
64
64
  $ PLAYBOOK=site.yml INVENTORY=hosts rake serverspec:Ansible-Sample-TDD
65
+ or
66
+ $ PLAYBOOK=site.yml rake serverspec:Ansible-Sample-TDD
67
+ or
68
+ $ INVENTORY=hosts rake serverspec:Ansible-Sample-TDD
65
69
  ```
66
70
 
67
71
  ## Inventory
@@ -194,17 +194,19 @@ module AnsibleSpec
194
194
  # flatten roles (Issue 29)
195
195
  # param: Array
196
196
  # e.g. ["nginx"]
197
- # e.g. [{"roles"=>"nginx"}]
197
+ # e.g. [{"role"=>"nginx"}]
198
198
  # e.g. [{"role"=>"nginx", "dir"=>"/opt/b", "port"=>5001}]
199
199
  # return: Array
200
200
  # e.g.["nginx"]
201
201
  def self.flatten_role(roles)
202
202
  ret = Array.new
203
- roles.each do |role|
204
- if role.is_a?(String)
205
- ret << role
206
- elsif role.is_a?(Hash)
207
- ret << role["role"] if role.has_key?("role")
203
+ if roles
204
+ roles.each do |role|
205
+ if role.is_a?(String)
206
+ ret << role
207
+ elsif role.is_a?(Hash)
208
+ ret << role["role"] if role.has_key?("role")
209
+ end
208
210
  end
209
211
  end
210
212
  return ret
@@ -1,3 +1,3 @@
1
1
  module AnsibleSpec
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -694,6 +694,65 @@ describe "name_exist?の実行" do
694
694
  end
695
695
  end
696
696
 
697
+
698
+ describe "flatten_roleの実行" do
699
+ context '正常系 ["nginx"]' do
700
+ before do
701
+ @res = AnsibleSpec.flatten_role(["nginx"])
702
+ end
703
+
704
+ it 'res is array' do
705
+ expect(@res.instance_of?(Array)).to be_truthy
706
+ end
707
+
708
+ it 'nginx' do
709
+ expect(@res[0]).to eq 'nginx'
710
+ end
711
+ end
712
+
713
+ context '正常系 {"role"=>"nginx"}' do
714
+ before do
715
+ @res = AnsibleSpec.flatten_role([{"role"=>"nginx"}])
716
+ end
717
+
718
+ it 'res is array' do
719
+ expect(@res.instance_of?(Array)).to be_truthy
720
+ end
721
+
722
+ it 'nginx' do
723
+ expect(@res[0]).to eq 'nginx'
724
+ end
725
+ end
726
+
727
+ context '正常系 {"role"=>"nginx", "dir"=>"/opt/b", "port"=>5001}' do
728
+ before do
729
+ @res = AnsibleSpec.flatten_role([{"role"=>"nginx", "dir"=>"/opt/b", "port"=>5001}])
730
+ end
731
+
732
+ it 'res is array' do
733
+ expect(@res.instance_of?(Array)).to be_truthy
734
+ end
735
+
736
+ it 'nginx' do
737
+ expect(@res[0]).to eq 'nginx'
738
+ end
739
+ end
740
+
741
+ context '異常系 nil' do
742
+ before do
743
+ @res = AnsibleSpec.flatten_role([])
744
+ end
745
+
746
+ it 'res is array' do
747
+ expect(@res.instance_of?(Array)).to be_truthy
748
+ end
749
+
750
+ it 'nil' do
751
+ expect(@res[0]).to eq nil
752
+ end
753
+ end
754
+ end
755
+
697
756
  describe "load_ansiblespecの実行" do
698
757
  context '正常系(環境変数PLAYBOOK)' do
699
758
  require 'yaml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_spec
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
  - volanja
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler