beaker-module_install_helper 0.1.3 → 0.1.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f42bb555dae48d87cf1130b46c794a807ae06c6
|
4
|
+
data.tar.gz: f8f649a6dbadd789bd5ccce94893f65d3d05edd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d21312fee8851d74a85ea5363b8b6b93df78a9573d25cbb1c3483158563f6e65eed574b794c9fe5dc06fabfff08ac130e1f59d2ac2e9da918051b3341c8b2bfc
|
7
|
+
data.tar.gz: deb63867b68ab82b6ce302021d38dc6ee8f97b21172083cdaccb5770ea7611b0d331a9f5ee8b0b0a33c6b1ea680adb3c36654897664db33f84b2a1b7c6691eaf
|
@@ -153,7 +153,14 @@ module Beaker::ModuleInstallHelper
|
|
153
153
|
|
154
154
|
# Use this property to store the module_source_dir, so we don't traverse
|
155
155
|
# the tree every time
|
156
|
-
def get_module_source_directory(
|
156
|
+
def get_module_source_directory(call_stack)
|
157
|
+
matching_caller = call_stack.select { |i| i =~ /(spec_helper_acceptance|_spec)/i }
|
158
|
+
|
159
|
+
raise 'Error finding module source directory' if matching_caller.empty?
|
160
|
+
|
161
|
+
matching_caller = matching_caller[0] if matching_caller.is_a?(Array)
|
162
|
+
search_in = matching_caller[/[^:]+/]
|
163
|
+
|
157
164
|
module_source_dir = nil
|
158
165
|
# here we go up the file tree and search the directories for a
|
159
166
|
# valid metadata.json
|
@@ -193,4 +200,4 @@ end
|
|
193
200
|
|
194
201
|
include Beaker::ModuleInstallHelper
|
195
202
|
# Use the caller (requirer) of this file to begin search for module source dir
|
196
|
-
$module_source_dir = get_module_source_directory caller
|
203
|
+
$module_source_dir = get_module_source_directory caller
|
@@ -50,8 +50,8 @@ describe Beaker::ModuleInstallHelper do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
context 'get_module_source_directory' do
|
53
|
-
let(:
|
54
|
-
let(:
|
53
|
+
let(:call_stack) { ['/a/b/c/d/e/f/g/spec_helper_acceptance.rb'] }
|
54
|
+
let(:call_stack_no_metadata) { ['/test/test/test/spec_helper_acceptance.rb'] }
|
55
55
|
|
56
56
|
before do
|
57
57
|
allow(File).to receive(:exist?).with(anything).and_return(false)
|
@@ -59,11 +59,11 @@ describe Beaker::ModuleInstallHelper do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'traverses file tree until it finds a folder containing metadata.json' do
|
62
|
-
expect(get_module_source_directory(
|
62
|
+
expect(get_module_source_directory(call_stack)).to eq('/a')
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'traverses file tree without a metadata.json file' do
|
66
|
-
expect(get_module_source_directory(
|
66
|
+
expect(get_module_source_directory(call_stack_no_metadata)).to be_nil
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-module_install_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|