source ENV['GEM_SOURCE'] || "https://rubygems.org"

def location_for(place, fake_version = nil)
  if place =~ /^(git[:@][^#]*)#(.*)/
    [fake_version, { :git => $1, :branch => $2, :require => false }].compact
  elsif place =~ /^file:\/\/(.*)/
    ['>= 0', { :path => File.expand_path($1), :require => false }]
  else
    [place, { :require => false }]
  end
end

beaker_version = ENV['BEAKER_LOCATION'] || ENV['BEAKER_VERSION']
group :ci, :system_tests do
  gem 'rake'
  if beaker_version
    gem 'beaker', *location_for(beaker_version)
  else
    gem 'beaker', '~> 3.30'
  end
  gem 'beaker-pe', '~> 1.40.7'
  gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 0.2")
  gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.2")
  gem 'public_suffix', '1.4.6'
  gem 'nokogiri', '~> 1.8.2'
end

if File.exists? "#{__FILE__}.local"
  eval(File.read("#{__FILE__}.local"), binding)
end
