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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2946fef767b43f89dabb751fe533d47ade5875407725d310505e49bdb02c636
4
- data.tar.gz: 62338aa99a4160bf3415883d5b7fcb6bbc9382f8958303cb09fdcafaf309f61e
3
+ metadata.gz: c010e01bbf54e96598f837d6dbad4d2522e8ece8c359a934e6d248fb73ac40da
4
+ data.tar.gz: ab556e467482c6a227d55e8425ed338bf2899856b114617f96e9c49cb53eebce
5
5
  SHA512:
6
- metadata.gz: 3340ba277189e1a9fbed0311fbf17cd2ebbc5d4f700480cb5d6449be9263d456fe1660b78a0392750ca74a3c85de6ded334d79d0660ba936f1642cc6b2fd24d4
7
- data.tar.gz: 50328c8ac9c44bbd3f5a6a41527b2924424991f16d980373f8ce3705e515dff90b3fb4d765e058a2e797501f9175c0ca57692e8cd5aed2aaec1f98b285f90fe3
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
 
@@ -1,4 +1,4 @@
1
1
  module TDL
2
- PREVIOUS_VERSION = '0.20.4'
2
+ PREVIOUS_VERSION = '0.21.1'
3
3
  # the current MAJOR.MINOR version is dynamically computed from the version of the Spec
4
4
  end
@@ -46,55 +46,50 @@ module TDL
46
46
  @config.get_use_colours)
47
47
 
48
48
  begin
49
- should_continue = check_status_of_challenge
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
- journey_progress = @challenge_server_client.get_journey_progress
69
- @audit_stream.write_line(journey_progress)
51
+ journey_progress = @challenge_server_client.get_journey_progress
52
+ @audit_stream.write_line(journey_progress)
70
53
 
71
- available_actions = @challenge_server_client.get_available_actions
72
- @audit_stream.write_line(available_actions)
54
+ available_actions = @challenge_server_client.get_available_actions
55
+ @audit_stream.write_line(available_actions)
73
56
 
74
- not(available_actions.include?('No actions available.'))
75
- end
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
- def execute_user_action(user_input)
78
- if user_input == 'deploy'
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
- end
69
+ end
83
70
 
84
- execute_action user_input
85
- end
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
- def execute_action(user_input)
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)
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
- if not @recording_required
46
- return
47
- end
45
+ puts "Notify round #{round_id}, event #{event_name}"
46
+ _send_post("/notify", "#{round_id}/#{event_name}")
47
+ end
48
48
 
49
- begin
50
- response = Unirest.post "#{RECORDING_SYSTEM_ENDPOINT}/notify",
51
- parameters:"#{round_id}/#{event_name}"
49
+ def tell_to_stop
50
+ puts "Stopping recording system"
51
+ _send_post("/stop", "")
52
+ end
52
53
 
53
- unless response.code == 200
54
- puts "Recording system returned code: #{response.code}"
55
- return
56
- end
54
+ def _send_post(endpoint, body)
55
+ unless @recording_required
56
+ return
57
+ end
57
58
 
58
- unless response.body.start_with?('ACK')
59
- puts "Recording system returned body: #{response.body}"
60
- end
61
- rescue StandardError => e
62
- puts "Could not reach recording system: #{e.message}"
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.21.1
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-05-13 00:00:00.000000000 Z
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.20.4
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.6
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.