Sha256: 1563b8b934a3a477c3ff2c9661ee390a7bf5561e870a2c3672d54955b28cf4c3

Contents?: true

Size: 805 Bytes

Versions: 68

Compression:

Stored size: 805 Bytes

Contents

require 'gherkin'

module Gherkin
  module Tools
    # Base class for file based operations
    class Files
      include Enumerable

      def initialize(paths)
        raise "Please specify one or more paths" if paths.empty?
        @paths = paths
      end

      def each(&proc)
        globs = @paths.map do |path|
          raise "#{path} does not exist" unless File.exist?(path)
          File.directory?(path) ? File.join(path, '**', '*.feature') : path
        end

        Dir[*globs].uniq.sort.each(&proc)
      end

      def scan(file, listener)
        parser = Parser.new(listener, true)
        lexer = I18nLexer.new(parser)
        begin
          lexer.scan(IO.read(file))
        rescue => e
          e.message << " (#{file})"
          raise e
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
gherkin-1.0.19 lib/gherkin/tools/files.rb
gherkin-1.0.19-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.19-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.19-java lib/gherkin/tools/files.rb
gherkin-1.0.18 lib/gherkin/tools/files.rb
gherkin-1.0.18-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.18-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.18-java lib/gherkin/tools/files.rb
gherkin-1.0.17 lib/gherkin/tools/files.rb
gherkin-1.0.17-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.17-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.17-java lib/gherkin/tools/files.rb
gherkin-1.0.16 lib/gherkin/tools/files.rb
gherkin-1.0.16-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.16-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.16-java lib/gherkin/tools/files.rb
gherkin-1.0.15 lib/gherkin/tools/files.rb
gherkin-1.0.15-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.15-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.15-java lib/gherkin/tools/files.rb