steam_hlds_log_parser 0.4.8 → 0.4.9

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
- SHA1:
3
- data.tar.gz: c21e53f6bd94b23ad5582b87c01f2a68d685cf27
4
- metadata.gz: c9a67a46076e2f653ef5a0136ea125eda5f43e79
5
2
  SHA512:
6
- data.tar.gz: 3da85caafdd06a416b7bebd2c20d1e138c6de0019c826507b2ce6333ecb3360e430a8e18173770c1fc33f1881a4d06af56a454261c6c17c875b21f5b1af92390
7
- metadata.gz: 7cc9bf51c3cde527da2c372f23918f0e184aeadca3de04cc14a96dc2188ddeb2ae4c5e703f69652bd22266e34e438e5f09e3b2779152c1e782f88fb1de7350d9
3
+ data.tar.gz: 08cb3bad994427212c11fe525b01f3070026ee629ecf59d6d885501112868755babe41c6feb05978f7a197d12c0da6f41a7ba531f5bc676af0c49f96b0676578
4
+ metadata.gz: 14e277ccb27704544482fade1bbe62309a311ce29929d48f99c2f0bbd59392752aa6d846d7ffee645379db04d5acf092fbba5d09d368e7f8b9bb99aa29ec3068
5
+ SHA1:
6
+ data.tar.gz: c5637bd10ef2466395f66221b4a0e4122a6fff56
7
+ metadata.gz: 04231e210d86a8e6b14a24cd6c9b9f6151bfa0b3
@@ -34,6 +34,7 @@ module SteamHldsLogParser
34
34
  :display_team_chat => true,
35
35
  }
36
36
  @options = default_options.merge(options)
37
+ @displayer = displayer
37
38
  end
38
39
 
39
40
  # Starts the client which will receive HLDS logs (using UDP)
@@ -87,13 +87,7 @@ module SteamHldsLogParser
87
87
  end
88
88
 
89
89
  # no matching pattern, no output
90
- unless content.nil?
91
- if @displayer.nil?
92
- return(content)
93
- else
94
- @displayer.new(content)
95
- end
96
- end
90
+ @displayer.new(content) unless content.nil?
97
91
 
98
92
  end
99
93
 
@@ -1,4 +1,4 @@
1
1
  module SteamHldsLogParser
2
2
  # Gem Version
3
- VERSION = "0.4.8"
3
+ VERSION = "0.4.9"
4
4
  end
data/spec/client_spec.rb CHANGED
@@ -15,9 +15,13 @@ module SteamHldsLogParser
15
15
  subject(:default_client) { Client.new(RSpecDisplayer) }
16
16
  context "when a 'Client' is created with default options"
17
17
  it { should be_an_instance_of Client }
18
+ it "has a 'displayer'" do
19
+ default_client.displayer.should_not be_nil
20
+ default_client.displayer.class.should be(Class)
21
+ default_client.displayer.should be(RSpecDisplayer)
22
+ end
18
23
  it "has a default 'options' Hash" do
19
24
  default_client.options.should_not be_nil
20
- default_client.options.should_not be(nil)
21
25
  default_client.options.class.should be(Hash)
22
26
  end
23
27
  it "has a default 'host'" do
data/spec/handler_spec.rb CHANGED
@@ -57,8 +57,10 @@ module SteamHldsLogParser
57
57
  it "returns Hash on map_ends" do
58
58
  data = '# L 05/10/2000 - 12:34:56: Team "CT" scored "17" with "0" players"'
59
59
  expected = {:type=>"map_ends", :params=>{:winner=>"CT", :score=>"17"}}
60
- @handler.receive_data(data).class.should eq(Hash)
61
- @handler.receive_data(data).should eq(expected)
60
+ puts @handler.receive_data(data)
61
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
62
+ @handler.receive_data(data).data.should eq(expected)
63
+ @handler.receive_data(data).data.class.should eq(Hash)
62
64
  end
63
65
  end
64
66
 
@@ -66,8 +68,9 @@ module SteamHldsLogParser
66
68
  it "returns Hash on victory" do
67
69
  data = '# L 05/10/2000 - 12:34:56: Team "CT" triggered "CTs_Win" (CT "3") (T "0")'
68
70
  expected = {:type=>"victory", :params=>{:score_ct=>"3", :score_t=>"0"}}
69
- @handler.receive_data(data).class.should eq(Hash)
70
- @handler.receive_data(data).should eq(expected)
71
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
72
+ @handler.receive_data(data).data.should eq(expected)
73
+ @handler.receive_data(data).data.class.should eq(Hash)
71
74
  end
72
75
  end
73
76
 
@@ -75,8 +78,9 @@ module SteamHldsLogParser
75
78
  it "returns Hash on killed" do
76
79
  data = '# L 05/10/2000 - 12:34:56: "Killer | Player<66><STEAM_ID_LAN><TERRORIST>" killed "Killed | Player<60><STEAM_ID_LAN><CT>" with "ak47"'
77
80
  expected = {:type=>"kill", :params => {:killer_team=>"T", :killer=>"Killer | Player", :killed_team=>"CT", :killed=>"Killed | Player", :weapon=>"ak47"}}
78
- @handler.receive_data(data).class.should eq(Hash)
79
- @handler.receive_data(data).should eq(expected)
81
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
82
+ @handler.receive_data(data).data.should eq(expected)
83
+ @handler.receive_data(data).data.class.should eq(Hash)
80
84
  end
81
85
  end
82
86
 
@@ -84,8 +88,9 @@ module SteamHldsLogParser
84
88
  it "returns Hash on killed" do
85
89
  data = '# L 05/10/2000 - 12:34:56: "Killer | Player<66><STEAM_0:0:12345><TERRORIST>" killed "Killed | Player<60><STEAM_0:0:12345><CT>" with "ak47"'
86
90
  expected = {:type=>"kill", :params => {:killer_team=>"T", :killer=>"Killer | Player", :killed_team=>"CT", :killed=>"Killed | Player", :weapon=>"ak47"}}
87
- @handler.receive_data(data).class.should eq(Hash)
88
- @handler.receive_data(data).should eq(expected)
91
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
92
+ @handler.receive_data(data).data.should eq(expected)
93
+ @handler.receive_data(data).data.class.should eq(Hash)
89
94
  end
90
95
  end
91
96
 
@@ -93,8 +98,9 @@ module SteamHldsLogParser
93
98
  it "returns Hash on suicide" do
94
99
  data = '# L 05/10/2000 - 12:34:56: "Player<66><STEAM_ID_LAN><TERRORIST>" committed suicide with "worldspawn" (world)'
95
100
  expected = {:type=>"suicide", :params=>{:killed=>"Player"}}
96
- @handler.receive_data(data).class.should eq(Hash)
97
- @handler.receive_data(data).should eq(expected)
101
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
102
+ @handler.receive_data(data).data.should eq(expected)
103
+ @handler.receive_data(data).data.class.should eq(Hash)
98
104
  end
99
105
  end
100
106
 
@@ -102,8 +108,9 @@ module SteamHldsLogParser
102
108
  it "returns Hash on suicide" do
103
109
  data = '# L 05/10/2000 - 12:34:56: "Player<66><STEAM_0:0:12345><TERRORIST>" committed suicide with "worldspawn" (world)'
104
110
  expected = {:type=>"suicide", :params=>{:killed=>"Player"}}
105
- @handler.receive_data(data).class.should eq(Hash)
106
- @handler.receive_data(data).should eq(expected)
111
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
112
+ @handler.receive_data(data).data.should eq(expected)
113
+ @handler.receive_data(data).data.class.should eq(Hash)
107
114
  end
108
115
  end
109
116
 
@@ -111,8 +118,9 @@ module SteamHldsLogParser
111
118
  it "returns Hash on event" do
112
119
  data = '# L 05/10/2000 - 12:34:56: "Killer | Player<66><STEAM_ID_LAN><CT>" triggered "Defused_The_Bomb"'
113
120
  expected = {:type=>"event", :params=> {:person_team=>"CT", :person=>"Killer | Player", :event_item=>"Defused_The_Bomb", :event_i18n=>"defused the bomb"}}
114
- @handler.receive_data(data).class.should eq(Hash)
115
- @handler.receive_data(data).should eq(expected)
121
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
122
+ @handler.receive_data(data).data.should eq(expected)
123
+ @handler.receive_data(data).data.class.should eq(Hash)
116
124
  end
117
125
  end
118
126
 
@@ -120,8 +128,9 @@ module SteamHldsLogParser
120
128
  it "returns Hash on event" do
121
129
  data = '# L 05/10/2000 - 12:34:56: "Killer | Player<66><STEAM_0:0:12345><CT>" triggered "Defused_The_Bomb"'
122
130
  expected = {:type=>"event", :params=> {:person_team=>"CT", :person=>"Killer | Player", :event_item=>"Defused_The_Bomb", :event_i18n=>"defused the bomb"}}
123
- @handler.receive_data(data).class.should eq(Hash)
124
- @handler.receive_data(data).should eq(expected)
131
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
132
+ @handler.receive_data(data).data.should eq(expected)
133
+ @handler.receive_data(data).data.class.should eq(Hash)
125
134
  end
126
135
  end
127
136
 
@@ -129,8 +138,9 @@ module SteamHldsLogParser
129
138
  it "returns Hash on changelevel" do
130
139
  data = '# L 05/10/2000 - 12:34:56: Loading map "de_dust2"'
131
140
  expected = {:type=>"loading_map", :params=>{:map=>"de_dust2"}}
132
- @handler.receive_data(data).class.should eq(Hash)
133
- @handler.receive_data(data).should eq(expected)
141
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
142
+ @handler.receive_data(data).data.should eq(expected)
143
+ @handler.receive_data(data).data.class.should eq(Hash)
134
144
  end
135
145
  end
136
146
 
@@ -138,8 +148,9 @@ module SteamHldsLogParser
138
148
  it "returns Hash on changelevel" do
139
149
  data = '# L 05/10/2000 - 12:34:56: "Player<15><STEAM_0:0:12345><TERRORIST>" say "gg" (dead)'
140
150
  expected = {:type=>"chat", :params=>{:player=>"Player", :player_team=>"T", :chat=>"gg"}}
141
- @handler.receive_data(data).class.should eq(Hash)
142
- @handler.receive_data(data).should eq(expected)
151
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
152
+ @handler.receive_data(data).data.should eq(expected)
153
+ @handler.receive_data(data).data.class.should eq(Hash)
143
154
  end
144
155
  end
145
156
 
@@ -147,8 +158,9 @@ module SteamHldsLogParser
147
158
  it "returns Hash on changelevel" do
148
159
  data = '# L 05/10/2000 - 12:34:56: "Player<15><STEAM_0:0:12345><TERRORIST>" say_team "Rush B"'
149
160
  expected = {:type=>"team_chat", :params=>{:player=>"Player", :player_team=>"T", :chat=>"Rush B"}}
150
- @handler.receive_data(data).class.should eq(Hash)
151
- @handler.receive_data(data).should eq(expected)
161
+ @handler.receive_data(data).class.should eq(RSpecDisplayer)
162
+ @handler.receive_data(data).data.should eq(expected)
163
+ @handler.receive_data(data).data.class.should eq(Hash)
152
164
  end
153
165
  end
154
166
 
@@ -15,9 +15,10 @@ module SteamHldsLogParser
15
15
  it "returns a Hash on matching patterns without any error" do
16
16
  File.open('spec/logs/L0000000.log', 'r') do |f|
17
17
  f.each_line do |line|
18
- hash = @handler.receive_data(line)
19
- unless hash.nil?
20
- hash.class.should eq(Hash)
18
+ obj = @handler.receive_data(line)
19
+ unless obj.nil?
20
+ obj.class.should eq(RSpecDisplayer)
21
+ hash = obj.data
21
22
  string = Displayer.new(hash).get_translation
22
23
  string.class.should eq(String)
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam_hlds_log_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas VIAL
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2013-08-18 00:00:00 Z
12
+ date: 2013-08-21 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler