rmuh 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -3
  3. data/README.md +13 -6
  4. data/Rakefile +2 -1
  5. data/examples/basic_parsing.rb +1 -1
  6. data/examples/basic_serverstats.rb +1 -1
  7. data/examples/serverstats_advanced.rb +2 -2
  8. data/examples/serverstats_cache.rb +3 -3
  9. data/examples/uolog_parsing.rb +28 -0
  10. data/examples/uorpt_parsing.rb +28 -0
  11. data/lib/rmuh.rb +3 -4
  12. data/lib/rmuh/rpt.rb +28 -7
  13. data/lib/rmuh/rpt/log/parsers/base.rb +1 -1
  14. data/lib/rmuh/rpt/log/parsers/unitedoperationsrpt.rb +2 -1
  15. data/lib/rmuh/rpt/log/util/unitedoperations.rb +2 -2
  16. data/lib/rmuh/serverstats.rb +25 -0
  17. data/lib/rmuh/version.rb +1 -1
  18. data/rmuh.gemspec +5 -3
  19. data/spec/functional/examples_spec.rb +23 -0
  20. data/spec/helpers/unitedoperations.rb +3 -2
  21. data/spec/{helpers/spec_helper.rb → spec_helper.rb} +2 -3
  22. data/spec/{rmuh_rpt_log_fetch_spec.rb → unit/rmuh/rpt/log/fetch_spec.rb} +0 -3
  23. data/spec/{rmuh_rpt_log_parsers_base_spec.rb → unit/rmuh/rpt/log/parsers/base_spec.rb} +0 -5
  24. data/spec/{rmuh_rpt_log_parsers_unitedoperationslog_spec.rb → unit/rmuh/rpt/log/parsers/unitedoperationslog_spec.rb} +0 -5
  25. data/spec/{rmuh_rpt_log_parsers_unitedoperationsrpt_spec.rb → unit/rmuh/rpt/log/parsers/unitedoperationsrpt_spec.rb} +0 -3
  26. data/spec/{rmuh_rpt_log_util_unitedoperations_spec.rb → unit/rmuh/rpt/log/util/unitedoperations_spec.rb} +5 -7
  27. data/spec/{rmuh_rpt_log_util_unitedoperationslog_spec.rb → unit/rmuh/rpt/log/util/unitedoperationslog_spec.rb} +0 -3
  28. data/spec/{rmuh_rpt_log_util_unitedoperationsrpt_spec.rb → unit/rmuh/rpt/log/util/unitedoperationsrpt_spec.rb} +0 -3
  29. data/spec/{rmuh_rpt_spec.rb → unit/rmuh/rpt_spec.rb} +0 -2
  30. data/spec/{rmuh_serverstats_advanced_spec.rb → unit/rmuh/serverstats/advanced_spec.rb} +1 -3
  31. data/spec/{rmuh_serverstats_base.rb → unit/rmuh/serverstats/base.rb} +0 -0
  32. data/spec/{rmuh_serverstats_base_spec.rb → unit/rmuh/serverstats/base_spec.rb} +1 -4
  33. metadata +50 -33
  34. data/spec/examples_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1efcd96775d658f86be3870b112469b3ae99da4
4
- data.tar.gz: e7939dee509616b41531fd5a0dcf060b3f7856c3
3
+ metadata.gz: a63fc33b88f2fcc3e7afb17bc50a762e4b18b81e
4
+ data.tar.gz: 13ff0d225e28eb82fe3800882588386d78de9657
5
5
  SHA512:
6
- metadata.gz: 121493c2971439083cd1f428744afdbe5fba3016b8a0f71d69703bd5fd31392682ea6782d53a13d1bef6da429b29b46f9ac06ccdb80eb0880b65852ce701b42b
7
- data.tar.gz: a6cf4b907b19d28769db62182af8f0223874010d8db3be68ad0273697f8c5b635dba7070dd064221d05f9a350501db2a3e04f3ea32ef64b28b1fd890c400dcfb
6
+ metadata.gz: 7b8a5a58aff0ffb709c1b11434fa0c8643a78181a17b0e8d2c0b5529243de6407378c5870f63fecea42ff0305046ba7309943c4d415f04d17ac11fcaaa1d5df6
7
+ data.tar.gz: f99117d80b13277469e4873b28a5703202b8d7a350902ecabceafb0b1202467bc0e29bb8c3b4be1dea4a6caa615719718d8f90289373679ea3823e015b3a7999
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
+ branches:
2
+ only:
3
+ - master
1
4
  language: ruby
2
5
  rvm:
6
+ - 2.1.1
3
7
  - 2.1.0
4
8
  - 2.0.0
5
9
  - 1.9.3
6
- notifications:
7
- email:
8
- - t+travisci@heckman.io
data/README.md CHANGED
@@ -14,8 +14,13 @@ Arrowhead servers).
14
14
  LICENSE
15
15
  -------
16
16
  **RMuh** is released under the
17
- [The MIT License](http://opensource.org/licenses/MIT) The full text of the
18
- license can be found in the `LICENSE` file
17
+ [The MIT License](http://opensource.org/licenses/MIT). The full text of the
18
+ license can be found in the `LICENSE` file. The summary can be found
19
+ [here](https://tldrlegal.com/license/mit-license#summary) courtest of
20
+ tldrlegal.
21
+
22
+ In short, MIT is a permissive license and means you can pretty much do what you
23
+ want with this code as long as the original copyright is included.
19
24
 
20
25
  CONTRIBUTING
21
26
  ------------
@@ -45,7 +50,11 @@ gem 'rmuh'
45
50
  **Gemspec**:
46
51
 
47
52
  ```Ruby
48
- g.add_runtime_dependency 'rmuh'
53
+ Gem::Specification.new do |g|
54
+ # ...
55
+ g.add_runtime_dependency 'rmuh'
56
+ # ...
57
+ end
49
58
  ```
50
59
 
51
60
  **Note:** If you want to do version pinning within your `Gemfile` or `Gemspec`
@@ -102,7 +111,7 @@ own parser.
102
111
 
103
112
  ```Ruby
104
113
  require 'rmuh/rpt/log/fetch'
105
- require 'rmuh/rpt/parsers/base
114
+ require 'rmuh/rpt/parsers/base'
106
115
  URL = 'http://arma2.unitedoperations.net/dump/SRV1/SRV1_RPT.txt'
107
116
  f = RMuh::RPT::Log::Fetch.new(URL)
108
117
  p = RMuh::RPT::Log::Parsers::Base.new
@@ -125,7 +134,6 @@ Here is a quick overview of how to use this functionality:
125
134
  require 'rmuh/serverstats/base'
126
135
  UO_IP = '70.42.74.59'
127
136
  s = RMuh::ServerStats::Base.new(host: UO_IP)
128
- s.update_cache
129
137
  puts s.stats
130
138
  ```
131
139
  By default the `ServerStats::Base` class caches the information so you need to
@@ -144,7 +152,6 @@ dot-notation, you can use the `Advanced` class:
144
152
  ```Ruby
145
153
  require 'rmuh/serverstats/base'
146
154
  s = RMuh::ServerStats::Advanced.new(host: UO_IP)
147
- s.update_cache
148
155
  puts s.players
149
156
  ```
150
157
  In this case, `players` is an Array. If you specify a key that doesn't exist
data/Rakefile CHANGED
@@ -5,7 +5,8 @@ require 'rubocop/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  Rubocop::RakeTask.new(:rubocop) do |t|
8
- t.patterns = %w{ Rakefile Gemfile rmuh.gemspec lib/**/*.rb spec/*_spec.rb }
8
+ # t.patterns = %w( Rakefile Gemfile rmuh.gemspec lib/**/*.rb spec/*_spec.rb )
9
+ t.patterns = %w( rmuh.gemspec lib/**/*.rb spec/*_spec.rb )
9
10
  t.fail_on_error = true
10
11
  end
11
12
 
@@ -37,5 +37,5 @@ p = RMuh::RPT::Log::Parsers::Base.new
37
37
  parsed = p.parse(f.log)
38
38
 
39
39
  puts '#### Metadata Hash'
40
- ap parsed
40
+ ap parsed, indent: -2
41
41
  puts '#### End of Hashes'
@@ -19,4 +19,4 @@ SRV = { host: 'srv1.unitedoperations.net', port: 2_302 }
19
19
  # by default this is a blocking operation. See serverstats_cache.rb for
20
20
  # alternative options
21
21
  s = RMuh::ServerStats::Base.new(host: SRV[:host], port: SRV[:port])
22
- ap s.stats
22
+ ap s.stats, indent: -2
@@ -20,7 +20,7 @@ SRV = { host: 'srv1.unitedoperations.net', port: 2_302 }
20
20
  s = RMuh::ServerStats::Advanced.new(host: SRV[:host], port: SRV[:port])
21
21
 
22
22
  # print the full stats out
23
- ap s.stats
23
+ ap s.stats, indent: -2
24
24
 
25
25
  # print only the players Array
26
- ap s.players
26
+ ap s.players, indent: -2
@@ -20,11 +20,11 @@ SRV = { host: 'srv1.unitedoperations.net', port: 2_302 }
20
20
  s = RMuh::ServerStats::Base.new(
21
21
  host: SRV[:host], port: SRV[:port], auto_cache: false
22
22
  )
23
- ap s.stats # this should be nil
23
+ ap s.stats, indent: -2 # this should be nil
24
24
 
25
25
  # update the cache within the object from the server, then print the stats
26
26
  s.update_cache
27
- ap s.stats
27
+ ap s.stats, indent: -2
28
28
 
29
29
  # You can also turn off the cache completely, which means '.stats' will be a
30
30
  # blocking call each time. You do this by passing 'cache: false'
@@ -32,4 +32,4 @@ s = RMuh::ServerStats::Base.new(
32
32
  host: SRV[:host], port: SRV[:port], cache: false
33
33
  )
34
34
 
35
- ap s.stats
35
+ ap s.stats, indent: -2
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # This script shows you how to use the UnitedOperations LOG parser
5
+ #
6
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
7
+
8
+ require 'rmuh/rpt/log/fetch'
9
+ require 'rmuh/rpt/log/parsers/unitedoperationslog'
10
+ require 'ap'
11
+
12
+ # the server log file
13
+ URL = 'http://arma2.unitedoperations.net/dump/SRV1/SRV1_LOG.txt'
14
+
15
+ # instantiate a new fetcher with the log file
16
+ f = RMuh::RPT::Log::Fetch.new(URL)
17
+
18
+ # instantiate a new UnitedOperationsRPT parser
19
+ p = RMuh::RPT::Log::Parsers::UnitedOperationsLog.new
20
+
21
+ # parse the log from the server
22
+ # we are doing it inline
23
+ parsed = p.parse(f.log)
24
+
25
+ # print out the hash
26
+ puts '#### Metadata Hash'
27
+ ap parsed, indent: -2
28
+ puts '#### End of Hashes'
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # This script shows you how to use the UnitedOperations RPT parser
5
+ #
6
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
7
+
8
+ require 'rmuh/rpt/log/fetch'
9
+ require 'rmuh/rpt/log/parsers/unitedoperationsrpt'
10
+ require 'ap'
11
+
12
+ # the server log file
13
+ URL = 'http://arma2.unitedoperations.net/dump/SRV1/SRV1_RPT.txt'
14
+
15
+ # instantiate a new fetcher with the log file
16
+ f = RMuh::RPT::Log::Fetch.new(URL)
17
+
18
+ # instantiate a new UnitedOperationsRPT parser
19
+ p = RMuh::RPT::Log::Parsers::UnitedOperationsRPT.new
20
+
21
+ # parse the log from the server
22
+ # we are doing it inline
23
+ parsed = p.parse(f.log)
24
+
25
+ # print out the hash
26
+ puts '#### Metadata Hash'
27
+ ap parsed, indent: -2
28
+ puts '#### End of Hashes'
data/lib/rmuh.rb CHANGED
@@ -21,7 +21,6 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
 
24
- path = File.expand_path('../rmuh', __FILE__)
25
- require File.join(path, 'rpt')
26
- require File.join(path, 'serverstats/base')
27
- require File.join(path, 'serverstats/advanced')
24
+ require 'rmuh/version'
25
+ require 'rmuh/rpt'
26
+ require 'rmuh/serverstats'
data/lib/rmuh/rpt.rb CHANGED
@@ -1,11 +1,32 @@
1
1
  # -*- coding: UTF-8 -*-
2
+ # The MIT License (MIT)
2
3
 
3
- # RMuh::RPT
4
- # Released under the MIT License
5
4
  # Copyright (c) 2014 Tim Heckman
6
5
 
7
- path = File.expand_path('..', __FILE__)
8
- require File.join(path, 'rpt/log/fetch')
9
- require File.join(path, 'rpt/log/parsers/base')
10
- require File.join(path, 'rpt/log/parsers/unitedoperationsrpt')
11
- require File.join(path, 'rpt/log/parsers/unitedoperationslog')
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+
24
+ require 'rmuh/rpt/log/fetch'
25
+
26
+ require 'rmuh/rpt/log/parsers/base'
27
+ require 'rmuh/rpt/log/parsers/unitedoperationslog'
28
+ require 'rmuh/rpt/log/parsers/unitedoperationsrpt'
29
+
30
+ require 'rmuh/rpt/log/util/unitedoperations'
31
+ require 'rmuh/rpt/log/util/unitedoperationslog'
32
+ require 'rmuh/rpt/log/util/unitedoperationsrpt'
@@ -10,7 +10,7 @@ module RMuh
10
10
  # class to be used for subclassing of your own parser
11
11
  #
12
12
  class Base
13
- def initialize(opts = {})
13
+ def initialize(_opts = {})
14
14
  end
15
15
 
16
16
  def parse(loglines)
@@ -57,7 +57,8 @@ module RMuh
57
57
 
58
58
  loglines.map do |l|
59
59
  line = regex_match(l)
60
- zulu!(line, @timezone) if @to_zulu && !line.nil?
60
+ puts line
61
+ zulu!(line, @timezone) if @to_zulu && line
61
62
  add_guid!(line) unless line.nil?
62
63
  line
63
64
  end.compact
@@ -94,9 +94,9 @@ module RMuh
94
94
  if line[:iso8601].nil?
95
95
  return "#{line[:year]}#{line[:month]}#{line[:day]}" \
96
96
  "#{line[:hour]}#{line[:min]}#{line[:sec]}" \
97
- "#{line[:type].to_s}"
97
+ "#{line[:type]}"
98
98
  else
99
- return "#{line[:iso8601]}#{line[:type].to_s}"
99
+ return "#{line[:iso8601]}#{line[:type]}"
100
100
  end
101
101
  end
102
102
 
@@ -0,0 +1,25 @@
1
+ # -*- coding: UTF-8 -*-
2
+ # The MIT License (MIT)
3
+
4
+ # Copyright (c) 2014 Tim Heckman
5
+
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+
24
+ require 'rmuh/serverstats/base'
25
+ require 'rmuh/serverstats/advanced'
data/lib/rmuh/version.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  module RMuh
7
7
  VERSION_MAJ ||= 0
8
8
  VERSION_MIN ||= 2
9
- VERSION_REV ||= 3
9
+ VERSION_REV ||= 4
10
10
 
11
11
  VERSION ||= "#{VERSION_MAJ}.#{VERSION_MIN}.#{VERSION_REV}"
12
12
  end
data/rmuh.gemspec CHANGED
@@ -15,18 +15,20 @@ Gem::Specification.new do |g|
15
15
  g.email = 't@heckman.io'
16
16
  g.homepage = 'https://github.com/theckman/rmuh'
17
17
  g.license = 'MIT'
18
+ g.required_ruby_version = '>= 1.9.3'
18
19
 
19
- g.test_files = %x{git ls-files spec/*}.split
20
- g.files = %x{git ls-files}.split
20
+ g.test_files = %x( git ls-files spec/* ).split
21
+ g.files = %x( git ls-files).split
21
22
 
22
23
  g.add_development_dependency 'rake', '~>10.1', '>= 10.1.0'
23
24
  g.add_development_dependency 'rspec', '~>2.14', '>= 2.14.1'
24
- g.add_development_dependency 'rubocop', '~> 0.18', '>= 0.18.1'
25
+ g.add_development_dependency 'rubocop', '~> 0.21', '>= 0.21.0'
25
26
  g.add_development_dependency 'fuubar', '~> 1.3', '>= 1.3.2'
26
27
  g.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
27
28
  g.add_development_dependency 'coveralls', '~> 0.7', '>= 0.7.0'
28
29
  g.add_development_dependency 'awesome_print', '~> 1.2', '>= 1.2.0'
29
30
 
31
+ g.add_runtime_dependency 'tzinfo-data'
30
32
  g.add_runtime_dependency 'tzinfo', '~> 1.1', '>= 1.1.0'
31
33
  g.add_runtime_dependency 'httparty', '~> 0.12', '>= 0.12.0'
32
34
  g.add_runtime_dependency 'gamespy_query', '~> 0.1', '>= 0.1.5'
@@ -0,0 +1,23 @@
1
+ # -*- coding: UTF-8 -*-
2
+ # These are just specs to make sure the example files run with an exit
3
+ # code of zero.
4
+ #
5
+
6
+ require 'spec_helper'
7
+ require 'open3'
8
+
9
+ DIR = File.expand_path('../../../examples', __FILE__)
10
+
11
+ describe 'example files' do
12
+ %w( basic_parsing.rb basic_serverstats.rb serverstats_advanced.rb
13
+ serverstats_cache.rb uolog_parsing.rb uorpt_parsing.rb ).each do |e|
14
+ context File.join(DIR, e) do
15
+ it 'should run and return a zero exit code' do
16
+ _, _, s = Open3.capture3(
17
+ "bundle exec ruby #{File.join(DIR, e)}"
18
+ )
19
+ expect(s.success?).to be_true
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,4 @@
1
+ # -*- coding: UTF-8 -*-
1
2
  require 'digest'
2
3
 
3
4
  def spec_guid_reference_implementation(mock_line)
@@ -19,9 +20,9 @@ def spec_minimum_data(line)
19
20
  if line[:iso8601].nil?
20
21
  data = "#{line[:year]}#{line[:month]}#{line[:day]}" \
21
22
  "#{line[:hour]}#{line[:min]}#{line[:sec]}" \
22
- "#{line[:type].to_s}"
23
+ "#{line[:type]}"
23
24
  else
24
- data = "#{line[:iso8601]}#{line[:type].to_s}"
25
+ data = "#{line[:iso8601]}#{line[:type]}"
25
26
  end
26
27
  data
27
28
  end
@@ -2,11 +2,10 @@
2
2
  require 'rspec'
3
3
  require 'simplecov'
4
4
  require 'coveralls'
5
-
6
- $LOAD_PATH.unshift '.' unless $LOAD_PATH.include?('.')
5
+ require 'rmuh'
7
6
 
8
7
  def repo_root
9
- File.expand_path('../../..', __FILE__)
8
+ File.expand_path('../..', __FILE__)
10
9
  end
11
10
 
12
11
  SimpleCov.formatter = Coveralls::SimpleCov::Formatter
@@ -1,8 +1,5 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'rspec'
3
2
  require 'stringio'
4
- require 'helpers/spec_helper'
5
- require File.join(repo_root, 'lib/rmuh/rpt/log/fetch')
6
3
 
7
4
  describe RMuh::RPT::Log::Fetch do
8
5
  let(:url) do
@@ -1,11 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'rspec'
3
2
  require 'stringio'
4
3
 
5
- REPO_ROOT = File.expand_path('../..', __FILE__)
6
-
7
- require File.join(REPO_ROOT, 'lib/rmuh/rpt/log/parsers/base')
8
-
9
4
  describe RMuh::RPT::Log::Parsers::Base do
10
5
  let(:text) { StringIO.new("This is a string.\nSo is this!") }
11
6
  let(:base) { RMuh::RPT::Log::Parsers::Base.new }
@@ -1,11 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'stringio'
3
- require 'rspec'
4
3
  require 'tzinfo'
5
- require 'helpers/spec_helper'
6
- require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperations')
7
- require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperationslog')
8
- require File.join(repo_root, 'lib/rmuh/rpt/log/parsers/unitedoperationslog')
9
4
 
10
5
  describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
11
6
  let(:uolog) { RMuh::RPT::Log::Parsers::UnitedOperationsLog.new }
@@ -1,8 +1,5 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'stringio'
3
- require 'rspec'
4
- require 'helpers/spec_helper'
5
- require File.join(repo_root, 'lib/rmuh/rpt/log/parsers/unitedoperationsrpt')
6
3
 
7
4
  describe RMuh::RPT::Log::Parsers::UnitedOperationsRPT do
8
5
  let(:uorpt) { RMuh::RPT::Log::Parsers::UnitedOperationsRPT.new }
@@ -1,8 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'rspec'
3
3
  require 'tzinfo'
4
- require 'helpers/spec_helper'
5
- require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperations')
6
4
  require 'helpers/unitedoperations'
7
5
 
8
6
  describe RMuh::RPT::Log::Util::UnitedOperations do
@@ -105,13 +103,13 @@ describe RMuh::RPT::Log::Util::UnitedOperations do
105
103
 
106
104
  it 'should return iso8601 + type if key :is8601 is there' do
107
105
  x = @uo_util.__guid_data_base(@full_line)
108
- expect(x).to eql "#{@full_line[:iso8601]}#{@full_line[:type].to_s}"
106
+ expect(x).to eql "#{@full_line[:iso8601]}#{@full_line[:type]}"
109
107
  end
110
108
 
111
109
  it 'should be year + month + day + hr + min + sec + type if !iso8601' do
112
110
  x = @uo_util.__guid_data_base(fline)
113
111
  s = "#{fline[:year]}#{fline[:month]}#{fline[:day]}#{fline[:hour]}" \
114
- "#{fline[:min]}#{fline[:sec]}#{fline[:type].to_s}"
112
+ "#{fline[:min]}#{fline[:sec]}#{fline[:type]}"
115
113
  expect(x).to eql s
116
114
  end
117
115
  end
@@ -236,7 +234,7 @@ describe RMuh::RPT::Log::Util::UnitedOperations do
236
234
 
237
235
  it 'should convert the correct values to Float' do
238
236
  md = @mf.match('2321.3 0.342 123.45')
239
- %w{server_time damage distance}.each do |m|
237
+ %w( server_time damage distance ).each do |m|
240
238
  x = @uo_util.__modifiers(md, m)
241
239
  expect(x).to be_an_instance_of Float
242
240
  expect(x).to eql md[m].to_f
@@ -273,7 +271,7 @@ describe RMuh::RPT::Log::Util::UnitedOperations do
273
271
 
274
272
  it 'should convert the correct values to Fixnum' do
275
273
  md = @mi.match('2014/02/09 14:44:44')
276
- %w{year month day hour min sec}.each do |m|
274
+ %w( year month day hour min sec ).each do |m|
277
275
  x = @uo_util.__line_modifiers(md, m)
278
276
  expect(x).to be_an_instance_of Fixnum
279
277
  expect(x).to eql md[m].to_i
@@ -282,7 +280,7 @@ describe RMuh::RPT::Log::Util::UnitedOperations do
282
280
 
283
281
  it 'should convert the correct values to Float' do
284
282
  md = @mf.match('2321.3 0.342 123.45')
285
- %w{server_time damage distance}.each do |m|
283
+ %w( server_time damage distance ).each do |m|
286
284
  x = @uo_util.__modifiers(md, m)
287
285
  expect(x).to be_an_instance_of Float
288
286
  expect(x).to eql md[m].to_f
@@ -1,7 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'rspec'
3
- require 'helpers/spec_helper'
4
- require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperationslog')
5
2
 
6
3
  describe RMuh::RPT::Log::Util::UnitedOperationsLog do
7
4
  before(:all) do
@@ -1,7 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'rspec'
3
- require 'helpers/spec_helper'
4
- require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperationsrpt')
5
2
 
6
3
  describe RMuh::RPT::Log::Util::UnitedOperationsRPT do
7
4
  context '::DTR' do
@@ -1,6 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'rspec'
3
- require File.join(File.expand_path('../..', __FILE__), 'lib/rmuh/version')
4
2
 
5
3
  describe RMuh do
6
4
  context '::VERSION_MAJ' do
@@ -1,8 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'rspec'
3
- require 'helpers/spec_helper'
4
- require File.join(repo_root, 'lib/rmuh/serverstats/advanced')
5
- require 'rmuh_serverstats_base'
3
+ require_relative 'base'
6
4
 
7
5
  describe RMuh::ServerStats::Advanced do
8
6
  let(:s) do
@@ -1,10 +1,7 @@
1
1
  # -*- coding: UTF-8 -*-
2
-
3
2
  require 'rspec'
4
3
  require 'gamespy_query'
5
- require 'helpers/spec_helper'
6
- require File.join(repo_root, 'lib/rmuh/serverstats/base')
7
- require 'rmuh_serverstats_base'
4
+ require_relative 'base'
8
5
 
9
6
  describe RMuh::ServerStats::Base do
10
7
  it_should_behave_like 'RMuh::ServerStats::Base'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmuh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Heckman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-09 00:00:00.000000000 Z
11
+ date: 2014-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -56,20 +56,20 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0.18'
59
+ version: '0.21'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 0.18.1
62
+ version: 0.21.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.18'
69
+ version: '0.21'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 0.18.1
72
+ version: 0.21.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: fuubar
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.2.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: tzinfo-data
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: tzinfo
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +241,8 @@ files:
227
241
  - examples/basic_serverstats.rb
228
242
  - examples/serverstats_advanced.rb
229
243
  - examples/serverstats_cache.rb
244
+ - examples/uolog_parsing.rb
245
+ - examples/uorpt_parsing.rb
230
246
  - lib/rmuh.rb
231
247
  - lib/rmuh/rpt.rb
232
248
  - lib/rmuh/rpt/log/fetch.rb
@@ -236,25 +252,26 @@ files:
236
252
  - lib/rmuh/rpt/log/util/unitedoperations.rb
237
253
  - lib/rmuh/rpt/log/util/unitedoperationslog.rb
238
254
  - lib/rmuh/rpt/log/util/unitedoperationsrpt.rb
255
+ - lib/rmuh/serverstats.rb
239
256
  - lib/rmuh/serverstats/advanced.rb
240
257
  - lib/rmuh/serverstats/base.rb
241
258
  - lib/rmuh/version.rb
242
259
  - rmuh.gemspec
243
- - spec/examples_spec.rb
244
260
  - spec/files/content-length.txt
245
- - spec/helpers/spec_helper.rb
261
+ - spec/functional/examples_spec.rb
246
262
  - spec/helpers/unitedoperations.rb
247
- - spec/rmuh_rpt_log_fetch_spec.rb
248
- - spec/rmuh_rpt_log_parsers_base_spec.rb
249
- - spec/rmuh_rpt_log_parsers_unitedoperationslog_spec.rb
250
- - spec/rmuh_rpt_log_parsers_unitedoperationsrpt_spec.rb
251
- - spec/rmuh_rpt_log_util_unitedoperations_spec.rb
252
- - spec/rmuh_rpt_log_util_unitedoperationslog_spec.rb
253
- - spec/rmuh_rpt_log_util_unitedoperationsrpt_spec.rb
254
- - spec/rmuh_rpt_spec.rb
255
- - spec/rmuh_serverstats_advanced_spec.rb
256
- - spec/rmuh_serverstats_base.rb
257
- - spec/rmuh_serverstats_base_spec.rb
263
+ - spec/spec_helper.rb
264
+ - spec/unit/rmuh/rpt/log/fetch_spec.rb
265
+ - spec/unit/rmuh/rpt/log/parsers/base_spec.rb
266
+ - spec/unit/rmuh/rpt/log/parsers/unitedoperationslog_spec.rb
267
+ - spec/unit/rmuh/rpt/log/parsers/unitedoperationsrpt_spec.rb
268
+ - spec/unit/rmuh/rpt/log/util/unitedoperations_spec.rb
269
+ - spec/unit/rmuh/rpt/log/util/unitedoperationslog_spec.rb
270
+ - spec/unit/rmuh/rpt/log/util/unitedoperationsrpt_spec.rb
271
+ - spec/unit/rmuh/rpt_spec.rb
272
+ - spec/unit/rmuh/serverstats/advanced_spec.rb
273
+ - spec/unit/rmuh/serverstats/base.rb
274
+ - spec/unit/rmuh/serverstats/base_spec.rb
258
275
  homepage: https://github.com/theckman/rmuh
259
276
  licenses:
260
277
  - MIT
@@ -267,7 +284,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
284
  requirements:
268
285
  - - ">="
269
286
  - !ruby/object:Gem::Version
270
- version: '0'
287
+ version: 1.9.3
271
288
  required_rubygems_version: !ruby/object:Gem::Requirement
272
289
  requirements:
273
290
  - - ">="
@@ -280,18 +297,18 @@ signing_key:
280
297
  specification_version: 4
281
298
  summary: ArmA 2 Ruby Library
282
299
  test_files:
283
- - spec/examples_spec.rb
284
300
  - spec/files/content-length.txt
285
- - spec/helpers/spec_helper.rb
301
+ - spec/functional/examples_spec.rb
286
302
  - spec/helpers/unitedoperations.rb
287
- - spec/rmuh_rpt_log_fetch_spec.rb
288
- - spec/rmuh_rpt_log_parsers_base_spec.rb
289
- - spec/rmuh_rpt_log_parsers_unitedoperationslog_spec.rb
290
- - spec/rmuh_rpt_log_parsers_unitedoperationsrpt_spec.rb
291
- - spec/rmuh_rpt_log_util_unitedoperations_spec.rb
292
- - spec/rmuh_rpt_log_util_unitedoperationslog_spec.rb
293
- - spec/rmuh_rpt_log_util_unitedoperationsrpt_spec.rb
294
- - spec/rmuh_rpt_spec.rb
295
- - spec/rmuh_serverstats_advanced_spec.rb
296
- - spec/rmuh_serverstats_base.rb
297
- - spec/rmuh_serverstats_base_spec.rb
303
+ - spec/spec_helper.rb
304
+ - spec/unit/rmuh/rpt/log/fetch_spec.rb
305
+ - spec/unit/rmuh/rpt/log/parsers/base_spec.rb
306
+ - spec/unit/rmuh/rpt/log/parsers/unitedoperationslog_spec.rb
307
+ - spec/unit/rmuh/rpt/log/parsers/unitedoperationsrpt_spec.rb
308
+ - spec/unit/rmuh/rpt/log/util/unitedoperations_spec.rb
309
+ - spec/unit/rmuh/rpt/log/util/unitedoperationslog_spec.rb
310
+ - spec/unit/rmuh/rpt/log/util/unitedoperationsrpt_spec.rb
311
+ - spec/unit/rmuh/rpt_spec.rb
312
+ - spec/unit/rmuh/serverstats/advanced_spec.rb
313
+ - spec/unit/rmuh/serverstats/base.rb
314
+ - spec/unit/rmuh/serverstats/base_spec.rb
@@ -1,46 +0,0 @@
1
- # -*- coding: UTF-8 -*-
2
- # These are just specs to make sure the example files run with an exit
3
- # code of zero.
4
- #
5
- require 'rspec'
6
- require 'open3'
7
- require 'helpers/spec_helper'
8
-
9
- DIR = File.expand_path('../../examples', __FILE__)
10
-
11
- describe 'exampple files' do
12
-
13
- context "#{File.join(DIR, 'basic_parsing.rb')}" do
14
- it 'should run and return a zero exit code' do
15
- _, _, s = Open3.capture3("ruby #{File.join(DIR, 'basic_parsing.rb')}")
16
- expect(s.success?).to be_true
17
- end
18
- end
19
-
20
- context "#{File.join(DIR, 'basic_serverstats.rb')}" do
21
- it 'should run and return a zero exit code' do
22
- _, _, s = Open3.capture3(
23
- "ruby #{File.join(DIR, 'basic_serverstats.rb')}"
24
- )
25
- expect(s.success?).to be_true
26
- end
27
- end
28
-
29
- context "#{File.join(DIR, 'serverstats_advanced.rb')}" do
30
- it 'should run and return a zero exit code' do
31
- _, _, s = Open3.capture3(
32
- "ruby #{File.join(DIR, 'serverstats_advanced.rb')}"
33
- )
34
- expect(s.success?).to be_true
35
- end
36
- end
37
-
38
- context "#{File.join(DIR, 'serverstats_cache.rb')}" do
39
- it 'should run an return a zero exit code' do
40
- _, _, s = Open3.capture3(
41
- "ruby #{File.join(DIR, 'serverstats_cache.rb')}"
42
- )
43
- expect(s.success?).to be_true
44
- end
45
- end
46
- end