module Pact

def self.clear_configuration

def self.clear_configuration
  @configuration = default_configuration
end

def self.configuration

def self.configuration
  @configuration ||= default_configuration
end

def self.configure

def self.configure
  yield configuration
  FileUtils::mkdir_p configuration.tmp_dir
end

def self.default_configuration

def self.default_configuration
  c = Configuration.new
  c.pact_dir = File.expand_path('./spec/pacts')
  c.tmp_dir = File.expand_path('./tmp/pacts')
  c.log_dir = default_log_dir
  c.logger = default_logger c.log_path
  c.pactfile_write_mode = is_rake_running? ? :overwrite : :update
  c.reports_dir = File.expand_path('./reports/pacts')
  c
end

def self.default_log_dir

def self.default_log_dir
  File.expand_path("./log")
end

def self.default_logger path

def self.default_logger path
  FileUtils::mkdir_p File.dirname(path)
  logger = Logger.new(path)
  logger.level = Logger::INFO
  logger
end

def self.is_rake_running?

Would love a better way of determining this! It sure won't work on windows.
def self.is_rake_running?
  `ps -ef | grep rake | grep #{Process.ppid} | grep -v 'grep'`.size > 0
end