Class: Pact::MockService::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/pact/mock_service/cli.rb,
lib/pact/mock_service/cli/pidfile.rb,
lib/pact/mock_service/cli/custom_thor.rb

Defined Under Namespace

Classes: CustomThor, Pidfile

Constant Summary collapse

PACT_FILE_WRITE_MODE_DESC =
"`overwrite` or `merge`. Use `merge` when running multiple mock service instances in parallel for the same consumer/provider pair." +
" Ensure the pact file is deleted before running tests when using this option so that interactions deleted from the code are not maintained in the file."

Instance Method Summary collapse

Instance Method Details

#controlObject



50
51
52
53
# File 'lib/pact/mock_service/cli.rb', line 50

def control
  require 'pact/mock_service/control_server/run'
  ControlServer::Run.(options)
end

#control_restartObject



150
151
152
153
154
# File 'lib/pact/mock_service/cli.rb', line 150

def control_restart
  restart_server(control_server_pidfile) do
    control
  end
end

#control_startObject



122
123
124
125
126
# File 'lib/pact/mock_service/cli.rb', line 122

def control_start
  start_server(control_server_pidfile) do
    control
  end
end

#control_stopObject



132
133
134
# File 'lib/pact/mock_service/cli.rb', line 132

def control_stop
  control_server_pidfile.kill_process
end

#restartObject



102
103
104
105
106
# File 'lib/pact/mock_service/cli.rb', line 102

def restart
  restart_server(mock_service_pidfile) do
    service
  end
end

#serviceObject



32
33
34
35
# File 'lib/pact/mock_service/cli.rb', line 32

def service
  require 'pact/mock_service/run'
  Run.(options)
end

#startObject



72
73
74
75
76
# File 'lib/pact/mock_service/cli.rb', line 72

def start
  start_server(mock_service_pidfile) do
    service
  end
end

#stopObject



82
83
84
# File 'lib/pact/mock_service/cli.rb', line 82

def stop
  mock_service_pidfile.kill_process
end

#versionObject



158
159
160
161
# File 'lib/pact/mock_service/cli.rb', line 158

def version
  require 'pact/mock_service/version.rb'
  puts Pact::MockService::VERSION
end