ansible_spec 0.2.17 → 0.2.18

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: baff775dd82d3fa1555008475cbbb7ea8a939b11
4
- data.tar.gz: bd4eb48292c5c2353d23f58afd5d68eb37fd9007
3
+ metadata.gz: ab3d19e55721a01afceeab9daea2095ecf7db535
4
+ data.tar.gz: 8ff233d19dd55ea99e7e42a312f9332d7e0afa9d
5
5
  SHA512:
6
- metadata.gz: ddaefbc6f737b5595eaa7d421aa8c296f2c9daaa233c5b858ef6994a87b2c643612a31baccd6ff2ff3ed6143d3e911c459ff859b670ce9d449b770d0562ab09b
7
- data.tar.gz: 73c7d5967c18f2ae82bddc6fda33a256ea8e76d287e88d3d84eeeb6c810e7582654600f96ddbb946afbbd1585c0fc1267758bbe25e505b0184b9deec75816642
6
+ metadata.gz: 0cbb81807e2721fb1d241e9aeb4b1f642ecac773c5a334abe1f7f343b2344cd1f50b9c95bfc8d02091c1f6b02398ff8e4bf9483dd602b629a32bba664ba6ee1d
7
+ data.tar.gz: 0d33e6b56cd6968726e37203ff53d62b49ca03cb4e447acbae03c0394a1a88226a96846e929cf4062c7b96a8a6d2c2f0b5744ce80b2521cbae4d8b0c1ddd6cc4
@@ -1,3 +1,6 @@
1
+ # v0.2.18
2
+ - Merge [#96 Handle roles_path for role dependencies as well](https://github.com/volanja/ansible_spec/pull/96) by [agx](https://github.com/agx)
3
+
1
4
  # v0.2.17
2
5
  - Merge [#90 Check if all array elements have a name](https://github.com/volanja/ansible_spec/pull/90) by [agx](https://github.com/agx)
3
6
  - Merge [#91 Parse roledirs from ansible.cfg](https://github.com/volanja/ansible_spec/pull/91) by [agx](https://github.com/agx)
@@ -196,12 +196,12 @@ module AnsibleSpec
196
196
 
197
197
  # param: role
198
198
  # return: ["role1", "role2"]
199
- def self.load_dependencies(role)
199
+ def self.load_dependencies(role, rolepath='roles')
200
200
  role_queue = [role]
201
201
  deps = []
202
202
  until role_queue.empty?
203
203
  role = role_queue.pop()
204
- path = File.join("./", "roles", role, "meta", "main.yml")
204
+ path = File.join(rolepath, role, "meta", "main.yml")
205
205
 
206
206
  if File.exist?(path)
207
207
  dependencies = YAML.load_file(path).fetch("dependencies", [])
@@ -1,3 +1,3 @@
1
1
  module AnsibleSpec
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
@@ -34,8 +34,13 @@ namespace :serverspec do
34
34
 
35
35
  roles = property["roles"]
36
36
  for role in property["roles"]
37
- deps = AnsibleSpec.load_dependencies(role)
38
- roles += deps
37
+ for rolepath in cfg.roles_path
38
+ deps = AnsibleSpec.load_dependencies(role, rolepath)
39
+ if deps != []
40
+ roles += deps
41
+ break
42
+ end
43
+ end
39
44
  end
40
45
  t.pattern = '{' + cfg.roles_path.join(',') + '}/{' + roles.join(',') + '}/spec/*_spec.rb'
41
46
  end
@@ -87,3 +87,26 @@ EOF
87
87
  File.delete(tmp_webapp_meta)
88
88
  end
89
89
  end
90
+
91
+ describe "load_dependencies from alternative dir" do
92
+ tmp_webapp_meta = 'more_roles/webapp/meta/main.yml'
93
+
94
+ webapp_meta_content = <<'EOF'
95
+ ---
96
+ dependencies:
97
+ - foo
98
+ EOF
99
+
100
+ before do
101
+ create_file(tmp_webapp_meta, webapp_meta_content)
102
+ @deps = AnsibleSpec.load_dependencies("webapp", "more_roles")
103
+ end
104
+
105
+ it 'should correctly resolve deps in additional role dirs' do
106
+ expect(@deps).to eq ["foo"]
107
+ end
108
+
109
+ after do
110
+ File.delete(tmp_webapp_meta)
111
+ end
112
+ end
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.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - volanja
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler