Class: SimpleDeploy::Config
- Inherits:
-
Object
- Object
- SimpleDeploy::Config
- Defined in:
- lib/simple_deploy/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #artifact_cloud_formation_url(artifact) ⇒ Object
- #artifact_deploy_variable(artifact) ⇒ Object
- #artifacts ⇒ Object
- #deploy_script ⇒ Object
- #environment(name) ⇒ Object
- #environments ⇒ Object
-
#initialize(args = {}) ⇒ Config
constructor
A new instance of Config.
- #notifications ⇒ Object
- #region(name) ⇒ Object
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
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/simple_deploy/config.rb', line 4 def config @config end |
#logger ⇒ Object
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 |
#artifacts ⇒ Object
11 12 13 |
# File 'lib/simple_deploy/config.rb', line 11 def artifacts ['chef_repo', 'cookbooks', 'app'] end |
#deploy_script ⇒ Object
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 |
#environments ⇒ Object
33 34 35 |
# File 'lib/simple_deploy/config.rb', line 33 def environments config['environments'] end |
#notifications ⇒ Object
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 |