Class: Mamiya::Agent::Tasks::Prepare
- Inherits:
-
Notifyable
- Object
- Abstract
- Notifyable
- Mamiya::Agent::Tasks::Prepare
- Defined in:
- lib/mamiya/agent/tasks/prepare.rb
Instance Attribute Summary
Attributes inherited from Abstract
#agent, #error, #logger, #task, #task_queue
Instance Method Summary collapse
Methods inherited from Abstract
#after, #before, #errored, identifier, #initialize, #raise_error?, #task_id
Constructor Details
This class inherits a constructor from Mamiya::Agent::Tasks::Abstract
Instance Method Details
#check ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mamiya/agent/tasks/prepare.rb', line 16 def check unless package_path.exist? new_chain = ['prepare'] + (task['_chain'] || []) logger.info "Package not fetched, enqueueing fetch task with #{new_chain.inspect}" task_queue.enqueue( :fetch, task.merge('_chain' => new_chain) ) return false end true end |
#execute ⇒ Object
11 12 13 14 |
# File 'lib/mamiya/agent/tasks/prepare.rb', line 11 def execute return unless check super end |
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mamiya/agent/tasks/prepare.rb', line 30 def run if prerelease_path.exist? if prerelease_path.join('.mamiya.prepared').exist? return else FileUtils.remove_entry_secure prerelease_path end end packages_dir.join(application).mkpath prereleases_dir.join(application).mkpath extract_step.run! prepare_step.run! task_queue.enqueue(:clean, {}) end |