Class: CemWinSpec::WinExec::Factory
- Inherits:
-
Object
- Object
- CemWinSpec::WinExec::Factory
- Includes:
- Logging
- Defined in:
- lib/cem_win_spec/win_exec/factory.rb
Overview
Factory class for creating a WinExec object
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#current_conn_opts ⇒ Object
readonly
Returns the value of attribute current_conn_opts.
-
#current_local_exec ⇒ Object
readonly
Returns the value of attribute current_local_exec.
-
#current_remote_cmd ⇒ Object
readonly
Returns the value of attribute current_remote_cmd.
Instance Method Summary collapse
-
#build(title, merge: true, user: nil, pass: nil, working_dir: nil, **opts, &block) ⇒ Exec
Build a WinExec object.
-
#initialize(iap_tunnel, ma_builder, rspec_test_cmds, **opts) ⇒ Factory
constructor
A new instance of Factory.
- #local_threaded_results ⇒ Object
Methods included from Logging
#current_log_format, current_log_format, current_log_level, #current_log_level, included, log_setup!, #log_setup!, logger, #logger, new_log_formatter, #new_log_formatter, new_log_level, #new_log_level
Constructor Details
#initialize(iap_tunnel, ma_builder, rspec_test_cmds, **opts) ⇒ Factory
Returns a new instance of Factory.
17 18 19 20 21 22 23 24 25 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 17 def initialize(iap_tunnel, ma_builder, rspec_test_cmds, **opts) @iap_tunnel = iap_tunnel @ma_builder = ma_builder @rspec_test_cmds = rspec_test_cmds @current_local_cmd = LocalCmd.new(**opts) @current_remote_cmd = nil @current_conn_opts = nil @init_opts = opts end |
Instance Attribute Details
#current_conn_opts ⇒ Object (readonly)
Returns the value of attribute current_conn_opts.
15 16 17 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 15 def current_conn_opts @current_conn_opts end |
#current_local_exec ⇒ Object (readonly)
Returns the value of attribute current_local_exec.
15 16 17 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 15 def current_local_exec @current_local_exec end |
#current_remote_cmd ⇒ Object (readonly)
Returns the value of attribute current_remote_cmd.
15 16 17 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 15 def current_remote_cmd @current_remote_cmd end |
Instance Method Details
#build(title, merge: true, user: nil, pass: nil, working_dir: nil, **opts, &block) ⇒ Exec
Build a WinExec object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 36 def build(title, merge: true, user: nil, pass: nil, working_dir: nil, **opts, &block) logger.debug "Building Wexec object for #{title}" build_conn_opts(merge: merge, user: user, pass: pass, **opts) logger.debug 'Created ConnectionOpts' wexec = Exec.new wexec.add_title title wexec.add_local_cmd @current_local_cmd wexec.add_remote_cmd get_remote_cmd(working_dir, **@init_opts.merge(opts)) wexec.add_iap_tunnel @iap_tunnel wexec.add_ma_builder @ma_builder wexec.add_rspec_test_cmds @rspec_test_cmds wexec.add_command_block(&block) wexec.reuse_tunnel = opts[:reuse_tunnel] if opts.key?(:reuse_tunnel) wexec.ignore_exitcode = opts[:ignore_exitcode] if opts.key?(:ignore_exitcode) logger.debug 'Created Wexec' wexec end |
#local_threaded_results ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/cem_win_spec/win_exec/factory.rb', line 54 def local_threaded_results logger.info 'Checking for deferred results...' @current_local_exec.join_threads @current_local_exec.threaded_results.each do |cmd, results| logger.info "Deferred results for #{cmd}:" Output.new(results).puts_combined end end |