File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/octocatalog-diff/catalog-util
spec/octocatalog-diff/tests/catalog-util Expand file tree Collapse file tree 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)
5959 result = [ ]
6060 Regexp . last_match ( 1 ) . split ( /:/ ) . map ( &:strip ) . each do |path |
6161 next if path . start_with? ( '$' )
62- result << File . expand_path ( path , dir )
62+ result . concat ( Dir . glob ( File . expand_path ( path , dir ) ) )
6363 end
6464 result
6565 else
Original file line number Diff line number Diff line change @@ -83,9 +83,22 @@ def catalog_from_fixture(path)
8383 it 'should return proper entries from environment.conf modulepath' do
8484 allow ( File ) . to receive ( :file? ) . with ( '/a/environment.conf' ) . and_return ( true )
8585 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' ] )
8688 result = OctocatalogDiff ::CatalogUtil ::FileResources . module_path ( '/a' )
8789 expect ( result ) . to eq ( [ '/a/modules' , '/a/site' ] )
8890 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
89102 end
90103
91104 context 'with mixed files and directories' do
You can’t perform that action at this time.
0 commit comments