reinforce 0.2.0 → 0.2.2

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: ce4b276c117912159c3ae62126f7b8f64e9742696a7e1d266e9da4f80f12e55c
4
- data.tar.gz: dce5ee59db328ccbb329abf60325f46443ec2525e16684df73cf8b7dab6cec0c
3
+ metadata.gz: 0d893233172c8657e08b8f337e8c40f524fbd4c61d2ab2468d4e15c660b9ca9c
4
+ data.tar.gz: 6161ddfb8762be431ba88353f80b7900e225226fbb1d0b0cca0490790ef1cb42
5
5
  SHA512:
6
- metadata.gz: 37167278ccbab5f28625b1c65ba5b32597ffd4956714b46c9b3478286c63d73dda7f2e8f09235ed435844fe900945dfab50bf1b40d264aded5f067428745c179
7
- data.tar.gz: b1ef2dd4a85fcbbab874d2095a1c9e507dc682249dc9365e10330a34edee90f53a6c73b5d6082398fc004f24453d9fae25d0dc455007625d06d52093487bf467
6
+ metadata.gz: 9d05a0d0ad8c3d917db933e47c41308bd8e78ba767db951387040bae5fb364bae616e4cc7aeb026a37a9cc0de096b1b0880dc7f8d007a216ae7277e58228b94f
7
+ data.tar.gz: f6034c10cbcee33326ad09f342ec75b749d900e0bc0cc8472f8bf4d02a09e31b551197c469f355bfe3c7bc006d8d093e90e6ec8073049ff36a6c8c2c621111f6
data/.rubocop.yml CHANGED
@@ -17,7 +17,7 @@ Metrics/ClassLength:
17
17
  Enabled: false
18
18
 
19
19
  Metrics/MethodLength:
20
- Max: 15
20
+ Max: 20
21
21
 
22
22
  Metrics/ParameterLists:
23
23
  Max: 10
@@ -97,6 +97,8 @@ module Reinforce
97
97
  cursor = next_build_for(cursor)
98
98
  end
99
99
 
100
+ Reinforce.logger.error("no data for pbgid #{pbgid} build #{build}")
101
+
100
102
  nil
101
103
  end
102
104
 
@@ -121,6 +123,8 @@ module Reinforce
121
123
  cursor = next_build_for(cursor)
122
124
  end
123
125
 
126
+ Reinforce.logger.error("no data for path #{path} build #{build}")
127
+
124
128
  nil
125
129
  end
126
130
 
@@ -48,7 +48,7 @@ module Reinforce
48
48
  end
49
49
 
50
50
  def classify_building_command(command)
51
- @buildings << command if command.details.autobuild?
51
+ @buildings << command if command.details&.autobuild?
52
52
 
53
53
  true
54
54
  end
@@ -94,21 +94,25 @@ module Reinforce
94
94
  end
95
95
 
96
96
  # rubocop:disable Metrics/AbcSize
97
+ # rubocop:disable Metrics/CyclomaticComplexity
98
+ # rubocop:disable Metrics/PerceivedComplexity
97
99
  def rectify_suspects(commands)
98
100
  commands.each_with_index do |command, idx|
99
101
  next unless command.suspect?
100
102
 
101
- building_details = Attributes::Collection.instance.get_by_path(command.details.builds, build: @build_number)
103
+ building_details = Attributes::Collection.instance.get_by_path(command.details&.builds, build: @build_number)
102
104
  remaining = commands[(idx + 1)..]
103
105
  relevant = remaining.take_while { |c| c.pbgid != command.pbgid }
104
106
 
105
107
  used = relevant.any? do |c|
106
- building_details.produces?(c.details.path)
108
+ building_details&.produces?(c.details&.path)
107
109
  end
108
110
 
109
111
  command.mark_legit if used
110
112
  end
111
113
  end
114
+ # rubocop:enable Metrics/PerceivedComplexity
115
+ # rubocop:enable Metrics/CyclomaticComplexity
112
116
  # rubocop:enable Metrics/AbcSize
113
117
  end
114
118
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reinforce
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
data/lib/reinforce.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'logger'
4
+
3
5
  require_relative 'reinforce/attributes/base'
4
6
 
5
7
  require_relative 'reinforce/attributes/ability'
@@ -19,6 +21,12 @@ module Reinforce
19
21
  File.expand_path('../', File.dirname(__FILE__))
20
22
  end
21
23
 
24
+ def self.logger
25
+ @logger ||= Logger.new($stdout).tap do |logger|
26
+ logger.progname = name
27
+ end
28
+ end
29
+
22
30
  # Takes a Vault Player and generates a build order
23
31
  def self.build_for(player, build_number, with_cancellations: false)
24
32
  Factory.new(player, build_number).build(with_cancellations:)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reinforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryantaylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-11 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vault_coh