Sha256: f47dbac19d702d33cd0ddedc60af83d2db48085d3d01d99d7e551f238d493696

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

require 'find'

module Reconn
  class ProjectScanner
    # Scans the given directory and all its subdirectories for ruby files
    #
    # @param proj_path [String] path to the project directory
    # @return [Array<String>] paths to the ruby files
    # @raise [InvalidPathException] if it can't open the directory
    def self.scan(proj_path)
      paths = []
      begin
        Find.find(proj_path) do |path|
          if FileTest.directory?(path)
            if File.basename(path)[0] == '.'
              Find.prune
            end
          end
          if File.extname(path) == '.rb'
            paths << path
          end
        end
      rescue
        raise InvalidPathException, "Can't open the directory"
      end

      paths
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reconn-1.0.0 lib/reconn/util/project_scanner.rb