openra 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -2
  3. data/Gemfile +2 -0
  4. data/Rakefile +2 -0
  5. data/lib/bindata/big_integer.rb +2 -0
  6. data/lib/bindata/pascal_string.rb +2 -0
  7. data/lib/openra-cli.rb +2 -0
  8. data/lib/openra-replays.rb +2 -0
  9. data/lib/openra-struct.rb +2 -0
  10. data/lib/openra-types.rb +2 -0
  11. data/lib/openra-yaml.rb +2 -0
  12. data/lib/openra.rb +2 -0
  13. data/lib/openra/cli.rb +4 -2
  14. data/lib/openra/cli/command_registry.rb +2 -0
  15. data/lib/openra/cli/commands/detect_production_macros.rb +14 -3
  16. data/lib/openra/cli/commands/formatters.rb +2 -0
  17. data/lib/openra/cli/commands/replay_data.rb +63 -51
  18. data/lib/openra/cli/commands/version.rb +2 -0
  19. data/lib/openra/replays.rb +2 -1
  20. data/lib/openra/replays/file.rb +23 -14
  21. data/lib/openra/replays/metadata.rb +2 -0
  22. data/lib/openra/replays/metadata_marker.rb +2 -0
  23. data/lib/openra/replays/order.rb +4 -2
  24. data/lib/openra/replays/order_decorator.rb +2 -0
  25. data/lib/openra/replays/order_list.rb +2 -0
  26. data/lib/openra/replays/packet.rb +3 -3
  27. data/lib/openra/replays/replay.rb +4 -41
  28. data/lib/openra/struct.rb +2 -0
  29. data/lib/openra/struct/client.rb +2 -0
  30. data/lib/openra/struct/functions.rb +2 -0
  31. data/lib/openra/struct/game_options.rb +2 -0
  32. data/lib/openra/struct/game_options/boolean_option.rb +2 -0
  33. data/lib/openra/struct/game_options/integer_option.rb +2 -0
  34. data/lib/openra/struct/game_options/string_option.rb +2 -0
  35. data/lib/openra/struct/global_settings.rb +2 -0
  36. data/lib/openra/struct/metadata.rb +2 -0
  37. data/lib/openra/struct/player.rb +2 -0
  38. data/lib/openra/struct/pre_processor.rb +2 -0
  39. data/lib/openra/struct/sync_info.rb +2 -0
  40. data/lib/openra/struct/sync_lobby_clients.rb +2 -0
  41. data/lib/openra/types.rb +2 -0
  42. data/lib/openra/version.rb +3 -1
  43. data/lib/openra/yaml.rb +2 -0
  44. data/openra.gemspec +7 -1
  45. metadata +31 -4
  46. data/lib/openra/replays/packet_list.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 345905d788dbaf8a6ffad6e70be070553de601d3e0b5a56b3c2e3840ba6ff490
4
- data.tar.gz: c1ac04f3de64aba8bb52206308c8b9cf92730e4ef00c236729449f131a3b8a64
3
+ metadata.gz: 0f5589223dd3591d9db257c50c14843f99ff9d6cb25e54f667fc2b43a8dbcfaf
4
+ data.tar.gz: 83d7082b488eb31f84e0f891e93acf1514f3b1548826190385190d6234a31ea6
5
5
  SHA512:
6
- metadata.gz: ea61c392895a2cec57e9e64e085219752f6dbca7c1eafada4b2a6d78f7f5706f6838c0d3a1d4d91796e726f1b5cd82d61bf69a09c2daa1d4f08399aea4f8234b
7
- data.tar.gz: bbb8382e3c7d991c9e68e5c3e31e84b81cddd1480d671a700bf1f3295b9c56772802969dc93de510e3ac5ac575b41ff0bba4899e1625f6108892f3be8611dc63
6
+ metadata.gz: 56da77ac510188b14c9c2497809f65989ce92751706026350b860c111d8c94a00ad414a47e8d158a03130ff5602b2615266a3e19229f786d3dc4f4d07389aa4c
7
+ data.tar.gz: c0ebd68879e4d35bc3084052034b4068105346458665c7a475fb36a550fcb9de57269188e7fc3e5da16df871e53b87b00434fbea6576a03927c9de8397c0ef5b
@@ -1,6 +1,14 @@
1
1
  ## Unreleased
2
2
 
3
- [Compare v1.6.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.6.0...HEAD)
3
+ [Compare v1.7.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.7.0...HEAD)
4
+
5
+ ## v1.7.0
6
+
7
+ ### Improvements
8
+
9
+ * Decreased memory usage by streaming orders with iterator ([AMHOL](https://github.com/AMHOL))
10
+
11
+ [Compare v1.6.0...v1.7.0](https://github.com/AMHOL/openra-ruby/compare/v1.6.0...v1.7.0)
4
12
 
5
13
  ## v1.6.0
6
14
 
@@ -8,7 +16,7 @@
8
16
 
9
17
  * Updated to work with release-20200202 (current release) ([AMHOL](https://github.com/AMHOL))
10
18
 
11
- [Compare v1.5.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.5.0...v1.6.0)
19
+ [Compare v1.5.0...v1.6.0](https://github.com/AMHOL/openra-ruby/compare/v1.5.0...v1.6.0)
12
20
 
13
21
  ## v1.5.0
14
22
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class BigInteger < BinData::BasePrimitive
2
4
  def value_to_binary_string(value)
3
5
  value = value.abs
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class PascalString < BinData::Primitive
2
4
  big_integer :len, value: -> { data.length }
3
5
  string :data, read_length: :len
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/cli'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/replays'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/struct'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/types'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/yaml
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openra/version'
2
4
  require 'openra/replays' # Replays requires everything else
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
  require 'yaml'
3
5
  require 'json'
@@ -12,8 +14,8 @@ require 'openra/cli/command_registry'
12
14
 
13
15
  module Openra
14
16
  class CLI
15
- def call(*args)
16
- Dry::CLI.new(CommandRegistry).call(*args)
17
+ def call(*args, **kwargs, &block)
18
+ Dry::CLI.new(CommandRegistry).call(*args, **kwargs, &block)
17
19
  end
18
20
  end
19
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class CLI
3
5
  class CommandRegistry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class CLI
3
5
  module Commands
@@ -12,13 +14,20 @@ module Openra
12
14
  def call(replay:, **options)
13
15
  replay = Openra::Replays::Replay.new(replay)
14
16
  commands = Hash.new(&ARRAY_HASH)
17
+ sync_info = nil
15
18
 
16
- replay.orders.each do |order|
19
+ replay.each_order do |order|
17
20
  case order.command
21
+ when 'StartGame'
22
+ game_started = true
23
+ when 'SyncInfo'
24
+ sync_info = Openra::Struct::SyncInfo.new(
25
+ Openra::YAML.load(order.target)
26
+ ) unless game_started
18
27
  when 'StartProduction'
19
28
  commands[order.client_index.to_s] << {
20
29
  target: order.target,
21
- msec: order.frame * replay.frametime_multiplier
30
+ msec: order.frame * sync_info.global_settings.frametime_multiplier
22
31
  }
23
32
  end
24
33
  end
@@ -58,7 +67,9 @@ module Openra
58
67
 
59
68
  def detect_sequences(player_commands)
60
69
  sequences = []
61
- groups = player_commands.each_with_object(Hash.new(&ARRAY_HASH)).with_index do |(command, hash), index|
70
+ groups = player_commands.each_with_object(
71
+ Hash.new(&ARRAY_HASH)
72
+ ).with_index do |(command, hash), index|
62
73
  hash[command[:delay]] << command.merge(index: index)
63
74
  end
64
75
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class CLI
3
5
  module Commands
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class CLI
3
5
  module Commands
@@ -13,7 +15,7 @@ module Openra
13
15
  data = {
14
16
  mod: replay.metadata.mod,
15
17
  version: replay.metadata.version,
16
- server_name: replay.global_settings.server_name,
18
+ server_name: nil,
17
19
  map: {
18
20
  name: replay.metadata.map_name,
19
21
  hash: replay.metadata.map_hash
@@ -29,58 +31,70 @@ module Openra
29
31
  start_time: replay.metadata.start_time.iso8601,
30
32
  end_time: replay.metadata.end_time.iso8601,
31
33
  duration: time((replay.metadata.end_time - replay.metadata.start_time) * 1000),
32
- options: {
33
- explored_map: replay.game_options.explored_map_enabled.value,
34
- speed: replay.game_options.game_speed.value,
35
- starting_cash: replay.game_options.starting_cash.value,
36
- starting_units: replay.game_options.starting_units.value,
37
- fog_enabled: replay.game_options.fog_enabled.value,
38
- cheats_enabled: replay.game_options.cheats_enabled.value,
39
- kill_bounty_enabled: replay.game_options.bounties_enabled.value,
40
- allow_undeploy: replay.game_options.conyard_undeploy_enabled.value,
41
- crates_enabled: replay.game_options.crates_enabled.value,
42
- build_off_allies: replay.game_options.build_off_allies_enabled.value,
43
- restrict_build_radius: replay.game_options.restricted_build_radius_enabled.value,
44
- short_game: replay.game_options.short_game_enabled.value,
45
- techlevel: replay.game_options.tech_level.value
46
- }
47
- },
48
- clients: replay.clients.map { |client|
49
- player = replay.player(client.index)
50
-
51
- {
52
- index: client.index,
53
- name: client.name,
54
- preferred_color: client.preferred_color,
55
- color: client.preferred_color,
56
- spawn: {
57
- random: player&.is_random_spawn,
58
- point: client.spawn_point
59
- },
60
- faction: {
61
- chosen: client.faction_name.downcase,
62
- actual: player&.faction_id
63
- },
64
- ip: client.ip,
65
- team: player&.team,
66
- is_bot: player&.is_bot || false,
67
- is_admin: client.is_admin,
68
- is_player: !player.nil?,
69
- is_winner: player&.outcome == 'Won',
70
- build: []
71
- }
34
+ options: nil
72
35
  },
36
+ clients: [],
73
37
  chat: []
74
38
  }
75
39
 
40
+ game_started = false
76
41
  current_sync_clients = []
42
+ sync_info = nil
77
43
 
78
- replay.orders.each do |order|
44
+ replay.each_order do |order|
79
45
  client = current_sync_clients.find do |candidate|
80
46
  candidate.index == order.client_index.to_s
81
47
  end
82
48
 
83
49
  case order.command
50
+ when 'StartGame'
51
+ game_started = true
52
+
53
+ data[:clients] = sync_info.clients.map do |client|
54
+ player = replay.player(client.index)
55
+
56
+ {
57
+ index: client.index,
58
+ name: client.name,
59
+ preferred_color: client.preferred_color,
60
+ color: client.color,
61
+ spawn: {
62
+ random: player&.is_random_spawn,
63
+ point: client.spawn_point
64
+ },
65
+ faction: {
66
+ chosen: client.faction_name.downcase,
67
+ actual: player&.faction_id
68
+ },
69
+ ip: client.ip,
70
+ team: player&.team,
71
+ is_bot: player&.is_bot || false,
72
+ is_admin: client.is_admin,
73
+ is_player: !player.nil?,
74
+ is_winner: player&.outcome == 'Won',
75
+ build: []
76
+ }
77
+ end
78
+
79
+ data[:game][:options] = {
80
+ explored_map: sync_info.global_settings.game_options.explored_map_enabled.value,
81
+ speed: sync_info.global_settings.game_options.game_speed.value,
82
+ starting_cash: sync_info.global_settings.game_options.starting_cash.value,
83
+ starting_units: sync_info.global_settings.game_options.starting_units.value,
84
+ fog_enabled: sync_info.global_settings.game_options.fog_enabled.value,
85
+ cheats_enabled: sync_info.global_settings.game_options.cheats_enabled.value,
86
+ kill_bounty_enabled: sync_info.global_settings.game_options.bounties_enabled.value,
87
+ allow_undeploy: sync_info.global_settings.game_options.conyard_undeploy_enabled.value,
88
+ crates_enabled: sync_info.global_settings.game_options.crates_enabled.value,
89
+ build_off_allies: sync_info.global_settings.game_options.build_off_allies_enabled.value,
90
+ restrict_build_radius: sync_info.global_settings.game_options.restricted_build_radius_enabled.value,
91
+ short_game: sync_info.global_settings.game_options.short_game_enabled.value,
92
+ techlevel: sync_info.global_settings.game_options.tech_level.value
93
+ }
94
+ when 'SyncInfo'
95
+ sync_info = Openra::Struct::SyncInfo.new(
96
+ Openra::YAML.load(order.target)
97
+ ) unless game_started
84
98
  when 'SyncLobbyClients'
85
99
  current_sync_clients = Openra::Struct::SyncLobbyClients.new(
86
100
  Openra::YAML.load(order.target)
@@ -91,40 +105,38 @@ module Openra
91
105
  end
92
106
 
93
107
  client_hash[:build] << {
94
- structure: utf8(order.target),
95
- game_time: time(order.frame * replay.frametime_multiplier),
108
+ structure: order.target,
109
+ game_time: time(order.frame * sync_info.global_settings.frametime_multiplier),
96
110
  placement: order.target_pos.to_i
97
111
  }
98
112
  when 'Message'
99
113
  data[:chat] << {
100
114
  channel: 'server',
101
115
  name: nil,
102
- message: utf8(order.target)
116
+ message: order.target
103
117
  }
104
118
  when 'Chat'
105
119
  data[:chat] << {
106
120
  channel: 'global',
107
121
  name: client.name,
108
- message: utf8(order.target)
122
+ message: order.target
109
123
  }
110
124
  when 'TeamChat'
111
125
  data[:chat] << {
112
126
  channel: client.team,
113
127
  name: client.name,
114
- message: utf8(order.target)
128
+ message: order.target
115
129
  }
116
130
  end
117
131
  end
118
132
 
133
+ data[:server_name] = sync_info.global_settings.server_name
134
+
119
135
  puts FORMATTERS.fetch(options[:format]).call(data)
120
136
  end
121
137
 
122
138
  private
123
139
 
124
- def utf8(string)
125
- string.force_encoding('UTF-8').to_s
126
- end
127
-
128
140
  def time(msec)
129
141
  sec = msec / 1000
130
142
  mm, ss = sec.divmod(60)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class CLI
3
5
  module Commands
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'date'
2
4
  require 'bindata'
3
5
  require 'bindata/big_integer'
@@ -8,7 +10,6 @@ require 'openra/replays/order_decorator'
8
10
  require 'openra/replays/order'
9
11
  require 'openra/replays/order_list'
10
12
  require 'openra/replays/packet'
11
- require 'openra/replays/packet_list'
12
13
  require 'openra/replays/metadata_marker'
13
14
  require 'openra/replays/metadata'
14
15
  require 'openra/replays/file'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class File
@@ -5,20 +7,28 @@ module Openra
5
7
  @filename = filename
6
8
  end
7
9
 
8
- def packets
9
- @packets ||= PacketList.read(fs)
10
- end
10
+ def each_order(&block)
11
+ return enum_for(:each_order) unless block_given?
12
+
13
+ file.rewind
11
14
 
12
- def orders
13
- @orders ||= packets.orders
15
+ io = BinData::IO::Read.new(file)
16
+ template = Packet.new(fields: Packet.fields)
17
+
18
+ loop do
19
+ template.new.read(file).orders.each(&block)
20
+ rescue EOFError, IOError
21
+ break
22
+ end
14
23
  end
15
24
 
16
25
  def metadata
17
- metadata_fs = fs
18
- offset = -(metadata_marker.data_length + 4)
19
- metadata_fs.seek(offset, IO::SEEK_END)
20
-
21
- @metadata ||= Metadata.read(metadata_fs)
26
+ @metadata ||= begin
27
+ metadata_fs = file.tap(&:rewind)
28
+ offset = -(metadata_marker.data_length + 4)
29
+ metadata_fs.seek(offset, IO::SEEK_END)
30
+ Metadata.read(metadata_fs)
31
+ end
22
32
  end
23
33
 
24
34
 
@@ -26,13 +36,12 @@ module Openra
26
36
 
27
37
  attr_reader :filename
28
38
 
29
- def fs
30
- @fs ||= ::File.open(filename, 'rb')
31
- @fs.tap(&:rewind)
39
+ def file
40
+ @file ||= ::File.open(filename, 'rb')
32
41
  end
33
42
 
34
43
  def metadata_marker
35
- @metadata_marker ||= MetadataMarker.read(fs)
44
+ @metadata_marker ||= MetadataMarker.read(file)
36
45
  end
37
46
  end
38
47
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class Metadata < BinData::Record
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class MetadataMarker < BinData::Record
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class Order < BinData::Record
4
- HEX_FE = ?\xFE.force_encoding('ASCII-8BIT').freeze
5
- HEX_FF = ?\xFF.force_encoding('ASCII-8BIT').freeze
6
+ HEX_FE = ?\xFE.dup.force_encoding('ASCII-8BIT').freeze
7
+ HEX_FF = ?\xFF.dup.force_encoding('ASCII-8BIT').freeze
6
8
  # NEED TO LEARN HOW TO READ FLAGS AND TARGET TYPE
7
9
  IS_STANDARD_ORDER = -> { order_type == HEX_FF }
8
10
  IS_IMMEDIATE_ORDER = -> { order_type == HEX_FE }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class OrderDecorator < SimpleDelegator
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class OrderList < BinData::Record
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class Packet < BinData::Record
@@ -7,9 +9,7 @@ module Openra
7
9
  string :data, read_length: :data_length
8
10
 
9
11
  def orders
10
- return unless valid_order_list?
11
-
12
- order_list = OrderList.read(data)
12
+ return [] unless valid_order_list?
13
13
 
14
14
  @orders ||= order_list.orders.map do |order|
15
15
  OrderDecorator.new(order, client_index, order_list.frame)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  module Replays
3
5
  class Replay
@@ -13,8 +15,8 @@ module Openra
13
15
  )
14
16
  end
15
17
 
16
- def orders
17
- @orders ||= file.orders
18
+ def each_order(&block)
19
+ file.each_order(&block)
18
20
  end
19
21
 
20
22
  def players
@@ -26,45 +28,6 @@ module Openra
26
28
  candidate.index == index
27
29
  end
28
30
  end
29
-
30
- def clients
31
- sync_info.clients
32
- end
33
-
34
- def client(index)
35
- clients.find do |candidate|
36
- candidate.index == index
37
- end
38
- end
39
-
40
- def global_settings
41
- sync_info.global_settings
42
- end
43
-
44
- def frametime_multiplier
45
- global_settings.frametime_multiplier
46
- end
47
-
48
- def game_options
49
- global_settings.game_options
50
- end
51
-
52
- private
53
-
54
- def sync_info
55
- return @sync_info if @sync_info
56
-
57
- start_game_order = orders.find { |order| order[:command] == 'StartGame' }
58
- start_game_index = orders.index(start_game_order)
59
- pre_game_orders = orders[0..start_game_index]
60
- start_game_sync_order = pre_game_orders.reverse.find do |order|
61
- order[:command] == 'SyncInfo'
62
- end
63
-
64
- @sync_info = Openra::Struct::SyncInfo.new(
65
- Openra::YAML.load(start_game_sync_order.target)
66
- )
67
- end
68
31
  end
69
32
  end
70
33
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/transformer/all'
2
4
  require 'dry-struct'
3
5
  require 'openra/types'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class Client < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  module Functions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class GameOptions < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class GameOptions < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class GameOptions < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class GameOptions < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class GlobalSettings < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class Metadata < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class Player < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class PreProcessor
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class SyncInfo < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class Struct < Dry::Struct
3
5
  class SyncLobbyClients < Openra::Struct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry-types'
2
4
 
3
5
  module Openra
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
- VERSION = '1.6.0'.freeze
4
+ VERSION = '1.7.0'.freeze
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Openra
2
4
  class YAML
3
5
  MATCHER = /(?<indentation>\t+)?(?<key>[^\:]+)?\:?\s?(?<value>.+)?/.freeze
@@ -10,7 +10,11 @@ Gem::Specification.new do |spec|
10
10
  spec.homepage = 'https://github.com/AMHOL/openra-ruby'
11
11
  spec.license = 'MIT'
12
12
 
13
- spec.files = `git ls-files -z`.split("\x0") - ['bin/console']
13
+ spec.files = `git ls-files -z`.split("\x0") - %w(
14
+ bin/console
15
+ bin/profile
16
+ bin/trace_alloc
17
+ )
14
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
20
  spec.require_paths = ['lib']
@@ -24,4 +28,6 @@ Gem::Specification.new do |spec|
24
28
 
25
29
  spec.add_development_dependency 'rake'
26
30
  spec.add_development_dependency 'pry'
31
+ spec.add_development_dependency 'memory_profiler'
32
+ spec.add_development_dependency 'stackprof'
27
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,34 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: memory_profiler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: stackprof
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
125
153
  description:
126
154
  email:
127
155
  - andyholland1991@aol.com
@@ -159,7 +187,6 @@ files:
159
187
  - lib/openra/replays/order_decorator.rb
160
188
  - lib/openra/replays/order_list.rb
161
189
  - lib/openra/replays/packet.rb
162
- - lib/openra/replays/packet_list.rb
163
190
  - lib/openra/replays/replay.rb
164
191
  - lib/openra/struct.rb
165
192
  - lib/openra/struct/client.rb
@@ -197,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
224
  - !ruby/object:Gem::Version
198
225
  version: '0'
199
226
  requirements: []
200
- rubygems_version: 3.1.2
227
+ rubygems_version: 3.0.3
201
228
  signing_key:
202
229
  specification_version: 4
203
230
  summary: Openra Rubygem
@@ -1,12 +0,0 @@
1
- module Openra
2
- module Replays
3
- class PacketList < BinData::Record
4
- endian :little
5
- array :packets, type: :packet, read_until: :eof
6
-
7
- def orders
8
- @orders ||= packets.select(&:valid_order_list?).flat_map(&:orders)
9
- end
10
- end
11
- end
12
- end