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."

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Thor 1.0 deprecation guard

Returns:

  • (Boolean)


6
7
8
# File 'lib/pact/mock_service/cli.rb', line 6

def self.exit_on_failure? # Thor 1.0 deprecation guard
  false
end

Instance Method Details

#controlObject



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

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

#control_restartObject



154
155
156
157
158
159
# File 'lib/pact/mock_service/cli.rb', line 154

def control_restart
  require_common_dependencies
  restart_server(control_server_pidfile) do
    control
  end
end

#control_startObject



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

def control_start
  require_common_dependencies
  start_server(control_server_pidfile) do
    control
  end
end

#control_stopObject



135
136
137
138
# File 'lib/pact/mock_service/cli.rb', line 135

def control_stop
  require_common_dependencies
  control_server_pidfile.kill_process
end

#restartObject



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

def restart
  require_common_dependencies
  restart_server(mock_service_pidfile) do
    service
  end
end

#serviceObject



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

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

#startObject



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

def start
  require_common_dependencies
  start_server(mock_service_pidfile) do
    service
  end
end

#stopObject



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

def stop
  require_common_dependencies
  mock_service_pidfile.kill_process
end

#versionObject



163
164
165
166
# File 'lib/pact/mock_service/cli.rb', line 163

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