File tree 2 files changed +14
-1
lines changed
lib/octocatalog-diff/catalog-util
spec/octocatalog-diff/tests/catalog-util
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def self.module_path(dir)
59
59
result = [ ]
60
60
Regexp . last_match ( 1 ) . split ( /:/ ) . map ( &:strip ) . each do |path |
61
61
next if path . start_with? ( '$' )
62
- result << File . expand_path ( path , dir )
62
+ result . concat ( Dir . glob ( File . expand_path ( path , dir ) ) )
63
63
end
64
64
result
65
65
else
Original file line number Diff line number Diff line change @@ -83,9 +83,22 @@ def catalog_from_fixture(path)
83
83
it 'should return proper entries from environment.conf modulepath' do
84
84
allow ( File ) . to receive ( :file? ) . with ( '/a/environment.conf' ) . and_return ( true )
85
85
allow ( File ) . to receive ( :read ) . with ( '/a/environment.conf' ) . and_return ( 'modulepath=modules:site:$basemoduledir' )
86
+ allow ( Dir ) . to receive ( :glob ) . with ( '/a/modules' ) . and_return ( [ '/a/modules' ] )
87
+ allow ( Dir ) . to receive ( :glob ) . with ( '/a/site' ) . and_return ( [ '/a/site' ] )
86
88
result = OctocatalogDiff ::CatalogUtil ::FileResources . module_path ( '/a' )
87
89
expect ( result ) . to eq ( [ '/a/modules' , '/a/site' ] )
88
90
end
91
+
92
+ it 'should expand globs in modulepath, if present' do
93
+ allow ( File ) . to receive ( :file? ) . with ( '/a/environment.conf' ) . and_return ( true )
94
+ allow ( File ) . to receive ( :read ) . with ( '/a/environment.conf' )
95
+ . and_return ( 'modulepath=modules:extra_mods/*/modules:$basemoduledir' )
96
+ allow ( Dir ) . to receive ( :glob ) . with ( '/a/modules' ) . and_return ( [ '/a/modules' ] )
97
+ allow ( Dir ) . to receive ( :glob ) . with ( '/a/extra_mods/*/modules' )
98
+ . and_return ( [ '/a/extra_mods/a/modules' , '/a/extra_mods/b/modules' ] )
99
+ result = OctocatalogDiff ::CatalogUtil ::FileResources . module_path ( '/a' )
100
+ expect ( result ) . to eq ( [ '/a/modules' , '/a/extra_mods/a/modules' , '/a/extra_mods/b/modules' ] )
101
+ end
89
102
end
90
103
91
104
context 'with mixed files and directories' do
You can’t perform that action at this time.
0 commit comments