Class: EngineYard::DNS::Credentials
- Inherits:
-
Object
- Object
- EngineYard::DNS::Credentials
- Defined in:
- lib/engineyard-dns/credentials.rb
Overview
Credentials allows you to take a credentials path and write an example credentials file if the file does not exist.
Credentials.new(Fog.credentials_path).write_if_missing do |pretty_path|
# only yielded if example file is written
puts "We wrote your file to #{pretty_path}"
end
Constant Summary collapse
- EXAMPLE =
<<-CREDENTIALS :default: :aws_access_key_id: ACCESSKEY :aws_secret_access_key: SECRETKEY :bluebox_customer_id: ID :bluebox_api_key: APITOKEN :dnsimple_email: EMAIL :dnsimple_password: PASSWORD :linode_api_key: APITOKEN :slicehost_password: APITOKEN :zerigo_email: EMAIL :zerigo_token: APITOKEN CREDENTIALS
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(fog_creds_path) ⇒ Credentials
constructor
fog_creds_path usually comes from Fog.credentials_path.
-
#write_if_missing ⇒ Object
Writes an example credentials file to the default Fog.credentials_path.
Constructor Details
#initialize(fog_creds_path) ⇒ Credentials
fog_creds_path usually comes from Fog.credentials_path
31 32 33 |
# File 'lib/engineyard-dns/credentials.rb', line 31 def initialize(fog_creds_path) self.path = fog_creds_path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
35 36 37 |
# File 'lib/engineyard-dns/credentials.rb', line 35 def path @path end |
Instance Method Details
#write_if_missing ⇒ Object
Writes an example credentials file to the default Fog.credentials_path
This method will yield the path to which the example file was written. If the credentials path exists, does nothing and does not yield.
48 49 50 51 52 53 |
# File 'lib/engineyard-dns/credentials.rb', line 48 def write_if_missing unless path.exist? write_example yield pretty_path if block_given? end end |