tdl-client-ruby 0.20.4 → 0.21.1
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/Gemfile +1 -1
- data/lib/tdl/previous_version.rb +1 -1
- data/lib/tdl/runner/challenge_session.rb +6 -1
- data/lib/tdl/runner/recording_system.rb +16 -12
- data/lib/tdl/runner/round_management.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c2946fef767b43f89dabb751fe533d47ade5875407725d310505e49bdb02c636
|
4
|
+
data.tar.gz: 62338aa99a4160bf3415883d5b7fcb6bbc9382f8958303cb09fdcafaf309f61e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3340ba277189e1a9fbed0311fbf17cd2ebbc5d4f700480cb5d6449be9263d456fe1660b78a0392750ca74a3c85de6ded334d79d0660ba936f1642cc6b2fd24d4
|
7
|
+
data.tar.gz: 50328c8ac9c44bbd3f5a6a41527b2924424991f16d980373f8ce3705e515dff90b3fb4d765e058a2e797501f9175c0ca57692e8cd5aed2aaec1f98b285f90fe3
|
data/Gemfile
CHANGED
data/lib/tdl/previous_version.rb
CHANGED
@@ -78,7 +78,7 @@ module TDL
|
|
78
78
|
if user_input == 'deploy'
|
79
79
|
@runner.run
|
80
80
|
last_fetched_round = RoundManagement.get_last_fetched_round(@config.get_working_directory)
|
81
|
-
@recording_system.
|
81
|
+
@recording_system.notify_event(last_fetched_round, RecordingEvent::ROUND_SOLUTION_DEPLOY)
|
82
82
|
end
|
83
83
|
|
84
84
|
execute_action user_input
|
@@ -86,6 +86,11 @@ module TDL
|
|
86
86
|
|
87
87
|
def execute_action(user_input)
|
88
88
|
action_feedback = @challenge_server_client.send_action user_input
|
89
|
+
if action_feedback.include?('Round time for')
|
90
|
+
last_fetched_round = RoundManagement.get_last_fetched_round(@config.get_working_directory)
|
91
|
+
@recording_system.notify_event(last_fetched_round, RecordingEvent::ROUND_COMPLETED)
|
92
|
+
end
|
93
|
+
|
89
94
|
@audit_stream.write_line action_feedback
|
90
95
|
@challenge_server_client.get_round_description
|
91
96
|
end
|
@@ -3,8 +3,15 @@ require 'tdl/runner/runner_action'
|
|
3
3
|
|
4
4
|
RECORDING_SYSTEM_ENDPOINT = 'http://localhost:41375'
|
5
5
|
|
6
|
+
module RecordingEvent
|
7
|
+
ROUND_START = 'new'
|
8
|
+
ROUND_SOLUTION_DEPLOY = 'deploy'
|
9
|
+
ROUND_COMPLETED = 'done'
|
10
|
+
end
|
11
|
+
|
12
|
+
|
6
13
|
class RecordingSystem
|
7
|
-
|
14
|
+
|
8
15
|
def initialize(recording_required)
|
9
16
|
@recording_required = recording_required
|
10
17
|
end
|
@@ -14,7 +21,7 @@ class RecordingSystem
|
|
14
21
|
end
|
15
22
|
|
16
23
|
def is_recording_system_ok
|
17
|
-
|
24
|
+
is_recording_required ? is_running : true
|
18
25
|
end
|
19
26
|
|
20
27
|
def is_running
|
@@ -29,28 +36,25 @@ class RecordingSystem
|
|
29
36
|
false
|
30
37
|
end
|
31
38
|
|
32
|
-
def deploy_notify_event(last_fetched_round)
|
33
|
-
notify_event(last_fetched_round, RunnerActions.deploy_to_production.short_name)
|
34
|
-
end
|
35
39
|
|
36
|
-
def on_new_round(round_id
|
37
|
-
notify_event(round_id,
|
40
|
+
def on_new_round(round_id)
|
41
|
+
notify_event(round_id, RecordingEvent::ROUND_START)
|
38
42
|
end
|
39
43
|
|
40
|
-
def notify_event(
|
44
|
+
def notify_event(round_id, event_name)
|
41
45
|
if not @recording_required
|
42
46
|
return
|
43
47
|
end
|
44
|
-
|
48
|
+
|
45
49
|
begin
|
46
50
|
response = Unirest.post "#{RECORDING_SYSTEM_ENDPOINT}/notify",
|
47
|
-
parameters:"#{
|
48
|
-
|
51
|
+
parameters:"#{round_id}/#{event_name}"
|
52
|
+
|
49
53
|
unless response.code == 200
|
50
54
|
puts "Recording system returned code: #{response.code}"
|
51
55
|
return
|
52
56
|
end
|
53
|
-
|
57
|
+
|
54
58
|
unless response.body.start_with?('ACK')
|
55
59
|
puts "Recording system returned body: #{response.body}"
|
56
60
|
end
|
@@ -12,7 +12,7 @@ module RoundManagement
|
|
12
12
|
|
13
13
|
newline_index = raw_description.index("\n")
|
14
14
|
round_id = raw_description[0..newline_index - 1]
|
15
|
-
listener.on_new_round(round_id
|
15
|
+
listener.on_new_round(round_id) if round_id != get_last_fetched_round(working_directory)
|
16
16
|
|
17
17
|
display_and_save_description(round_id, raw_description, audit_stream, working_directory)
|
18
18
|
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.21.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-05-13 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.20.
|
246
|
+
previous_version: 0.20.4
|
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.6
|
263
|
+
rubygems_version: 2.7.6
|
264
264
|
signing_key:
|
265
265
|
specification_version: 4
|
266
266
|
summary: A client to connect to the central kata server.
|