module Mattock::CommandTaskMixin
Public Class Methods
included(sub)
click to toggle source
# File lib/mattock/command-task.rb, line 15 def self.included(sub) sub.extend Caliph::CommandLineDSL sub.runtime_setting(:verify_command, nil) sub.runtime_setting(:command) end
shell()
click to toggle source
# File lib/mattock/command-task.rb, line 49 def self.shell @shell ||= Caliph.new end
Public Instance Methods
action(args)
click to toggle source
# File lib/mattock/command-task.rb, line 57 def action(args) shell.run(decorated(command)).must_succeed! end
check_verification_command()
click to toggle source
# File lib/mattock/command-task.rb, line 61 def check_verification_command !shell.run(decorated(verify_command)).succeeds? end
decorated(command)
click to toggle source
# File lib/mattock/command-task.rb, line 45 def decorated(command) command end
needed?()
click to toggle source
Calls superclass method
# File lib/mattock/command-task.rb, line 65 def needed? finalize_configuration if verify_command.nil? super else check_verification_command end end
resolve_runtime_configuration()
click to toggle source
Calls superclass method
# File lib/mattock/command-task.rb, line 21 def resolve_runtime_configuration super #If there's a second troublesome command, this becomes a class-level #array if not verify_command.nil? and verify_command.name == "bundle" unless BundleCommandTask === self warn "Verify command is 'bundle' - this sometimes has unexpected results. Consider BundleCommandTask" end end if command.name == "bundle" unless BundleCommandTask === self warn "Command is 'bundle' - this sometimes has unexpected results. Consider BundleCommandTask" end end end
shell()
click to toggle source
# File lib/mattock/command-task.rb, line 53 def shell CommandTaskMixin.shell end
verify_command()
click to toggle source
# File lib/mattock/command-task.rb, line 38 def verify_command if @verify_command.respond_to?(:call) @verify_command = @verify_command.call end @verify_command end