Class: Belly::Client::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/belly/client/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
# File 'lib/belly/client/config.rb', line 19

def initialize
  @default = DefaultConfig.new
  @host, @port = config_file['hub'].split(':')
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/belly/client/config.rb', line 6

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



6
7
8
# File 'lib/belly/client/config.rb', line 6

def port
  @port
end

Class Method Details

.new(*args) ⇒ Object



9
10
11
12
# File 'lib/belly/client/config.rb', line 9

def new(*args)
  return DefaultConfig.new unless File.exists?(path)
  super
end

.pathObject



14
15
16
# File 'lib/belly/client/config.rb', line 14

def path
  File.expand_path('.belly')
end

Instance Method Details

#projectObject



28
29
30
# File 'lib/belly/client/config.rb', line 28

def project
  config_file['project'] || @default.project
end

#urlObject



24
25
26
# File 'lib/belly/client/config.rb', line 24

def url
  "http://#{@host}:#{@port}"
end

#userObject



32
33
34
# File 'lib/belly/client/config.rb', line 32

def user
  config_file['user'] || @default.user
end