gauge-ruby 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/code_parser.rb +1 -1
- data/lib/configuration.rb +30 -9
- data/lib/executor.rb +3 -2
- data/lib/gauge.rb +1 -2
- data/lib/gauge_runtime.rb +7 -53
- data/lib/gauge_screenshot.rb +13 -3
- data/lib/log.rb +29 -11
- data/lib/messages_pb.rb +272 -238
- data/lib/processors/cache_file_processor.rb +1 -6
- data/lib/processors/datastore_init_processor.rb +19 -14
- data/lib/processors/execute_step_request_processor.rb +5 -5
- data/lib/processors/execution_handler.rb +18 -19
- data/lib/processors/execution_hook_processors.rb +16 -40
- data/lib/processors/implementation_file_list_processor.rb +1 -6
- data/lib/processors/implementation_glob_pattern_processor.rb +1 -10
- data/lib/processors/refactor_step_request_processor.rb +1 -7
- data/lib/processors/step_name_request_processor.rb +2 -7
- data/lib/processors/step_names_request_processor.rb +1 -7
- data/lib/processors/step_positions_request_processor.rb +2 -7
- data/lib/processors/step_validation_request_processor.rb +1 -8
- data/lib/processors/stub_implementation_processor.rb +1 -6
- data/lib/service_handlers.rb +122 -0
- data/lib/{lsp_pb.rb → services_pb.rb} +2 -3
- data/lib/services_services_pb.rb +165 -0
- data/lib/spec_pb.rb +233 -198
- data/lib/static_loader.rb +2 -2
- data/lib/util.rb +24 -14
- metadata +48 -34
- data/lib/api_pb.rb +0 -182
- data/lib/connector.rb +0 -46
- data/lib/lsp_server.rb +0 -78
- data/lib/lsp_services_pb.rb +0 -51
- data/lib/message_processor.rb +0 -61
data/lib/connector.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright 2015 ThoughtWorks, Inc.
|
2
|
-
|
3
|
-
# This file is part of Gauge-Ruby.
|
4
|
-
|
5
|
-
# Gauge-Ruby is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
|
10
|
-
# Gauge-Ruby is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with Gauge-Ruby. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require 'protocol_buffers'
|
19
|
-
require_relative 'api_pb'
|
20
|
-
|
21
|
-
module Gauge
|
22
|
-
# @api private
|
23
|
-
module Connector
|
24
|
-
GAUGE_PORT_ENV = "GAUGE_INTERNAL_PORT"
|
25
|
-
HOST_NAME = '127.0.0.1'
|
26
|
-
@@executionSocket = nil
|
27
|
-
|
28
|
-
|
29
|
-
def self.execution_socket
|
30
|
-
@@executionSocket
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.make_connection
|
34
|
-
@@executionSocket = TCPSocket.open(HOST_NAME, Runtime.port_from_env_variable(GAUGE_PORT_ENV))
|
35
|
-
@@executionSocket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.message_length(socket)
|
39
|
-
ProtocolBuffers::Varint.decode socket
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.step_value text
|
43
|
-
return text.gsub(/(<.*?>)/, "{}")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/lsp_server.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# Copyright 2018 ThoughtWorks, Inc.
|
2
|
-
|
3
|
-
# This file is part of Gauge-Ruby.
|
4
|
-
|
5
|
-
# Gauge-Ruby is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
|
10
|
-
# Gauge-Ruby is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with Gauge-Ruby. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require_relative 'lsp_services_pb'
|
19
|
-
require_relative 'processors/step_positions_request_processor'
|
20
|
-
require_relative 'processors/cache_file_processor'
|
21
|
-
require_relative 'processors/step_names_request_processor'
|
22
|
-
require_relative 'processors/stub_implementation_processor'
|
23
|
-
require_relative 'processors/implementation_file_list_processor'
|
24
|
-
require_relative 'processors/step_validation_request_processor'
|
25
|
-
require_relative 'processors/refactor_step_request_processor'
|
26
|
-
require_relative 'processors/step_name_request_processor'
|
27
|
-
require_relative 'processors/implementation_glob_pattern_processor'
|
28
|
-
|
29
|
-
module Gauge
|
30
|
-
class LSPServer < Gauge::Messages::LspService::Service
|
31
|
-
include Gauge::Processors
|
32
|
-
|
33
|
-
def initialize(server)
|
34
|
-
@server = server
|
35
|
-
end
|
36
|
-
|
37
|
-
def get_step_names(_request, _call)
|
38
|
-
step_names_response
|
39
|
-
end
|
40
|
-
|
41
|
-
def cache_file(request, _call)
|
42
|
-
cache_file_response(request)
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_step_positions(request, _call)
|
46
|
-
step_positions(request)
|
47
|
-
end
|
48
|
-
|
49
|
-
def get_implementation_files(_request, _call)
|
50
|
-
implementation_files
|
51
|
-
end
|
52
|
-
|
53
|
-
def implement_stub(request, _call)
|
54
|
-
implement_stub_response(request)
|
55
|
-
end
|
56
|
-
|
57
|
-
def validate_step(request, _call)
|
58
|
-
step_validate_response(request)
|
59
|
-
end
|
60
|
-
|
61
|
-
def refactor(request, _call)
|
62
|
-
refactor_response(request)
|
63
|
-
end
|
64
|
-
|
65
|
-
def get_step_name(request, _call)
|
66
|
-
step_name_response(request)
|
67
|
-
end
|
68
|
-
|
69
|
-
def get_glob_patterns(_request, _call)
|
70
|
-
implementation_glob_pattern_response
|
71
|
-
end
|
72
|
-
|
73
|
-
def kill_process(_request, _call)
|
74
|
-
@server.stop
|
75
|
-
exit(0)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
data/lib/lsp_services_pb.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# Source: lsp.proto for package 'gauge.messages'
|
3
|
-
# Original file comments:
|
4
|
-
# Copyright 2015 ThoughtWorks, Inc.
|
5
|
-
#
|
6
|
-
# This file is part of gauge-proto.
|
7
|
-
#
|
8
|
-
# gauge-proto is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# gauge-proto is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with gauge-proto. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
#
|
21
|
-
|
22
|
-
require 'grpc'
|
23
|
-
require 'lsp_pb'
|
24
|
-
|
25
|
-
module Gauge
|
26
|
-
module Messages
|
27
|
-
module LspService
|
28
|
-
class Service
|
29
|
-
|
30
|
-
include GRPC::GenericService
|
31
|
-
|
32
|
-
self.marshal_class_method = :encode
|
33
|
-
self.unmarshal_class_method = :decode
|
34
|
-
self.service_name = 'gauge.messages.lspService'
|
35
|
-
|
36
|
-
rpc :GetStepNames, StepNamesRequest, StepNamesResponse
|
37
|
-
rpc :CacheFile, CacheFileRequest, Empty
|
38
|
-
rpc :GetStepPositions, StepPositionsRequest, StepPositionsResponse
|
39
|
-
rpc :GetImplementationFiles, Empty, ImplementationFileListResponse
|
40
|
-
rpc :ImplementStub, StubImplementationCodeRequest, FileDiff
|
41
|
-
rpc :ValidateStep, StepValidateRequest, StepValidateResponse
|
42
|
-
rpc :Refactor, RefactorRequest, RefactorResponse
|
43
|
-
rpc :GetStepName, StepNameRequest, StepNameResponse
|
44
|
-
rpc :GetGlobPatterns, Empty, ImplementationFileGlobPatternResponse
|
45
|
-
rpc :KillProcess, KillProcessRequest, Empty
|
46
|
-
end
|
47
|
-
|
48
|
-
Stub = Service.rpc_stub_class
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/message_processor.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# Copyright 2015 ThoughtWorks, Inc.
|
2
|
-
|
3
|
-
# This file is part of Gauge-Ruby.
|
4
|
-
|
5
|
-
# Gauge-Ruby is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
|
10
|
-
# Gauge-Ruby is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with Gauge-Ruby. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require_relative 'messages_pb'
|
19
|
-
require_relative 'executor'
|
20
|
-
require_relative 'table'
|
21
|
-
Dir[File.join(File.dirname(__FILE__), 'processors/*.rb')].each {|file| require file}
|
22
|
-
|
23
|
-
module Gauge
|
24
|
-
# @api private
|
25
|
-
class MessageProcessor
|
26
|
-
extend Processors
|
27
|
-
|
28
|
-
@processors = Hash.new
|
29
|
-
|
30
|
-
@processors[:StepValidateRequest] = method(:process_step_validation_request)
|
31
|
-
@processors[:ExecutionStarting] = method(:process_execution_start_request)
|
32
|
-
@processors[:ExecutionEnding] = method(:process_execution_end_request)
|
33
|
-
@processors[:SpecExecutionStarting] = method(:process_spec_execution_start_request)
|
34
|
-
@processors[:SpecExecutionEnding] = method(:process_spec_execution_end_request)
|
35
|
-
@processors[:ScenarioExecutionStarting] = method(:process_scenario_execution_start_request)
|
36
|
-
@processors[:ScenarioExecutionEnding] = method(:process_scenario_execution_end_request)
|
37
|
-
@processors[:StepExecutionStarting] = method(:process_step_execution_start_request)
|
38
|
-
@processors[:StepExecutionEnding] = method(:process_step_execution_end_request)
|
39
|
-
@processors[:ExecuteStep] = method(:process_execute_step_request)
|
40
|
-
@processors[:StepNamesRequest] = method(:process_step_names_request)
|
41
|
-
@processors[:KillProcessRequest] = method(:process_kill_processor_request)
|
42
|
-
@processors[:SuiteDataStoreInit] = method(:process_datastore_init)
|
43
|
-
@processors[:SpecDataStoreInit] = method(:process_datastore_init)
|
44
|
-
@processors[:ScenarioDataStoreInit] = method(:process_datastore_init)
|
45
|
-
@processors[:StepNameRequest] = method(:process_step_name_request)
|
46
|
-
@processors[:RefactorRequest] = method(:refactor_step)
|
47
|
-
@processors[:CacheFileRequest] = method(:process_cache_file_request)
|
48
|
-
@processors[:StepPositionsRequest] = method(:process_step_positions_request)
|
49
|
-
@processors[:ImplementationFileListRequest] = method(:process_implementation_file_list_request)
|
50
|
-
@processors[:ImplementationFileGlobPatternRequest] = method(:process_implementation_glob_pattern_request)
|
51
|
-
@processors[:StubImplementationCodeRequest] = method(:process_stub_implementation_code_request)
|
52
|
-
|
53
|
-
def self.is_valid_message(message)
|
54
|
-
return @processors.has_key? message.messageType
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.process_message(message)
|
58
|
-
@processors[message.messageType].call message
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|