tdl-client-ruby 0.21.1 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/tdl/previous_version.rb +1 -1
- data/lib/tdl/runner/challenge_session.rb +32 -37
- data/lib/tdl/runner/recording_system.rb +26 -15
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c010e01bbf54e96598f837d6dbad4d2522e8ece8c359a934e6d248fb73ac40da
|
4
|
+
data.tar.gz: ab556e467482c6a227d55e8425ed338bf2899856b114617f96e9c49cb53eebce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec89c3029e6d36f119c390a83816762d3276f421622d3386c0358bd427583cd8f71fbc8ed9601133b6e38adf08387e0a903343d72c5d6cc25aaa3d39c8dd0a3c
|
7
|
+
data.tar.gz: bdf125e5e75c8ad5c6dd90fa38e1a42170931f8b72230c22ccda1c56e3d82a9228908781bc3a854edbf6c6ae72e26f9e8b04d234fd2c6ecce7655210581b51b9
|
data/README.md
CHANGED
@@ -40,6 +40,8 @@ Recommendation is to use the cucumber command instead of rake always outside of
|
|
40
40
|
Stop external dependencies
|
41
41
|
```
|
42
42
|
python ./broker/activemq-wrapper.py stop
|
43
|
+
python wiremock/wiremock-wrapper.py stop 41375
|
44
|
+
python wiremock/wiremock-wrapper.py stop 8222
|
43
45
|
```
|
44
46
|
|
45
47
|
|
data/lib/tdl/previous_version.rb
CHANGED
@@ -46,55 +46,50 @@ module TDL
|
|
46
46
|
@config.get_use_colours)
|
47
47
|
|
48
48
|
begin
|
49
|
-
|
50
|
-
if should_continue
|
51
|
-
user_input = @user_input_callback.call
|
52
|
-
@audit_stream.write_line "Selected action is: #{user_input}"
|
53
|
-
round_description = execute_user_action(user_input)
|
54
|
-
RoundManagement.save_description(@recording_system, round_description, @audit_stream, @config.get_working_directory)
|
55
|
-
end
|
56
|
-
rescue ChallengeServerClient::ClientErrorException => e
|
57
|
-
@audit_stream.write_line e.message
|
58
|
-
rescue ChallengeServerClient::ServerErrorException => e
|
59
|
-
@audit_stream.write_line 'Server experienced an error. Try again in a few minutes.'
|
60
|
-
rescue ChallengeServerClient::OtherCommunicationException => e
|
61
|
-
@audit_stream.write_line 'Client threw an unexpected error. Try again.'
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def check_status_of_challenge
|
66
|
-
@audit_stream = @config.get_audit_stream
|
49
|
+
@audit_stream = @config.get_audit_stream
|
67
50
|
|
68
|
-
|
69
|
-
|
51
|
+
journey_progress = @challenge_server_client.get_journey_progress
|
52
|
+
@audit_stream.write_line(journey_progress)
|
70
53
|
|
71
|
-
|
72
|
-
|
54
|
+
available_actions = @challenge_server_client.get_available_actions
|
55
|
+
@audit_stream.write_line(available_actions)
|
73
56
|
|
74
|
-
|
75
|
-
|
57
|
+
no_actions_available = available_actions.include?('No actions available.')
|
58
|
+
if no_actions_available
|
59
|
+
@recording_system.tell_to_stop
|
60
|
+
return
|
61
|
+
end
|
76
62
|
|
77
|
-
|
78
|
-
|
63
|
+
user_input = @user_input_callback.call
|
64
|
+
@audit_stream.write_line "Selected action is: #{user_input}"
|
65
|
+
if user_input == 'deploy'
|
79
66
|
@runner.run
|
80
67
|
last_fetched_round = RoundManagement.get_last_fetched_round(@config.get_working_directory)
|
81
68
|
@recording_system.notify_event(last_fetched_round, RecordingEvent::ROUND_SOLUTION_DEPLOY)
|
82
|
-
|
69
|
+
end
|
83
70
|
|
84
|
-
|
85
|
-
|
71
|
+
action_feedback = @challenge_server_client.send_action user_input
|
72
|
+
if action_feedback.include?('Round time for')
|
73
|
+
last_fetched_round = RoundManagement.get_last_fetched_round(@config.get_working_directory)
|
74
|
+
@recording_system.notify_event(last_fetched_round, RecordingEvent::ROUND_COMPLETED)
|
75
|
+
end
|
76
|
+
if action_feedback.include?('All challenges have been completed')
|
77
|
+
@recording_system.tell_to_stop
|
78
|
+
end
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@
|
80
|
+
@audit_stream.write_line action_feedback
|
81
|
+
round_description = @challenge_server_client.get_round_description
|
82
|
+
RoundManagement.save_description(@recording_system, round_description, @audit_stream, @config.get_working_directory)
|
83
|
+
rescue ChallengeServerClient::ClientErrorException => e
|
84
|
+
@audit_stream.write_line e.message
|
85
|
+
rescue ChallengeServerClient::ServerErrorException => e
|
86
|
+
@audit_stream.write_line 'Server experienced an error. Try again in a few minutes.'
|
87
|
+
rescue ChallengeServerClient::OtherCommunicationException => e
|
88
|
+
@audit_stream.write_line 'Client threw an unexpected error. Try again.'
|
92
89
|
end
|
93
|
-
|
94
|
-
@audit_stream.write_line action_feedback
|
95
|
-
@challenge_server_client.get_round_description
|
96
90
|
end
|
97
91
|
|
92
|
+
|
98
93
|
end
|
99
94
|
|
100
95
|
end
|
@@ -42,25 +42,36 @@ class RecordingSystem
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def notify_event(round_id, event_name)
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
puts "Notify round #{round_id}, event #{event_name}"
|
46
|
+
_send_post("/notify", "#{round_id}/#{event_name}")
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def tell_to_stop
|
50
|
+
puts "Stopping recording system"
|
51
|
+
_send_post("/stop", "")
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
def _send_post(endpoint, body)
|
55
|
+
unless @recording_required
|
56
|
+
return
|
57
|
+
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
begin
|
60
|
+
response = Unirest.post "#{RECORDING_SYSTEM_ENDPOINT}#{endpoint}",
|
61
|
+
parameters: body
|
62
|
+
|
63
|
+
unless response.code == 200
|
64
|
+
puts "Recording system returned code: #{response.code}"
|
65
|
+
return
|
63
66
|
end
|
67
|
+
|
68
|
+
unless response.body.start_with?('ACK')
|
69
|
+
puts "Recording system returned body: #{response.body}"
|
70
|
+
end
|
71
|
+
rescue StandardError => e
|
72
|
+
puts "Could not reach recording system: #{e.message}"
|
73
|
+
end
|
64
74
|
end
|
65
75
|
|
76
|
+
|
66
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdl-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Ghionoiu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stomp
|
@@ -243,7 +243,7 @@ homepage: https://github.com/julianghionoiu/tdl-client-ruby
|
|
243
243
|
licenses:
|
244
244
|
- GPL-3.0
|
245
245
|
metadata:
|
246
|
-
previous_version: 0.
|
246
|
+
previous_version: 0.21.1
|
247
247
|
post_install_message:
|
248
248
|
rdoc_options: []
|
249
249
|
require_paths:
|
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.7.
|
263
|
+
rubygems_version: 2.7.7
|
264
264
|
signing_key:
|
265
265
|
specification_version: 4
|
266
266
|
summary: A client to connect to the central kata server.
|