Class: Deploy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/deploy/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#accountObject

Returns the value of attribute account.



3
4
5
# File 'lib/deploy/configuration.rb', line 3

def 
  @account
end

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/deploy/configuration.rb', line 3

def api_key
  @api_key
end

#projectObject

Returns the value of attribute project.



3
4
5
# File 'lib/deploy/configuration.rb', line 3

def project
  @project
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/deploy/configuration.rb', line 3

def username
  @username
end

#websocket_hostnameObject



6
7
8
# File 'lib/deploy/configuration.rb', line 6

def websocket_hostname
  @websocket_hostname || 'wss://websocket.deployhq.com'
end

Class Method Details

.from_file(path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/deploy/configuration.rb', line 10

def self.from_file(path)
  file_contents = File.read(path)
  parsed_contents = JSON.parse(file_contents)

  self.new.tap do |config|
    config. = parsed_contents['account']
    config.username = parsed_contents['username']
    config.api_key = parsed_contents['api_key']
    config.project = parsed_contents['project']
    config.websocket_hostname = parsed_contents['websocket_hostname']
  end
end