class CfDeployer::Application
Attributes
components[R]
Public Class Methods
new(context = {})
click to toggle source
# File lib/cf_deployer/application.rb, line 5 def initialize(context = {}) @context = context get_components add_component_dependencies @components.sort! end
Public Instance Methods
add_component_dependencies()
click to toggle source
# File lib/cf_deployer/application.rb, line 20 def add_component_dependencies @context[:components].keys.each do | key | component = @components.find { |c| c.name == key.to_s } dependencies = @context[:components][key][:'depends-on'] || [] dependencies.each do | parent_name | parent = @components.find { |c| c.name == parent_name } if parent parent.children << component component.dependencies << parent end end end end
deploy()
click to toggle source
# File lib/cf_deployer/application.rb, line 34 def deploy Log.debug @context components = get_targets().sort components.each &:deploy end
destroy()
click to toggle source
# File lib/cf_deployer/application.rb, line 62 def destroy components = get_targets.sort { |a, b| b <=> a } components.each &:destroy end
diff()
click to toggle source
# File lib/cf_deployer/application.rb, line 45 def diff components = get_targets().sort components.each &:diff end
get_components()
click to toggle source
# File lib/cf_deployer/application.rb, line 12 def get_components @components = [] @context[:components].keys.each do | key | component = Component.new(@context[:application], @context[:environment], key.to_s, @context[:components][key]) @components << component end end
json()
click to toggle source
# File lib/cf_deployer/application.rb, line 40 def json components = get_targets().sort components.each &:json end
kill_inactive()
click to toggle source
# File lib/cf_deployer/application.rb, line 67 def kill_inactive component = get_targets.first component.kill_inactive end
run_hook(component_name, hook_name)
click to toggle source
# File lib/cf_deployer/application.rb, line 58 def run_hook component_name, hook_name @components.detect{ |component| component_name == component.name }.run_hook hook_name end
status(component_name, verbosity)
click to toggle source
# File lib/cf_deployer/application.rb, line 50 def status component_name, verbosity statuses = {} @components.select { |component| component_name.nil? || component_name == component.name }.each do |component| statuses[component.name] = component.status(verbosity != 'stacks') end statuses end
switch()
click to toggle source
# File lib/cf_deployer/application.rb, line 72 def switch @context[:targets].each do | component_name | @components.find { |c| c.name == component_name }.switch end end
Private Instance Methods
get_targets()
click to toggle source
# File lib/cf_deployer/application.rb, line 79 def get_targets targets = @components.select { |c| @context[:targets].include?(c.name) } end