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



47
48
49
50
# File 'lib/pact/mock_service/cli.rb', line 47

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

#control_restartObject



140
141
142
143
144
# File 'lib/pact/mock_service/cli.rb', line 140

def control_restart
  restart_server(control_server_pidfile) do
    control
  end
end

#control_startObject



114
115
116
117
118
# File 'lib/pact/mock_service/cli.rb', line 114

def control_start
  start_server(control_server_pidfile) do
    control
  end
end

#control_stopObject



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

def control_stop
  control_server_pidfile.kill_process
end

#restartObject



96
97
98
99
100
# File 'lib/pact/mock_service/cli.rb', line 96

def restart
  restart_server(mock_service_pidfile) do
    service
  end
end

#serviceObject



30
31
32
33
# File 'lib/pact/mock_service/cli.rb', line 30

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

#startObject



67
68
69
70
71
# File 'lib/pact/mock_service/cli.rb', line 67

def start
  start_server(mock_service_pidfile) do
    service
  end
end

#stopObject



77
78
79
# File 'lib/pact/mock_service/cli.rb', line 77

def stop
  mock_service_pidfile.kill_process
end

#versionObject



148
149
150
151
# File 'lib/pact/mock_service/cli.rb', line 148

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