Class: TasteTester::NoOp
- Inherits:
-
Object
- Object
- TasteTester::NoOp
- Includes:
- BetweenMeals::Util, Logging
- Defined in:
- lib/taste_tester/noop.rb
Overview
Wrapper for running commands on local system
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #add(string) ⇒ Object (also: #<<)
-
#initialize ⇒ NoOp
constructor
A new instance of NoOp.
- #print_noop_warning ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
Methods included from Logging
#formatter, formatterproc=, logger, #logger, use_log_formatter=, verbosity=
Constructor Details
#initialize ⇒ NoOp
Returns a new instance of NoOp.
27 28 29 30 31 32 |
# File 'lib/taste_tester/noop.rb', line 27 def initialize print_noop_warning @host = 'localhost' @user = ENV['USER'] @cmds = [] end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
25 26 27 |
# File 'lib/taste_tester/noop.rb', line 25 def output @output end |
Instance Method Details
#add(string) ⇒ Object Also known as: <<
44 45 46 |
# File 'lib/taste_tester/noop.rb', line 44 def add(string) @cmds << string end |
#print_noop_warning ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/taste_tester/noop.rb', line 34 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 |
#run ⇒ Object
50 51 52 |
# File 'lib/taste_tester/noop.rb', line 50 def run run! end |
#run! ⇒ Object
54 55 56 57 |
# File 'lib/taste_tester/noop.rb', line 54 def run! cmd [0, "# TasteTester by #{@user}"] end |