lib/beaker/options/parser.rb
# Generates a list of files based upon a given path or list of paths.
#
# Looks recursively for .rb files in paths.
#
# @param [Array] paths Array of file paths to search for .rb files
# @return [Array] An Array of fully qualified paths to .rb files
# @raise [ArgumentError] Raises if no .rb files are found in searched directory or if
#                         no .rb files are found overall
Generates a list of files based upon a given path or list of paths.
Looks recursively for .rb files in paths.
Generates a list of files based upon a given path or list of paths . Looks recursively for . rb files in paths .
def file_list(paths)
        files = []
        if not paths.empty?
          paths.each do |root|
            if File.file? root then
              files << root
            else
              discover_files = Dir.glob(
                File.join(root, "**/*.rb")
              ).select { |f| File.file?(f) }
              if discover_files.empty?
                parser_error "empty directory used as an option (#{root})!"
              end
              files += discover_files
            end
          end
        end
        if files.empty?
          parser_error "no .rb files found in #{paths.to_s}"
        end
        files
      end
def file_list ( paths ) files = [ ] if not paths . empty? paths . each do | root | if File . file? root then files << root else discover_files = Dir . glob ( File . join ( root , "**/*.rb" ) ) . select { | f | File . file? ( f ) } if discover_files . empty? parser_error "empty directory used as an option (#{root})!" end files += discover_files end end end if files . empty? parser_error "no .rb files found in #{paths.to_s}" end files end
Generates a list of files based upon a given path or list of paths.
Generates a list of files based upon a given path or list of paths .
An Array of fully qualified paths to .rb files
An Array of fully qualified paths to . rb files
Array
[ArgumentError] Raises if no .rb files are found in searched directory or if no .rb files are found overall
[ ArgumentError ] Raises if no . rb files are found in searched directory or if no . rb files are found overall
paths
<not_specific>
<not_specific>
paths Array of file paths to search for .rb files
paths Array of file paths to search for . rb files