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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fa06f4cfebda29d3cc02c23b061f6726e72f0038
4
- data.tar.gz: 480a07f019c1bd689dd3a4f5b5b5a3fd5c6c68cb
2
+ SHA256:
3
+ metadata.gz: c2946fef767b43f89dabb751fe533d47ade5875407725d310505e49bdb02c636
4
+ data.tar.gz: 62338aa99a4160bf3415883d5b7fcb6bbc9382f8958303cb09fdcafaf309f61e
5
5
  SHA512:
6
- metadata.gz: 743ceb9a9eacbd64347094369fa7e710dfb0d2b9ab49dd6f61168acb1e4e18d4c88080d5179de8372fc02a6b80564b889833aeda6b3bc3c15aa2373d418fa45c
7
- data.tar.gz: 51fe054e7c3d2100d3d7fe1b5ab2cbb2fd09a55079a6d8833c29344fb210fd5c6a282b89b5e72273a4f0209e24165629c6ba2c9e6527a3fc6cd623411d77152a
6
+ metadata.gz: 3340ba277189e1a9fbed0311fbf17cd2ebbc5d4f700480cb5d6449be9263d456fe1660b78a0392750ca74a3c85de6ded334d79d0660ba936f1642cc6b2fd24d4
7
+ data.tar.gz: 50328c8ac9c44bbd3f5a6a41527b2924424991f16d980373f8ce3705e515dff90b3fb4d765e058a2e797501f9175c0ca57692e8cd5aed2aaec1f98b285f90fe3
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- ruby '2.2.2'
3
+ ruby '~> 2.2.2'
4
4
 
5
5
  # Specify your gem's dependencies in tdl-client-ruby.gemspec
6
6
  gemspec
@@ -1,4 +1,4 @@
1
1
  module TDL
2
- PREVIOUS_VERSION = '0.20.3'
2
+ PREVIOUS_VERSION = '0.20.4'
3
3
  # the current MAJOR.MINOR version is dynamically computed from the version of the Spec
4
4
  end
@@ -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.deploy_notify_event last_fetched_round
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
- return is_recording_required ? is_running : true
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, short_name)
37
- notify_event(round_id, short_name)
40
+ def on_new_round(round_id)
41
+ notify_event(round_id, RecordingEvent::ROUND_START)
38
42
  end
39
43
 
40
- def notify_event(last_fetched_round, short_name)
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:"#{last_fetched_round}/#{short_name}"
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, RunnerActions.get_new_round_description.short_name) if round_id != get_last_fetched_round(working_directory)
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.20.4
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-02-07 00:00:00.000000000 Z
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.3
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.14
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.