Class: TasteTester::NoOp

Inherits:
Object
  • Object
show all
Includes:
BetweenMeals::Util, Logging
Defined in:
lib/taste_tester/noop.rb

Overview

Wrapper for running commands on local system

Instance Method Summary collapse

Methods included from Logging

#formatter, formatterproc=, logger, #logger, use_log_formatter=, verbosity=

Constructor Details

#initializeNoOp

Returns a new instance of NoOp.



25
26
27
28
29
30
# File 'lib/taste_tester/noop.rb', line 25

def initialize
  print_noop_warning
  @host = 'localhost'
  @user = ENV['USER']
  @cmds = []
end

Instance Method Details

#add(string) ⇒ Object Also known as: <<



42
43
44
# File 'lib/taste_tester/noop.rb', line 42

def add(string)
  @cmds << string
end

#error!Object



57
58
59
# File 'lib/taste_tester/noop.rb', line 57

def error!
  # never fails, but interface requires a definition
end


32
33
34
35
36
37
38
39
40
# File 'lib/taste_tester/noop.rb', line 32

def print_noop_warning
  # This needs to be a Class var as this class is initialized more
  # than once in a given tt run and we only want to warn once.
  # rubocop:disable Style/ClassVars
  @@printedwarning ||= logger.warn(
    'No-op plugin active, no remote commands will be run!',
  )
  # rubocop:enable Style/ClassVars
end

#runObject



48
49
50
# File 'lib/taste_tester/noop.rb', line 48

def run
  run!
end

#run!Object



52
53
54
55
# File 'lib/taste_tester/noop.rb', line 52

def run!
  cmd
  [0, "# TasteTester by #{@user}"]
end