Class: SimpleDeploy::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



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

def initialize
  load_config_file
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/simple_deploy/config.rb', line 4

def config
  @config
end

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/simple_deploy/config.rb', line 4

def logger
  @logger
end

Instance Method Details

#artifact_repositoryObject



47
48
49
# File 'lib/simple_deploy/config.rb', line 47

def artifact_repository
  config['artifact_repository']
end

#artifactsObject



15
16
17
# File 'lib/simple_deploy/config.rb', line 15

def artifacts
  config['deploy']['artifacts']
end

#deploy_scriptObject



31
32
33
# File 'lib/simple_deploy/config.rb', line 31

def deploy_script
  config['deploy']['script']
end

#environment(name) ⇒ Object



39
40
41
# File 'lib/simple_deploy/config.rb', line 39

def environment(name)
  environments[name]
end

#environmentsObject



35
36
37
# File 'lib/simple_deploy/config.rb', line 35

def environments
  config['environments']
end

#gatewayObject



23
24
25
# File 'lib/simple_deploy/config.rb', line 23

def gateway
  config['deploy']['gateway']
end

#keysObject



19
20
21
# File 'lib/simple_deploy/config.rb', line 19

def keys
  config['deploy']['keys'] ||= "#{env_home}/.ssh/id_rsa"
end

#load_config_fileObject



10
11
12
13
# File 'lib/simple_deploy/config.rb', line 10

def load_config_file
  config_file = "#{ENV['HOME']}/.simple_deploy.yml"
  self.config = YAML::load( File.open( config_file ) )
end

#region(name) ⇒ Object



43
44
45
# File 'lib/simple_deploy/config.rb', line 43

def region(name)
  environment(name)['region']
end

#userObject



27
28
29
# File 'lib/simple_deploy/config.rb', line 27

def user
  config['deploy']['user'] ||= "#{env_user}"
end