Sha256: 0cb7862295262a2e8c1b7605d0b7db69347f6e37a36a9903089ed90f0224b875

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

Contents

require 'pacto'

def token_map
  if File.readable? '.tokens.json'
    MultiJson.load(File.read '.tokens.json')
  else
    {}
  end
end

config[:port] = port
contracts_path = options[:directory] || File.expand_path('contracts', Dir.pwd)
Pacto.configure do |pacto_config|
  pacto_config.logger = logger
  pacto_config.contracts_path = contracts_path
  pacto_config.strict_matchers = options[:strict]
  pacto_config.generator_options = {
    :schema_version => :draft3,
    :token_map => token_map
  }
end

if options[:generate]
  Pacto.generate!
  logger.info 'Pacto generation mode enabled'
end

if options[:validate]
  Pacto.validate! if options[:validate]
  # Dir["#{contracts_path}/*"].each do |host_dir|
  #   host = File.basename host_dir
  #   Pacto.load_contracts(host_dir, "https://#{host}")
  # end
  contracts = Pacto::Extensions::Loaders::URIMapLoader.load(File.absolute_path('pacto/rackspace_uri_map.yaml'))
end

if options[:live]
#  WebMock.reset!
  WebMock.allow_net_connect!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polytrix-0.0.1 pacto/config/pacto_server.rb