modsvaskr 0.1.3 → 0.1.8

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
2
  SHA256:
3
- metadata.gz: 0c7e455fc3db208e896aa655d1dba0fd91f948cf2dfd1acb5787d2d723ab9e0a
4
- data.tar.gz: 012ee74df256dc2f3b3b2b1d33677c2b926b7a58b73f2398d05073e68a197394
3
+ metadata.gz: 3a5763808fa45e04cd82bcaf607b12729ca43b5c2a40b8e3476abb3f012154e2
4
+ data.tar.gz: 428994ca324ac277fcfcb3e76f2c0a88ee6f8a53d0e862fbdbf7b6abca5323ed
5
5
  SHA512:
6
- metadata.gz: ab3dac575ad2d9266c6d3167d76c586cae9e5fe7b5169166117ffd09adad1f4c990e20d37f66a3d369fb5694dbe4bd241122ccee33f9008820599bedd74a3459
7
- data.tar.gz: 4c5801dc0f8e71a3ebe33be2d42338f1ac73a2afae775d70a0374a212c7c14864027983f95f8267f24ddad22cce4efd5c3f8a15ab3a094b22c080c4cafea161e
6
+ metadata.gz: 629deb5ebde244b3d4eee1d0195aa6c8e84a96282a6968fc99e95a878e911d98bb3d50dd9538ede549163225e54bec1a92e3ac6c5befdca6dc15d3b4bc7c925b
7
+ data.tar.gz: 62f17178509041879839df331bcb6db369484159d6b13fe4a2c542ea70878a8571294dd006f68ae92ed0150f65b53daad8c10fbcd1563e2ea07796fedf5c7dff
@@ -3,6 +3,7 @@ require 'elder_scrolls_plugin'
3
3
  require 'fileutils'
4
4
  require 'json'
5
5
  require 'time'
6
+ require 'timeout'
6
7
  require 'modsvaskr/tests_suite'
7
8
 
8
9
  module Modsvaskr
@@ -210,21 +211,23 @@ module Modsvaskr
210
211
  end
211
212
  end
212
213
  # We will start again. Leave some time to interrupt if we want.
213
- unless @config.no_prompt
214
+ if @config.no_prompt
215
+ out 'Start again automatically as no_prompt has been set.'
216
+ else
214
217
  # First, flush stdin of any pending character
215
218
  $stdin.getc while !select([$stdin], nil, nil, 2).nil?
216
- end
217
- out "We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it."
218
- key_pressed =
219
- begin
220
- Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }
221
- rescue
222
- nil
219
+ out "We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it."
220
+ key_pressed =
221
+ begin
222
+ Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }
223
+ rescue Timeout::Error
224
+ nil
225
+ end
226
+ if key_pressed
227
+ log "[ In-game testing #{@game.name} ] - Run interrupted by user."
228
+ # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.
229
+ break
223
230
  end
224
- if key_pressed
225
- log "[ In-game testing #{@game.name} ] - Run interrupted by user."
226
- # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.
227
- break
228
231
  end
229
232
  end
230
233
  end
@@ -0,0 +1,39 @@
1
+ module Modsvaskr
2
+
3
+ # Mixin adding methods to map directly a tests suite to an in-game tests suite
4
+ # Uses the following methods:
5
+ # * *in_game_tests_suite* -> Symbol: Name of the in-gamer tests suite on which we forward the tests run
6
+ module InGameTestsSuite
7
+
8
+ # Get the list of tests to be run in-game for a given list of test names.
9
+ # [API] - This method is mandatory for tests needing to be run in-game.
10
+ #
11
+ # Parameters::
12
+ # * *tests* (Array<String>): List of test names
13
+ # Result::
14
+ # * Hash<Symbol, Array<String> >: List of in-game test names, per in-game tests suite
15
+ def in_game_tests_for(tests)
16
+ { in_game_tests_suite => tests }
17
+ end
18
+
19
+ # Set statuses based on the result of AutoTest statuses.
20
+ # AutoTest names are case insensitive.
21
+ # [API] - This method is mandatory for tests needing to be run in-game.
22
+ #
23
+ # Parameters::
24
+ # * *tests* (Array<String>): List of test names
25
+ # * *auto_test_statuses* (Hash<Symbol, Hash<String, String> >): In-game test statuses, per in-game test name, per in-game tests suite
26
+ # Result::
27
+ # * Array<[String, String]>: Corresponding list of [test name, test status]
28
+ def parse_auto_tests_statuses_for(tests, auto_test_statuses)
29
+ in_game_test_statuses = auto_test_statuses[in_game_tests_suite] || {}
30
+ tests.map do |test_name|
31
+ test_downcase = test_name.downcase
32
+ _in_game_test, in_game_test_status = in_game_test_statuses.find { |search_in_game_test, _search_in_game_test_status| search_in_game_test.downcase == test_downcase }
33
+ in_game_test_status.nil? ? nil : [test_name, in_game_test_status]
34
+ end.compact
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -131,14 +131,15 @@ module Modsvaskr
131
131
  in_game_tests.each do |tests_suite, selected_tests|
132
132
  in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(selected_tests)
133
133
  in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|
134
+ selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)
134
135
  in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)
135
136
  in_game_tests_subscriptions[in_game_tests_suite] << {
136
137
  tests_suite: tests_suite,
137
- in_game_tests: selected_in_game_tests,
138
+ in_game_tests: selected_in_game_tests_downcase,
138
139
  selected_tests: selected_tests
139
140
  }
140
141
  merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)
141
- merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests).uniq
142
+ merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq
142
143
  end
143
144
  end
144
145
  in_game_tests_runner = InGameTestsRunner.new(@config, @game)
@@ -1,9 +1,21 @@
1
+ require 'modsvaskr/in_game_tests_suite'
2
+
1
3
  module Modsvaskr
2
4
 
3
5
  module TestsSuites
4
6
 
5
7
  class ExteriorCell < TestsSuite
6
8
 
9
+ include InGameTestsSuite
10
+
11
+ # Return the in-game tests suite to which we forward the tests to be run
12
+ #
13
+ # Result::
14
+ # * Symbol: In-game tests suite
15
+ def in_game_tests_suite
16
+ :locations
17
+ end
18
+
7
19
  # Discover the list of tests information that could be run.
8
20
  # [API] - This method is mandatory
9
21
  #
@@ -98,30 +110,6 @@ module Modsvaskr
98
110
  tests
99
111
  end
100
112
 
101
- # Get the list of tests to be run in-game for a given list of test names.
102
- # [API] - This method is mandatory for tests needing to be run in-game.
103
- #
104
- # Parameters::
105
- # * *tests* (Array<String>): List of test names
106
- # Result::
107
- # * Hash<Symbol, Array<String> >: List of in-game test names, per in-game tests suite
108
- def in_game_tests_for(tests)
109
- { locations: tests }
110
- end
111
-
112
- # Set statuses based on the result of AutoTest statuses.
113
- # AutoTest names are case insensitive.
114
- # [API] - This method is mandatory for tests needing to be run in-game.
115
- #
116
- # Parameters::
117
- # * *tests* (Array<String>): List of test names
118
- # * *auto_test_statuses* (Hash<Symbol, Array<[String, String]> >): Ordered list of AutoTest [test name, test status], per AutoTest tests suite
119
- # Result::
120
- # * Array<[String, String]>: Corresponding list of [test name, test status]
121
- def parse_auto_tests_statuses_for(tests, auto_test_statuses)
122
- auto_test_statuses.key?(:locations) ? auto_test_statuses[:locations] : []
123
- end
124
-
125
113
  end
126
114
 
127
115
  end
@@ -1,9 +1,21 @@
1
+ require 'modsvaskr/in_game_tests_suite'
2
+
1
3
  module Modsvaskr
2
4
 
3
5
  module TestsSuites
4
6
 
5
7
  class InteriorCell < TestsSuite
6
8
 
9
+ include InGameTestsSuite
10
+
11
+ # Return the in-game tests suite to which we forward the tests to be run
12
+ #
13
+ # Result::
14
+ # * Symbol: In-game tests suite
15
+ def in_game_tests_suite
16
+ :locations
17
+ end
18
+
7
19
  # Discover the list of tests information that could be run.
8
20
  # [API] - This method is mandatory
9
21
  #
@@ -44,30 +56,6 @@ module Modsvaskr
44
56
  ]
45
57
  end
46
58
 
47
- # Get the list of tests to be run in-game for a given list of test names.
48
- # [API] - This method is mandatory for tests needing to be run in-game.
49
- #
50
- # Parameters::
51
- # * *tests* (Array<String>): List of test names
52
- # Result::
53
- # * Hash<Symbol, Array<String> >: List of in-game test names, per in-game tests suite
54
- def in_game_tests_for(tests)
55
- { locations: tests }
56
- end
57
-
58
- # Set statuses based on the result of AutoTest statuses.
59
- # AutoTest names are case insensitive.
60
- # [API] - This method is mandatory for tests needing to be run in-game.
61
- #
62
- # Parameters::
63
- # * *tests* (Array<String>): List of test names
64
- # * *auto_test_statuses* (Hash<Symbol, Array<[String, String]> >): Ordered list of AutoTest [test name, test status], per AutoTest tests suite
65
- # Result::
66
- # * Array<[String, String]>: Corresponding list of [test name, test status]
67
- def parse_auto_tests_statuses_for(tests, auto_test_statuses)
68
- auto_test_statuses.key?(:locations) ? auto_test_statuses[:locations] : []
69
- end
70
-
71
59
  end
72
60
 
73
61
  end
@@ -1,9 +1,21 @@
1
+ require 'modsvaskr/in_game_tests_suite'
2
+
1
3
  module Modsvaskr
2
4
 
3
5
  module TestsSuites
4
6
 
5
7
  class Npc < TestsSuite
6
8
 
9
+ include InGameTestsSuite
10
+
11
+ # Return the in-game tests suite to which we forward the tests to be run
12
+ #
13
+ # Result::
14
+ # * Symbol: In-game tests suite
15
+ def in_game_tests_suite
16
+ :npcs
17
+ end
18
+
7
19
  # Discover the list of tests information that could be run.
8
20
  # [API] - This method is mandatory
9
21
  #
@@ -20,30 +32,6 @@ module Modsvaskr
20
32
  tests
21
33
  end
22
34
 
23
- # Get the list of tests to be run in-game for a given list of test names.
24
- # [API] - This method is mandatory for tests needing to be run in-game.
25
- #
26
- # Parameters::
27
- # * *tests* (Array<String>): List of test names
28
- # Result::
29
- # * Hash<Symbol, Array<String> >: List of in-game test names, per in-game tests suite
30
- def in_game_tests_for(tests)
31
- { npcs: tests }
32
- end
33
-
34
- # Set statuses based on the result of AutoTest statuses.
35
- # AutoTest names are case insensitive.
36
- # [API] - This method is mandatory for tests needing to be run in-game.
37
- #
38
- # Parameters::
39
- # * *tests* (Array<String>): List of test names
40
- # * *auto_test_statuses* (Hash<Symbol, Array<[String, String]> >): Ordered list of AutoTest [test name, test status], per AutoTest tests suite
41
- # Result::
42
- # * Array<[String, String]>: Corresponding list of [test name, test status]
43
- def parse_auto_tests_statuses_for(tests, auto_test_statuses)
44
- auto_test_statuses.key?(:npcs) ? auto_test_statuses[:npcs] : []
45
- end
46
-
47
35
  end
48
36
 
49
37
  end
@@ -1,9 +1,21 @@
1
+ require 'modsvaskr/in_game_tests_suite'
2
+
1
3
  module Modsvaskr
2
4
 
3
5
  module TestsSuites
4
6
 
5
7
  class NpcHead < TestsSuite
6
8
 
9
+ include InGameTestsSuite
10
+
11
+ # Return the in-game tests suite to which we forward the tests to be run
12
+ #
13
+ # Result::
14
+ # * Symbol: In-game tests suite
15
+ def in_game_tests_suite
16
+ :npcshead
17
+ end
18
+
7
19
  # Discover the list of tests information that could be run.
8
20
  # [API] - This method is mandatory
9
21
  #
@@ -20,30 +32,6 @@ module Modsvaskr
20
32
  tests
21
33
  end
22
34
 
23
- # Get the list of tests to be run in-game for a given list of test names.
24
- # [API] - This method is mandatory for tests needing to be run in-game.
25
- #
26
- # Parameters::
27
- # * *tests* (Array<String>): List of test names
28
- # Result::
29
- # * Hash<Symbol, Array<String> >: List of in-game test names, per in-game tests suite
30
- def in_game_tests_for(tests)
31
- { npcshead: tests }
32
- end
33
-
34
- # Set statuses based on the result of AutoTest statuses.
35
- # AutoTest names are case insensitive.
36
- # [API] - This method is mandatory for tests needing to be run in-game.
37
- #
38
- # Parameters::
39
- # * *tests* (Array<String>): List of test names
40
- # * *auto_test_statuses* (Hash<Symbol, Array<[String, String]> >): Ordered list of AutoTest [test name, test status], per AutoTest tests suite
41
- # Result::
42
- # * Array<[String, String]>: Corresponding list of [test name, test status]
43
- def parse_auto_tests_statuses_for(tests, auto_test_statuses)
44
- auto_test_statuses.key?(:npcshead) ? auto_test_statuses[:npcshead] : []
45
- end
46
-
47
35
  end
48
36
 
49
37
  end
@@ -1,5 +1,5 @@
1
1
  module Modsvaskr
2
2
 
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.8'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modsvaskr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses_menu
@@ -107,6 +107,7 @@ files:
107
107
  - lib/modsvaskr/game.rb
108
108
  - lib/modsvaskr/games/skyrim_se.rb
109
109
  - lib/modsvaskr/in_game_tests_runner.rb
110
+ - lib/modsvaskr/in_game_tests_suite.rb
110
111
  - lib/modsvaskr/logger.rb
111
112
  - lib/modsvaskr/run_cmd.rb
112
113
  - lib/modsvaskr/tests_runner.rb