Sha256: d3a4027a458b41697f6efd66b77088ee0d96ec43435cdd6502274c57ff116b03

Contents?: true

Size: 546 Bytes

Versions: 28

Compression:

Stored size: 546 Bytes

Contents

module Pact
  module Support
    module ExpandFileList
      def self.call pact_files
        pact_files
          .collect{ |path| unixify_path(path) }
          .collect{ | path | expand_path(path) }
          .flatten
      end

      def self.unixify_path(path)
        path.gsub(/\\+/, '/')
      end

      def self.expand_path(path)
        if File.directory?(path)
          Dir.glob(File.join(path, "*.json"))
        elsif Dir.glob(path).any?
          Dir.glob(path)
        else
          path
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
pact-mock_service-3.2.1 lib/pact/support/expand_file_list.rb
pact-mock_service-3.2.0 lib/pact/support/expand_file_list.rb
pact-mock_service-3.1.1 lib/pact/support/expand_file_list.rb
pact-mock_service-3.1.0 lib/pact/support/expand_file_list.rb
pact-mock_service-3.0.1 lib/pact/support/expand_file_list.rb
pact-mock_service-3.0.0 lib/pact/support/expand_file_list.rb
pact-mock_service-2.12.0 lib/pact/support/expand_file_list.rb
pact-mock_service-2.11.0 lib/pact/support/expand_file_list.rb