Class: PhoneGap::Build::Credentials

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/phone_gap/build/credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/phone_gap/build/credentials.rb', line 9

def config
  @config
end

#passwordObject (readonly)

Returns the value of attribute password.



9
10
11
# File 'lib/phone_gap/build/credentials.rb', line 9

def password
  @password
end

#tokenObject

Returns the value of attribute token.



9
10
11
# File 'lib/phone_gap/build/credentials.rb', line 9

def token
  @token
end

#usernameObject (readonly)

Returns the value of attribute username.



9
10
11
# File 'lib/phone_gap/build/credentials.rb', line 9

def username
  @username
end

Instance Method Details

#loadObject



19
20
21
22
23
24
25
# File 'lib/phone_gap/build/credentials.rb', line 19

def load
  if config_file && File.exists?(config_file)
    @config = YAML::load(ERB.new(File.read(config_file)).result)
    @token = @config['token']
  end
  self
end

#set(credentials) ⇒ Object



12
13
14
15
16
17
# File 'lib/phone_gap/build/credentials.rb', line 12

def set(credentials)
  @username = credentials[:username]
  @password = credentials[:password]
  @token = credentials[:token]
  self
end