Sha256: 9bd5fcef8a9a3017b5614433c58d26ad0025fc7aff995d92c5a9f61276354208

Contents?: true

Size: 591 Bytes

Versions: 18

Compression:

Stored size: 591 Bytes

Contents

require 'mattock/task'
require 'mattock/command-line'

module Mattock
  class CommandTask < Task
    setting(:task_name, :run)
    setting(:command)
    setting(:verify_command, nil)

    def verify_command
      if @verify_command.respond_to?(:call)
        @verify_command = @verify_command.call
      end
      @verify_command
    end

    def decorated(cmd)
      cmd
    end

    def action
      decorated(command).must_succeed!
    end

    def needed?
      unless verify_command.nil?
        !decorated(verify_command).succeeds?
      else
        super
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mattock-0.2.13 lib/mattock/command-task.rb
mattock-0.2.12 lib/mattock/command-task.rb
mattock-0.2.11 lib/mattock/command-task.rb
mattock-0.2.10 lib/mattock/command-task.rb
mattock-0.2.9 lib/mattock/command-task.rb
mattock-0.2.8 lib/mattock/command-task.rb
mattock-0.2.7 lib/mattock/command-task.rb
mattock-0.2.6 lib/mattock/command-task.rb
mattock-0.2.5 lib/mattock/command-task.rb
mattock-0.2.4 lib/mattock/command-task.rb
mattock-0.2.3 lib/mattock/command-task.rb
mattock-0.2.2 lib/mattock/command-task.rb
mattock-0.2.1 lib/mattock/command-task.rb
mattock-0.2.0 lib/mattock/command-task.rb
mattock-0.1.3 lib/mattock/command-task.rb
mattock-0.1.2 lib/mattock/command-task.rb
mattock-0.1.1 lib/mattock/command-task.rb
mattock-0.1.0 lib/mattock/command-task.rb