modsvaskr 0.1.12 → 0.2.0

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: 2c41c160023d7591e52e7b93fde57bc33462627d61714384aa3051c8f8052f99
4
- data.tar.gz: 4e30b5822a983d6e57772ba65e19d7b8b657163c5b3c4d275bb55a61376c9e2c
3
+ metadata.gz: 6caea974a5397c715e9db769996a3f54743087b12fbdacb99afd362ade4f8ede
4
+ data.tar.gz: 8af266d6861b5a3b8c44b0ddbb9d73771b6afe731edd0637d27f4426d7552119
5
5
  SHA512:
6
- metadata.gz: 61ced31f7a9f75bb9679e47045cdfd38d6071f1eb91587cab8a3aa83c8c6d2de559402e3995b65f020a1acf6ce31d2ca96e31341960906c87f0717991a669f1e
7
- data.tar.gz: c7e3610bc8f62f290fa586e66489f5f4e69b40942814a0ba56237716c925cb5ee7878152f58f9dfc94746242d84dd48bd67f96a37e903db3169cafd19ee2f533
6
+ metadata.gz: 55f3a256e428d8ac50dce938915f0eb4910f6b9281a56ef69eb140556a7d41058d431cc28520bfe982e859be4e083afedbe39f9d7897caf6ad7f952672b61ced
7
+ data.tar.gz: e444a4bc0e219245a3b29ce9d01183f64792fbed1d6e4fe7e8a09cffa124577a19af100309e85b237315bd6d3c5b46544507989e9f08e8ac542f7b04386eb6ec
@@ -15,14 +15,14 @@ module Modsvaskr
15
15
  @config = YAML.safe_load(File.read(file)) || {}
16
16
  # Parse all game types plugins
17
17
  # Hash<Symbol, Class>
18
- @game_types = Dir.glob("#{__dir__}/games/*.rb").map do |game_type_file|
18
+ @game_types = Dir.glob("#{__dir__}/games/*.rb").to_h do |game_type_file|
19
19
  require game_type_file
20
20
  base_name = File.basename(game_type_file, '.rb')
21
21
  [
22
22
  base_name.to_sym,
23
23
  Games.const_get(base_name.split('_').collect(&:capitalize).join.to_sym)
24
24
  ]
25
- end.to_h
25
+ end
26
26
  end
27
27
 
28
28
  # Get the games list
@@ -50,6 +50,10 @@ module Modsvaskr
50
50
  dawnguard.esm
51
51
  hearthfires.esm
52
52
  dragonborn.esm
53
+ ccbgssse001-fish.esm
54
+ ccqdrsse001-survivalmode.esl
55
+ ccbgssse037-curios.esl
56
+ ccbgssse025-advdsgs.esm
53
57
  ]
54
58
  end
55
59
 
@@ -60,7 +64,7 @@ module Modsvaskr
60
64
  # * Array<String>: List of all active plugins, including masters
61
65
  def read_load_order
62
66
  game_esps +
63
- File.read("#{ENV['USERPROFILE']}/AppData/Local/Skyrim Special Edition/plugins.txt").split("\n").map do |line|
67
+ File.read("#{ENV.fetch('USERPROFILE')}/AppData/Local/Skyrim Special Edition/plugins.txt").split("\n").map do |line|
64
68
  line =~ /^\*(.+)$/ ? Regexp.last_match(1).downcase : nil
65
69
  end.compact
66
70
  end
@@ -54,7 +54,7 @@ module Modsvaskr
54
54
  def run(selected_tests)
55
55
  unknown_tests_suites = selected_tests.keys - @available_tests_suites
56
56
  log "[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}" unless unknown_tests_suites.empty?
57
- tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }
57
+ tests_to_run = selected_tests.except(*unknown_tests_suites)
58
58
  return if tests_to_run.empty?
59
59
 
60
60
  FileUtils.mkdir_p "#{@game.path}/Data/SKSE/Plugins/StorageUtilData"
@@ -171,7 +171,7 @@ module Modsvaskr
171
171
  # Check for which reason the game has stopped, and eventually end the testing session.
172
172
  # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.
173
173
  # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks
174
- auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h
174
+ auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].to_h { |key, value| [key.downcase, value.downcase] }
175
175
  if auto_test_config['stopped_by'] == 'user'
176
176
  log "[ In-game testing #{@game.name} ] - Tests have been stopped by user."
177
177
  break
@@ -199,12 +199,12 @@ module Modsvaskr
199
199
  File.write(
200
200
  "#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json",
201
201
  JSON.pretty_generate(
202
- 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|
202
+ 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).to_h do |(test_name, test_status)|
203
203
  [
204
204
  test_name,
205
205
  test_name == first_test_to_run ? 'failed_ctd' : test_status
206
206
  ]
207
- end.to_h
207
+ end
208
208
  )
209
209
  )
210
210
  # Notify the callbacks updating test statuses
@@ -21,14 +21,14 @@ module Modsvaskr
21
21
  @config = config
22
22
  @game = game
23
23
  # Parse tests suites
24
- @tests_suites = Dir.glob("#{__dir__}/tests_suites/*.rb").map do |tests_suite_file|
24
+ @tests_suites = Dir.glob("#{__dir__}/tests_suites/*.rb").to_h do |tests_suite_file|
25
25
  tests_suite = File.basename(tests_suite_file, '.rb').to_sym
26
26
  require "#{__dir__}/tests_suites/#{tests_suite}.rb"
27
27
  [
28
28
  tests_suite,
29
29
  TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)
30
30
  ]
31
- end.to_h
31
+ end
32
32
  @tests_info_file = "#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json"
33
33
  end
34
34
 
@@ -136,7 +136,7 @@ module Modsvaskr
136
136
  selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)
137
137
  in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)
138
138
  in_game_tests_subscriptions[in_game_tests_suite] << {
139
- tests_suite: tests_suite,
139
+ tests_suite:,
140
140
  in_game_tests: selected_in_game_tests_downcase,
141
141
  selected_tests: suite_selected_tests
142
142
  }
@@ -175,12 +175,12 @@ module Modsvaskr
175
175
  unless defined?(@tests_info_cache)
176
176
  @tests_info_cache =
177
177
  if File.exist?(@tests_info_file)
178
- JSON.parse(File.read(@tests_info_file)).map do |tests_suite_str, tests_suite_info|
178
+ JSON.parse(File.read(@tests_info_file)).to_h do |tests_suite_str, tests_suite_info|
179
179
  [
180
180
  tests_suite_str.to_sym,
181
181
  tests_suite_info.transform_values { |test_info| test_info.transform_keys(&:to_sym) }
182
182
  ]
183
- end.to_h
183
+ end
184
184
  else
185
185
  {}
186
186
  end
@@ -52,7 +52,7 @@ module Modsvaskr
52
52
 
53
53
  # Remove all tests from this suite
54
54
  def clear_tests
55
- File.unlink(json_statuses_file) if File.exist?(json_statuses_file)
55
+ FileUtils.rm_f(json_statuses_file)
56
56
  end
57
57
 
58
58
  private
@@ -46,14 +46,14 @@ module Modsvaskr
46
46
  flatten.
47
47
  sort.
48
48
  uniq.
49
- map do |cell_name|
49
+ to_h do |cell_name|
50
50
  [
51
51
  cell_name,
52
52
  {
53
53
  name: "Load cell #{cell_name}"
54
54
  }
55
55
  ]
56
- end.to_h
56
+ end
57
57
  end
58
58
 
59
59
  end
data/lib/modsvaskr/ui.rb CHANGED
@@ -45,13 +45,13 @@ module Modsvaskr
45
45
  end
46
46
  CursesMenu.new(
47
47
  "Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods#{!last_modsvaskr_version.nil? && last_modsvaskr_version != Modsvaskr::VERSION ? " - !!! New version available: #{last_modsvaskr_version}" : ''}",
48
- key_presses: key_presses
48
+ key_presses:
49
49
  ) do |main_menu|
50
50
  @config.games.each do |game|
51
51
  main_menu.item "#{game.name} (#{game.path})" do
52
52
  CursesMenu.new(
53
53
  "Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods > #{game.name}",
54
- key_presses: key_presses
54
+ key_presses:
55
55
  ) do |game_menu|
56
56
  game_menu.item 'Testing' do
57
57
  # Read tests info
@@ -61,7 +61,7 @@ module Modsvaskr
61
61
  selected_tests_suites = {}
62
62
  CursesMenu.new(
63
63
  "Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods > #{game.name} > Testing",
64
- key_presses: key_presses
64
+ key_presses:
65
65
  ) do |test_menu|
66
66
  tests_runner.tests_suites.each do |tests_suite|
67
67
  statuses_for_suite = tests_runner.statuses_for(tests_suite)
@@ -83,7 +83,7 @@ module Modsvaskr
83
83
  execute: proc do
84
84
  CursesMenu.new(
85
85
  "Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods > #{game.name} > Testing > Tests #{tests_suite}",
86
- key_presses: key_presses
86
+ key_presses:
87
87
  ) do |tests_suite_menu|
88
88
  statuses_for_suite.each do |(test_name, test_status)|
89
89
  test_selected = selected_tests_suites.key?(tests_suite) && selected_tests_suites[tests_suite].key?(test_name)
@@ -110,7 +110,7 @@ module Modsvaskr
110
110
  if all_tests_selected
111
111
  selected_tests_suites.delete(tests_suite)
112
112
  else
113
- selected_tests_suites[tests_suite] = statuses_for_suite.map { |(test_name, _test_status)| [test_name, nil] }.to_h
113
+ selected_tests_suites[tests_suite] = statuses_for_suite.to_h { |(test_name, _test_status)| [test_name, nil] }
114
114
  end
115
115
  :menu_refresh
116
116
  end
@@ -179,7 +179,7 @@ module Modsvaskr
179
179
  main_menu.item 'See logs' do
180
180
  CursesMenu.new(
181
181
  'Modsvaskr - Stronghold of Mods > Logs',
182
- key_presses: key_presses
182
+ key_presses:
183
183
  ) do |logs_menu|
184
184
  File.read(Logger.log_file).split("\n").each do |line|
185
185
  logs_menu.item line
@@ -1,5 +1,5 @@
1
1
  module Modsvaskr
2
2
 
3
- VERSION = '0.1.12'
3
+ VERSION = '0.2.0'
4
4
 
5
5
  end
@@ -53,11 +53,11 @@ module Modsvaskr
53
53
  #
54
54
  # Parameters::
55
55
  # * *csv* (String): Name of the CSV file (from Edit Scripts), without .csv
56
- # * *row_block* (Proc): Code called for each CSV row
56
+ # * Proc: Code called for each CSV row
57
57
  # Parameters::
58
58
  # * *row* (Array<String>): CSV row
59
- def parse_csv(csv, &row_block)
60
- CSV.parse(Encoding.to_utf_8(File.read("#{install_path}/Edit Scripts/#{csv}.csv", mode: 'rb'))).each(&row_block)
59
+ def parse_csv(csv, &)
60
+ CSV.parse(Encoding.to_utf_8(File.read("#{install_path}/Edit Scripts/#{csv}.csv", mode: 'rb'))).each(&)
61
61
  end
62
62
 
63
63
  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.12
4
+ version: 0.2.0
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-08-18 00:00:00.000000000 Z
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses_menu
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.12'
47
+ version: '1.13'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.12'
54
+ version: '1.13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.10'
61
+ version: '3.12'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.10'
68
+ version: '3.12'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.14'
75
+ version: '3.18'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.14'
82
+ version: '3.18'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sem_ver_components
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.19'
103
+ version: '1.41'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.19'
110
+ version: '1.41'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.4'
117
+ version: '2.16'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.4'
124
+ version: '2.16'
125
125
  description: Command-line UI handling a full Mods' ecosystem for Bethesda's games.
126
126
  email:
127
127
  - muriel@x-aeon.com
@@ -152,7 +152,8 @@ files:
152
152
  homepage: https://github.com/Muriel-Salvan/modsvaskr
153
153
  licenses:
154
154
  - BSD-3-Clause
155
- metadata: {}
155
+ metadata:
156
+ rubygems_mfa_required: 'true'
156
157
  post_install_message:
157
158
  rdoc_options: []
158
159
  require_paths:
@@ -161,14 +162,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
162
  requirements:
162
163
  - - ">="
163
164
  - !ruby/object:Gem::Version
164
- version: '2.6'
165
+ version: '3.1'
165
166
  required_rubygems_version: !ruby/object:Gem::Requirement
166
167
  requirements:
167
168
  - - ">="
168
169
  - !ruby/object:Gem::Version
169
170
  version: '0'
170
171
  requirements: []
171
- rubygems_version: 3.0.3.1
172
+ rubygems_version: 3.3.26
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: 'Stronghold for mods acting like companions: The Modsvaskr'