Sha256: 0bb4d99c6b5afd9708379092c956dafce85b81130b370cf1fd9443df44d61e9d
Contents?: true
Size: 1.56 KB
Versions: 10
Compression:
Stored size: 1.56 KB
Contents
require_relative '../helpers/application_helper' require_relative './job_command' module CapistranoMulticonfigParallel # class used for defining the job class class Job include CapistranoMulticonfigParallel::ApplicationHelper attr_reader :options, :command attr_writer :status, :exit_status delegate :job_stage, :capistrano_action, :build_capistrano_task, :execute_standard_deploy, :setup_command_line_standard, to: :command def initialize(options) @options = options @command = CapistranoMulticonfigParallel::JobCommand.new(self) end def id @id ||= SecureRandom.uuid end def status @status ||= :unstarted end def exit_status @exit_status ||= nil end [ { name: 'app', default: '' }, { name: 'stage', default: '' }, { name: 'action', default: '' }, { name: 'task_arguments', default: [] }, { name: 'env_options', default: {} } ].each do |hash| define_method hash[:name] do value = @options.fetch(hash[:name], hash[:default]) value["#{CapistranoMulticonfigParallel::ENV_KEY_JOB_ID}"] = id if hash[:name] == 'env_options' verify_empty_options(value) end end def finished? @status == 'finished' end def crashed? crashing_actions = ['deploy:rollback', 'deploy:failed'] crashing_actions.include?(action) || crashing_actions.include?(status) || failed? end def failed? status.present? && status == 'worker_died' end end end
Version data entries
10 entries across 10 versions & 1 rubygems