Class: AvoDeploy::Deployment

Inherits:
Object
  • Object
show all
Defined in:
lib/avodeploy/deployment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeployment

Initializes the deployment



28
29
30
31
32
33
34
# File 'lib/avodeploy/deployment.rb', line 28

def initialize
	@stages = {}
	@task_manager = AvoDeploy::Task::TaskManager.new
	@config = AvoDeploy::Config.new

	@log = ::Logger.new(STDOUT)
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



22
23
24
# File 'lib/avodeploy/deployment.rb', line 22

def config
  @config
end

#logObject (readonly)

Returns the value of attribute log.



24
25
26
# File 'lib/avodeploy/deployment.rb', line 24

def log
  @log
end

#log_fileObject (readonly)

Returns the value of attribute log_file.



25
26
27
# File 'lib/avodeploy/deployment.rb', line 25

def log_file
  @log_file
end

#task_managerObject

Returns the value of attribute task_manager.



23
24
25
# File 'lib/avodeploy/deployment.rb', line 23

def task_manager
  @task_manager
end

Class Method Details

.configure(&block) ⇒ Object

Configures the deployment

Parameters:

  • block (Block)

    configuration block



39
40
41
42
43
44
# File 'lib/avodeploy/deployment.rb', line 39

def self.configure(&block)
	@instance = self.instance
	@instance.config.instance_eval(&block)

	# @todo check config and throw exception
end

.instanceDeployment

Returns the deployment instance

Returns:



49
50
51
52
53
54
55
# File 'lib/avodeploy/deployment.rb', line 49

def self.instance
	if @instance.nil?
		@instance = self.new
	end

	@instance
end

Instance Method Details

#handle_abort(e) ⇒ Object

Handles exceptions

Parameters:

  • the (Exception)

    exception to handle



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/avodeploy/deployment.rb', line 60

def handle_abort(e)
	if e.class != SystemExit
		@log.error e.message.red
		@log.info "cleaning up..."

		task_manager.invoke_task_oneshot(:cleanup_local)

		#if e.kind_of?(::Net::SSH::AuthenticationFailed) == false
		#	task_manager.invoke_task_oneshot(:cleanup_remote)
		#end
		
		Kernel.exit(true)
	end
end