Sha256: 5a06c9e73a5cf4bdf482eef1ed2a22fbd42122d883313fae27f2f5654057ce3c

Contents?: true

Size: 603 Bytes

Versions: 18

Compression:

Stored size: 603 Bytes

Contents

module Pact

  module PactFile

    extend self

    def read uri, options = {}
      pact = open(uri) { | file | file.read }
      if options[:save_pactfile_to_tmp]
        save_pactfile_to_tmp pact, ::File.basename(uri)
      end
      pact
    rescue StandardError => e
      $stderr.puts "Error reading file from #{uri}"
      $stderr.puts "#{e.to_s} #{e.backtrace.join("\n")}"
      raise e
    end

    def save_pactfile_to_tmp pact, name
      ::FileUtils.mkdir_p Pact.configuration.tmp_dir
      ::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file|  file << pact}
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pact-1.2.1.rc2 lib/pact/consumer_contract/pact_file.rb
pact-1.2.1.rc1 lib/pact/consumer_contract/pact_file.rb
pact-1.1.1 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0.rc5 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0.rc4 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0.rc3 lib/pact/consumer_contract/pact_file.rb
pact-1.0.39 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0.rc2 lib/pact/consumer_contract/pact_file.rb
pact-1.0.38 lib/pact/consumer_contract/pact_file.rb
pact-1.1.0.rc1 lib/pact/consumer_contract/pact_file.rb
pact-1.0.37 lib/pact/consumer_contract/pact_file.rb
pact-1.0.36 lib/pact/consumer_contract/pact_file.rb
pact-1.0.35 lib/pact/consumer_contract/pact_file.rb
pact-1.0.34 lib/pact/consumer_contract/pact_file.rb
pact-1.0.33 lib/pact/consumer_contract/pact_file.rb
pact-1.0.32 lib/pact/consumer_contract/pact_file.rb
pact-1.0.31 lib/pact/consumer_contract/pact_file.rb