modsvaskr 0.1.0 → 0.1.5

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: cf22182b9e2f38b08900947b107bac303c8d9c6eebbc7b10ce80b88a899fd4da
4
- data.tar.gz: 58a6a9f16573766eec853391ef1aa0efd2a649a691e530a16bbc8de0268c11b9
3
+ metadata.gz: 891a0a4201c62018b26798acd86da140eb757f5633665d29ab2aadbb39fdb8e3
4
+ data.tar.gz: e03c3b7816308b0a153d890f09f86cfadc892c0da1537770fedf4ecbdea5aca7
5
5
  SHA512:
6
- metadata.gz: 87849b6c50f3cc08db5d150fada9511ff412ab2458310a2f6e64c6126f7037e7e656a379c383b7598449e728be0f925bdb06df39a2e760895c4c9b3a1aca85ff
7
- data.tar.gz: 10edfe86882d700c6a052276810b9e21aff2022a89e6b4d082ca03ab4eedb00a8ac0604e93a637492778823c7720133103c72d5adeb06d1240ada02d58a75fb5
6
+ metadata.gz: 34f1d6bf79e7301e8bfb12d8ab2dcb6372f62589bd4c6a7f508e4636d337dc2c72e90db41c06ce2a3a65f49f8ae308eb0b11910fd206906aa92c817ba6529932
7
+ data.tar.gz: 2035854e4ac51da63b9a6fc7006289b88a307acd92aa8213613dcb10306d787b49dcc40ec087740aaf932a1b56668820fbe3e595887d0df014eaba85b96da201
@@ -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
@@ -66,8 +67,14 @@ module Modsvaskr
66
67
  }
67
68
  )
68
69
  )
69
- # Clear the AutoTest test statuses
70
- File.unlink("#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json") if File.exist?("#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json")
70
+ # Clear the AutoTest test statuses that we are going to run
71
+ statuses_file = "#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json"
72
+ if File.exist?(statuses_file)
73
+ File.write(
74
+ statuses_file,
75
+ JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })
76
+ )
77
+ end
71
78
  end
72
79
  auto_test_config_file = "#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json"
73
80
  # Write the JSON file that contains the configuration of the AutoTest tests runner
@@ -204,11 +211,15 @@ module Modsvaskr
204
211
  end
205
212
  end
206
213
  # We will start again. Leave some time to interrupt if we want.
214
+ unless @config.no_prompt
215
+ # First, flush stdin of any pending character
216
+ $stdin.getc while !select([$stdin], nil, nil, 2).nil?
217
+ end
207
218
  out "We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it."
208
219
  key_pressed =
209
220
  begin
210
221
  Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }
211
- rescue
222
+ rescue Timeout::Error
212
223
  nil
213
224
  end
214
225
  if key_pressed
@@ -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)
@@ -146,15 +147,18 @@ module Modsvaskr
146
147
  # This is a callback called for each in-game test status change.
147
148
  # Update the tests results based on what has been run in-game.
148
149
  # Find all tests suites that are subscribed to those in-game tests.
149
- in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|
150
- selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])
151
- unless selected_in_game_tests_statuses.empty?
152
- tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]
153
- tests_suite.set_statuses(
154
- tests_suite.
155
- parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).
156
- select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }
157
- )
150
+ # Be careful that updates can be given for in-game tests suites we were not expecting
151
+ if in_game_tests_subscriptions.key?(in_game_tests_suite)
152
+ in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|
153
+ selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])
154
+ unless selected_in_game_tests_statuses.empty?
155
+ tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]
156
+ tests_suite.set_statuses(
157
+ tests_suite.
158
+ parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).
159
+ select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }
160
+ )
161
+ end
158
162
  end
159
163
  end
160
164
  end
@@ -1,5 +1,5 @@
1
1
  module Modsvaskr
2
2
 
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.5'
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.0
4
+ version: 0.1.5
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-18 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses_menu