Class: Brew::Commands::Uninstall

Inherits:
Object
  • Object
show all
Defined in:
lib/brew/commands/uninstall.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(brew_path, *formulae, **kwargs) ⇒ Uninstall

Returns a new instance of Uninstall.



11
12
13
14
15
16
# File 'lib/brew/commands/uninstall.rb', line 11

def initialize(brew_path, *formulae, **kwargs)
  @brew_path = brew_path
  @formulae = formulae.join(' ')
  @options = parse_args(kwargs)
  @system_runner = SystemRunner.new
end

Instance Attribute Details

#brew_pathObject (readonly)

Returns the value of attribute brew_path.



9
10
11
# File 'lib/brew/commands/uninstall.rb', line 9

def brew_path
  @brew_path
end

#formulaeObject (readonly)

Returns the value of attribute formulae.



9
10
11
# File 'lib/brew/commands/uninstall.rb', line 9

def formulae
  @formulae
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/brew/commands/uninstall.rb', line 9

def options
  @options
end

#system_runnerObject (readonly)

Returns the value of attribute system_runner.



9
10
11
# File 'lib/brew/commands/uninstall.rb', line 9

def system_runner
  @system_runner
end

Instance Method Details

#execute!Object



18
19
20
21
22
23
# File 'lib/brew/commands/uninstall.rb', line 18

def execute!
  uninstall_command = "#{brew_path} uninstall #{options} #{formulae}".squish
  system_runner.print_output(uninstall_command)
rescue StandardError => e
  raise Brew::ExecutionError, e
end