Sha256: deccf59f6390add0d09a7ed7d9ad4b44755d7b8bc7e5af9c0054f2bf5a0df768

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

module FogHelpers
  def setup_dns_credentials(provider)
    email, password = "ossgrants+dns@engineyard.com", "ossgrants1"
    File.open("#{ENV['HOME']}/.fog", "w") do |file|
      @credentials = case provider.to_sym
      when :DNSimple
        { :dnsimple_email => email, :dnsimple_password => password}
      else
        raise "No credentials available for provider '#{provider}'"
      end
      file << YAML::dump(:default => @credentials)
    end
  end
  
  def setup_domain(provider, domain)
    dns_provider(provider).zones.select { |z| z.domain == domain }.each do |domain|
      domain.destroy
    end
    dns_provider(provider).zones.create(:domain => domain)
  end
  
  def dns_provider(provider)
    @dns_provider ||= Fog::DNS.new({:provider => provider})
  end
end
World(FogHelpers)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
engineyard-dns-0.5.0 features/support/fog_helpers.rb
engineyard-dns-0.4.0 features/support/fog_helpers.rb