Top Level Namespace

Defined Under Namespace

Modules: SportDb

Instance Method Summary collapse

Instance Method Details

#build_pathspecs(args) ⇒ Object

note: was expand_args



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/fbtok/pathspec.rb', line 196

def build_pathspecs( args )    ### note:   was expand_args
   specs = []

   ## note - collect all "loose/standalone" files (NOT directories)
   ##             in single default pathspec node
   more = []

   args.each do |arg|
    ## check if directory
    if Dir.exist?( arg )
          datafiles = SportDb::Pathspec._find( arg )
          specs << { 'path'       => arg,
                     'datafiles'  => datafiles }
    elsif File.file?( arg )  ## assume it's a file
        ## make sure path exists; raise error if not
        ##   (auto-)expand path to normalize - why? why not?
          more << arg
    else
        raise Errno::ENOENT, "No such file or directory - #{arg}"
    end
  end

   if more.size > 0
      specs << { 'path'      => '<input>',
                 'datafiles' =>  more }
   end

  specs
end

#read_pathspecs(src) ⇒ Object



228
229
230
# File 'lib/fbtok/pathspec.rb', line 228

def read_pathspecs( src )
    SportDb::Pathspec.read( src )
end