Module: Pact::Provider::Proxy::TaskHelper
Instance Method Summary collapse
- #execute_cmd(command) ⇒ Object
- #execute_pact_verify(pact_uri = nil, pact_helper = nil) ⇒ Object
- #handle_verification_failure ⇒ Object
- #verify_command(pact_helper, pact_uri = nil) ⇒ Object
Instance Method Details
#execute_cmd(command) ⇒ Object
32 33 34 |
# File 'lib/pact/provider/proxy/task_helper.rb', line 32 def execute_cmd command system(command) ? 0 : 1 end |
#execute_pact_verify(pact_uri = nil, pact_helper = nil) ⇒ Object
11 12 13 |
# File 'lib/pact/provider/proxy/task_helper.rb', line 11 def execute_pact_verify pact_uri = nil, pact_helper = nil execute_cmd verify_command(pact_helper, pact_uri) end |
#handle_verification_failure ⇒ Object
15 16 17 18 |
# File 'lib/pact/provider/proxy/task_helper.rb', line 15 def handle_verification_failure exit_status = yield abort if exit_status != 0 end |
#verify_command(pact_helper, pact_uri = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pact/provider/proxy/task_helper.rb', line 20 def verify_command pact_helper, pact_uri = nil command_parts = [] command_parts << FileUtils::RUBY command_parts << "-S pact verify" command_parts << "-h" << (pact_helper.end_with?(".rb") ? pact_helper : pact_helper + ".rb") (command_parts << "-p" << pact_uri) if pact_uri command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION'] command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE'] command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true' command_parts.flatten.join(" ") end |