Class: Gantree::DeployApplication

Inherits:
Deploy show all
Defined in:
lib/gantree/deploy_applications.rb

Instance Attribute Summary collapse

Attributes inherited from Deploy

#name

Instance Method Summary collapse

Methods inherited from Deploy

#application?, #check_dir_name, #check_eb_bucket, #create_eb_version, #deploy, #deploy_to_one, #environment?, #generate_eb_bucket, #prod_deploy?, #set_bucket, #update_application, #upload_to_s3

Methods inherited from Base

#authenticate_librato, #cfm, #check_credentials, check_for_updates, #check_template_bucket, #create_default_env, #eb, #env_type, #error_msg, #escape_characters_in_string, #get_latest_docker_solution, #print_options, #s3, #set_aws_keys, #tag, update_configuration, #upload_templates

Constructor Details

#initialize(name, options) ⇒ DeployApplication

Returns a new instance of DeployApplication.



10
11
12
13
14
15
# File 'lib/gantree/deploy_applications.rb', line 10

def initialize name, options
  @options = options
  @name = name
  puts "Found Application: #{@name}".green
  @environments = eb.describe_environments({ :application_name => @name })[:environments]
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/gantree/deploy_applications.rb', line 8

def options
  @options
end

Instance Method Details

#deploy_to_allObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/gantree/deploy_applications.rb', line 35

def deploy_to_all
  puts "WARN: Deploying to All Environments in the Application: #{@name}".yellow
  sleep 3
  envs = []
  @environments.each do |env|
    envs << env[:environment_name]
  end
  puts "envs: #{envs}"
  deploy(envs)
end

#environment_found?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/gantree/deploy_applications.rb', line 31

def environment_found?
  @environments.length >=1 ? true : false
end

#multiple_environments?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/gantree/deploy_applications.rb', line 27

def multiple_environments?
  @environments.length > 1 ? true : false
end

#runObject



17
18
19
20
21
22
23
24
25
# File 'lib/gantree/deploy_applications.rb', line 17

def run
  if multiple_environments?
    deploy_to_all
  elsif environment_found?
    deploy_to_one
  else
    error_msg "ERROR: There are no environments in this application"
  end
end