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

#initialize(args = {}) ⇒ Config

Returns a new instance of Config.



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

def initialize(args = {})
  self.config = args.fetch(:config) { load_config_file }
  self.logger = args[:logger] ||= SimpleDeployLogger.new
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_cloud_formation_url(artifact) ⇒ Object



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

def artifact_cloud_formation_url(artifact)
  name_to_url_map = { 'chef_repo' => 'ChefRepoURL',
                      'app'       => 'AppArtifactURL',
                      'cookbooks' => 'CookbooksURL' }
  name_to_url_map[artifact]
end

#artifact_deploy_variable(artifact) ⇒ Object



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

def artifact_deploy_variable(artifact)
  name_to_variable_map = { 'chef_repo' => 'CHEF_REPO_URL',
                           'app'       => 'APP_URL',
                           'cookbooks' => 'COOKBOOKS_URL' }
  name_to_variable_map[artifact]
end

#artifactsObject



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

def artifacts
  ['chef_repo', 'cookbooks', 'app']
end

#deploy_scriptObject



29
30
31
# File 'lib/simple_deploy/config.rb', line 29

def deploy_script
  '/opt/intu/admin/bin/configure.sh'
end

#environment(name) ⇒ Object



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

def environment(name)
  raise "Environment not found" unless environments.include? name
  environments[name]
end

#environmentsObject



33
34
35
# File 'lib/simple_deploy/config.rb', line 33

def environments
  config['environments']
end

#notificationsObject



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

def notifications
  config['notifications']
end

#region(name) ⇒ Object



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

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