csstats 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +33 -0
  3. data/.travis.yml +23 -7
  4. data/Gemfile +3 -7
  5. data/LICENSE +1 -1
  6. data/README.md +12 -9
  7. data/bin/console +1 -1
  8. data/csstats.gemspec +3 -4
  9. data/lib/csstats.rb +5 -3
  10. data/lib/csstats/client.rb +23 -0
  11. data/lib/csstats/columns.rb +28 -0
  12. data/lib/csstats/parser.rb +13 -4
  13. data/lib/csstats/parser/reader.rb +11 -0
  14. data/lib/csstats/parser/reader/file_reader.rb +45 -0
  15. data/lib/csstats/parser/{file_reader/handler.rb → reader/file_streamer.rb} +8 -8
  16. data/lib/csstats/parser/reader/player.rb +41 -0
  17. data/lib/csstats/parser/reader/players.rb +41 -0
  18. data/lib/csstats/{writer.rb → parser/writer.rb} +4 -2
  19. data/lib/csstats/{writer/file_writer/handler.rb → parser/writer/file_streamer.rb} +9 -10
  20. data/lib/csstats/parser/writer/player.rb +34 -0
  21. data/lib/csstats/parser/writer/players.rb +29 -0
  22. data/lib/csstats/player.rb +34 -0
  23. data/lib/csstats/players.rb +52 -0
  24. data/lib/csstats/version.rb +1 -1
  25. data/spec/csstats/client_spec.rb +13 -0
  26. data/spec/csstats/parser/reader/player_spec.rb +17 -0
  27. data/spec/csstats/parser/writer/players_spec.rb +30 -0
  28. data/spec/csstats/player_spec.rb +109 -0
  29. data/spec/csstats/players_spec.rb +30 -0
  30. data/spec/csstats_spec.rb +2 -2
  31. data/spec/spec_helper.rb +3 -7
  32. metadata +29 -21
  33. data/lib/csstats/handler.rb +0 -50
  34. data/lib/csstats/parser/file_reader.rb +0 -39
  35. data/lib/csstats/parser/player.rb +0 -82
  36. data/lib/csstats/parser/players.rb +0 -42
  37. data/lib/csstats/writer/player.rb +0 -39
  38. data/lib/csstats/writer/players.rb +0 -24
  39. data/spec/csstats/handler_spec.rb +0 -113
  40. data/spec/csstats/parser/player_spec.rb +0 -17
  41. data/spec/csstats/writer/players_spec.rb +0 -26
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Parser::Player do
4
- let(:file_stream) { File.new(csstats_file) }
5
- let(:handler) { CSstats::Parser::FileReader::Handler.new(file_stream) }
6
- subject { described_class.new }
7
- let(:player_data) { subject.parse(handler) }
8
-
9
- before do
10
- # We need to read first bytes, because it's file version.
11
- handler.read_short_data
12
- end
13
-
14
- it 'has correct acc' do
15
- expect(player_data.acc).to eq(24.3)
16
- end
17
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Writer::Players do
4
- let(:old_players) { CSstats::Handler.new(path: csstats_file).players }
5
- let(:file_path) { tmp_file('test.dat') }
6
- let(:new_players) { CSstats::Handler.new(path: file_path).players }
7
-
8
- it 'has correct players count in main file' do
9
- expect(old_players.length).to eq(208)
10
- end
11
-
12
- context 'new file' do
13
- before do
14
- CSstats::Writer::Players.new(old_players).write(file_path)
15
- end
16
-
17
- it 'has correct players count' do
18
- CSstats::Writer::Players.new(old_players).write(file_path)
19
- expect(new_players.length).to eq(208)
20
- end
21
-
22
- it 'has same players data' do
23
- expect(old_players).to eq(new_players)
24
- end
25
- end
26
- end