lib/mattock/command-task.rb in mattock-0.7.1 vs lib/mattock/command-task.rb in mattock-0.8.0
- old
+ new
@@ -1,14 +1,21 @@
require 'mattock/task'
-require 'mattock/command-line'
+begin
+ require 'caliph'
+rescue LoadError => le
+ if le.message =~ /caliph/
+ puts "Mattock's CommandTask (and subclasses) requires a gem called 'caliph' now. Add it to your Gemfile"
+ end
+ raise
+end
module Mattock
module CommandTaskMixin
- include CommandLineDSL
+ include Caliph::CommandLineDSL
def self.included(sub)
- sub.extend CommandLineDSL
+ sub.extend Caliph::CommandLineDSL
sub.runtime_setting(:verify_command, nil)
sub.runtime_setting(:command)
end
def resolve_runtime_configuration
@@ -37,15 +44,23 @@
def decorated(command)
command
end
+ def self.shell
+ @shell ||= Caliph.new
+ end
+
+ def shell
+ CommandTaskMixin.shell
+ end
+
def action(args)
- decorated(command).must_succeed!
+ shell.run(decorated(command)).must_succeed!
end
def check_verification_command
- !decorated(verify_command).succeeds?
+ !shell.run(decorated(verify_command)).succeeds?
end
def needed?
finalize_configuration
if verify_command.nil?