Class: AvoDeploy::Deployment
- Inherits:
-
Object
- Object
- AvoDeploy::Deployment
- Defined in:
- lib/avodeploy/deployment.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#task_manager ⇒ Object
Returns the value of attribute task_manager.
Class Method Summary collapse
-
.configure(&block) ⇒ Object
Configures the deployment.
-
.instance ⇒ Deployment
Returns the deployment instance.
Instance Method Summary collapse
-
#handle_abort(e) ⇒ Object
Handles exceptions.
-
#initialize ⇒ Deployment
constructor
Initializes the deployment.
Constructor Details
#initialize ⇒ Deployment
Initializes the deployment
27 28 29 30 31 32 33 34 |
# File 'lib/avodeploy/deployment.rb', line 27 def initialize @stages = {} @task_manager = AvoDeploy::Task::TaskManager.new @config = AvoDeploy::Config.new log_file = File.open('avodeploy.log', 'a') @log = ::Logger.new AvoDeploy::MultiIO.new(STDOUT, log_file) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
22 23 24 |
# File 'lib/avodeploy/deployment.rb', line 22 def config @config end |
#log ⇒ Object (readonly)
Returns the value of attribute log.
24 25 26 |
# File 'lib/avodeploy/deployment.rb', line 24 def log @log end |
#task_manager ⇒ Object
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
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 |
.instance ⇒ Deployment
Returns the deployment instance
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
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/avodeploy/deployment.rb', line 60 def handle_abort(e) if log.level == ::Logger::DEBUG raise e elsif e.class != SystemExit @log.error e..red @log.info 'cleaning up...' task_manager.invoke_task_oneshot(:cleanup_local) end Kernel.exit(true) end |