Class: Fudge::Tasks::Shell

Inherits:
Task
  • Object
show all
Defined in:
lib/fudge/tasks/shell.rb

Overview

Allow use of shell commands as tasks

Direct Known Subclasses

Brakeman, Cane, Cucumber, Flay, Flog, Rake, Rspec, SubProcess, Yard

Instance Attribute Summary collapse

Attributes inherited from Task

#args, #options

Instance Method Summary collapse

Methods inherited from Task

name

Constructor Details

#initialize(*args) ⇒ Shell

Returns a new instance of Shell.



7
8
9
# File 'lib/fudge/tasks/shell.rb', line 7

def initialize(*args)
  self.arguments = super.join(' ')
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



5
6
7
# File 'lib/fudge/tasks/shell.rb', line 5

def arguments
  @arguments
end

#check_forObject

Returns the value of attribute check_for.



5
6
7
# File 'lib/fudge/tasks/shell.rb', line 5

def check_for
  @check_for
end

Instance Method Details

#run(options = {}) ⇒ Object

Execute the shell command

Parameters:

  • options (Hash) (defaults to: {})

    Any options to pass to the shell



14
15
16
17
18
19
20
# File 'lib/fudge/tasks/shell.rb', line 14

def run(options={})
  formatter = get_formatter(options)
  @output, success = run_command(cmd(options), formatter)

  return false unless success
  return check_for_output(formatter)
end