quake-log-parser 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7bdff44e4bb78e09438ca2c9a2b7112cfcc35362d2e902cf559d52e79ca097b8
4
+ data.tar.gz: 1bbfd5525b1f8ba829388541564ffe1865a3929fb0fc4c77a7704bacee45effe
5
+ SHA512:
6
+ metadata.gz: 501640c4b5278aee65618854cdf4de8ff1c5425a18f73d37ca85c0819ab0f9879add1fa4b02c3d54dee42b7c7d4e31d2c68fc5ca1b225c814da963c3efc343f3
7
+ data.tar.gz: 6cfc084db65c8d1c2b07157a2cc04bf7189db4cd08c15642a9f771a5a0d9423e57524535ea09fe6c355e20b024e9f0dee8b8fe0905e3aa5ad164241353ca7c8e
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: [3.1.6]
11
+ env:
12
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+
16
+ - name: Install Ruby ${{ matrix.ruby-version }}
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+
21
+ - name: Install dependencies
22
+ run: bundle install
23
+
24
+ - name: Run tests and quality gates with Ruby ${{ matrix.ruby-version }}
25
+ run: bundle exec rake
26
+
27
+ - name: Upload coverage to Codecov
28
+ uses: codecov/codecov-action@v4
29
+ env:
30
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,33 @@
1
+ name: Publish to Rubygems
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ publish_to_rubygems:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+
13
+ - name: Install Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.1.6
17
+
18
+ - name: Install dependencies
19
+ run: bundle install
20
+
21
+ - name: Run tests and quality gates
22
+ run: bundle exec rake
23
+
24
+ - name: Publish to Rubygems
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build *.gemspec
31
+ gem push *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .rspec_status
2
+ /Gemfile.lock
3
+ *.gem
4
+ coverage/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ AllCops:
2
+ NewCops: disable
3
+ SuggestExtensions: false
4
+ Exclude:
5
+ - spec/*
6
+
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
9
+
10
+ Layout/EndOfLine:
11
+ Enabled: false
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Layout/LineLength:
17
+ Max: 300
18
+
19
+ Metrics/MethodLength:
20
+ Max: 30
21
+
22
+ Metrics/AbcSize:
23
+ Max: 50
24
+
25
+ Naming/FileName:
26
+ Enabled: false
27
+
28
+ Gemspec/RequiredRubyVersion:
29
+ Enabled: false
30
+
31
+ Style/HashSyntax:
32
+ Enabled: false
33
+
34
+ Style/ClassVars:
35
+ Enabled: false
36
+
37
+ Lint/ScriptPermission:
38
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ quake-log-parser
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0]
4
+
5
+ - Final release to publish the gem
6
+
7
+ ## [0.0.1]
8
+
9
+ - Initial release
10
+ - Setup of CI/CD pipeline
11
+ - Skeleton of gem
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Dockerfile ADDED
@@ -0,0 +1,5 @@
1
+ FROM ruby:3.1.6
2
+ WORKDIR /app
3
+ COPY . .
4
+ RUN bundle install
5
+ CMD bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'codecov', require: false, group: :test
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Quake Log Parser
2
+
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/8bbcb90abf1f392d7e68/maintainability)](https://codeclimate.com/github/pedrofurtado/quake-log-parser/maintainability)
4
+ ![CI](https://github.com/pedrofurtado/quake-log-parser/actions/workflows/ci.yml/badge.svg)
5
+ [![codecov](https://codecov.io/gh/pedrofurtado/quake-log-parser/graph/badge.svg?token=DUC0CORI0N)](https://codecov.io/gh/pedrofurtado/quake-log-parser)
6
+ [![Gem Version](https://badge.fury.io/rb/quake-log-parser.svg)](https://badge.fury.io/rb/quake-log-parser)
7
+
8
+ Ruby gem for quake log parsing.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'quake-log-parser'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ bundle install
21
+
22
+ Or install it yourself as:
23
+
24
+ gem install quake-log-parser
25
+
26
+ ## Usage
27
+
28
+ ```ruby
29
+ require 'quake-log-parser'
30
+
31
+ if defined?(Rails)
32
+ QuakeLogParser::Logger.logger = Rails.logger
33
+ else
34
+ QuakeLogParser::Logger.logger = Logger.new($stdout)
35
+ end
36
+
37
+ parser = QuakeLogParser::LogReader.new('/path/to/your/quake.log')
38
+ parser.read
39
+
40
+ puts JSON.pretty_generate(parser.results)
41
+ ```
42
+
43
+ ## Execute tests/specs
44
+
45
+ To execute gem tests locally, use Docker with the commands below:
46
+
47
+ ```bash
48
+ git clone https://github.com/pedrofurtado/quake-log-parser
49
+ cd quake-log-parser/
50
+ docker build -t quake-log-parser_specs .
51
+
52
+ # Then, run this command how many times you want,
53
+ # after editing local files, and so on, to get
54
+ # feedback from test suite of gem.
55
+ docker run --rm -v $(pwd):/app/ -it quake-log-parser_specs
56
+
57
+ # Or, if you want to run a example of usage of gem,
58
+ # you can run the command below.
59
+ docker run --rm -v $(pwd):/app/ -it quake-log-parser_specs ruby real_example_to_run.rb
60
+ ```
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pedrofurtado/quake-log-parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/pedrofurtado/quake-log-parser/blob/master/CODE_OF_CONDUCT.md).
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
69
+
70
+ ## Code of Conduct
71
+
72
+ Everyone interacting in the quake-log-parser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pedrofurtado/quake-log-parser/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+ RuboCop::RakeTask.new
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task default: %i[rubocop spec]
data/bin/console ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'quake-log-parser'
5
+ require 'irb'
6
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+ bundle install
@@ -0,0 +1,30 @@
1
+ module QuakeLogParser
2
+ class Game
3
+ attr_accessor :id, :total_kills, :players, :means_of_death, :kills
4
+
5
+ def initialize(id:)
6
+ @id = id
7
+ @total_kills = 0
8
+ @players = {}
9
+ @means_of_death = {}
10
+ @kills = []
11
+ end
12
+
13
+ def add_player(player)
14
+ @players[player.name] = player
15
+ end
16
+
17
+ def add_total_kill
18
+ @total_kills += 1
19
+ end
20
+
21
+ def add_means_of_death(mean)
22
+ @means_of_death[mean] ||= 0
23
+ @means_of_death[mean] += 1
24
+ end
25
+
26
+ def add_kill(kill)
27
+ @kills << kill
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,11 @@
1
+ module QuakeLogParser
2
+ class Kill
3
+ attr_accessor :killer, :killed, :mean_of_death
4
+
5
+ def initialize(killer:, killed:, mean_of_death:)
6
+ @killer = killer
7
+ @killed = killed
8
+ @mean_of_death = mean_of_death
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,95 @@
1
+ require 'json'
2
+
3
+ module QuakeLogParser
4
+ class LineHandler
5
+ def initialize
6
+ @games = []
7
+ end
8
+
9
+ def handle_new_game(_line)
10
+ new_id = @games.size + 1
11
+ @games << QuakeLogParser::Game.new(id: new_id)
12
+ QuakeLogParser::Logger.log("Game ##{current_game.id}: New game")
13
+ end
14
+
15
+ def handle_new_player(line)
16
+ player = Player.new(name: extract_player_name_from(line))
17
+ current_game.add_player(player)
18
+ QuakeLogParser::Logger.log("Game ##{current_game.id}: New player #{player.name}")
19
+ end
20
+
21
+ def handle_new_kill(line)
22
+ killer, killed, means_of_death = extract_kill_infos_from(line)
23
+
24
+ means_of_death.chomp!
25
+
26
+ current_game.add_kill(QuakeLogParser::Kill.new(killer: killer, killed: killed, mean_of_death: means_of_death))
27
+
28
+ previous_total_kills = current_game.total_kills
29
+ current_game.add_total_kill
30
+
31
+ previous_means_of_death = current_game.means_of_death[means_of_death] || 0
32
+ current_game.add_means_of_death(means_of_death)
33
+
34
+ base_log_message = "Game ##{current_game.id}: New kill. Game total_kills was from #{previous_total_kills} to #{current_game.total_kills} | Game total kills by means_of_death #{means_of_death} was from #{previous_means_of_death} to #{current_game.means_of_death[means_of_death]}"
35
+
36
+ if killer == '<world>'
37
+ player = current_game.players[killed]
38
+ player_previous_kills = player.kills
39
+ player.subtract_kill
40
+ QuakeLogParser::Logger.log("#{base_log_message} | Player #{player.name} lost a kill because it was killed by <world> with #{means_of_death} | Player #{player.name} total kills was from #{player_previous_kills} to #{player.kills}")
41
+ else
42
+ player = current_game.players[killer]
43
+ player_previous_kills = player.kills
44
+ player.add_kill
45
+ QuakeLogParser::Logger.log("#{base_log_message} | Player #{player.name} won a kill because killed #{killed} with #{means_of_death} - Player #{player.name} total kills was from #{player_previous_kills} to #{player.kills}")
46
+ end
47
+ end
48
+
49
+ def results
50
+ data = {}
51
+
52
+ @games.each do |game|
53
+ data["game_#{game.id}"] = {
54
+ total_kills: game.total_kills,
55
+ players: game.players.keys,
56
+ kills: game.kills.map do |kill|
57
+ {
58
+ killer: kill.killer,
59
+ killed: kill.killed,
60
+ mean_of_death: kill.mean_of_death
61
+ }
62
+ end,
63
+ kills_by_players: Hash[
64
+ game.players
65
+ .sort_by { |_player_name, player| player.kills }
66
+ .reverse
67
+ .collect { |_player_name, player| [player.name, player.kills] }
68
+ ],
69
+ kills_by_means: Hash[
70
+ game.means_of_death
71
+ .sort_by { |_mean, count| count }
72
+ .reverse
73
+ .collect { |mean, count| [mean, count] }
74
+ ]
75
+ }
76
+ end
77
+
78
+ data
79
+ end
80
+
81
+ private
82
+
83
+ def current_game
84
+ @games.last
85
+ end
86
+
87
+ def extract_player_name_from(line)
88
+ line.match(QuakeLogParser::Patterns.new_player_infos)[1]
89
+ end
90
+
91
+ def extract_kill_infos_from(line)
92
+ line.match(QuakeLogParser::Patterns.new_kill_infos)[1..3]
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,27 @@
1
+ module QuakeLogParser
2
+ class LogReader
3
+ def initialize(file_path)
4
+ @file_path = file_path
5
+ @line_handler = QuakeLogParser::LineHandler.new
6
+ end
7
+
8
+ def read
9
+ File.open(@file_path, 'r') do |file|
10
+ file.each_line do |line|
11
+ case line
12
+ when QuakeLogParser::Patterns.new_game
13
+ @line_handler.handle_new_game(line)
14
+ when QuakeLogParser::Patterns.new_player
15
+ @line_handler.handle_new_player(line)
16
+ when QuakeLogParser::Patterns.new_kill
17
+ @line_handler.handle_new_kill(line)
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ def results
24
+ @line_handler.results
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ require 'logger'
2
+
3
+ module QuakeLogParser
4
+ class Logger
5
+ @@logger = ::Logger.new($stdout)
6
+
7
+ def self.logger
8
+ @@logger
9
+ end
10
+
11
+ def self.logger=(logger)
12
+ @@logger = logger
13
+ end
14
+
15
+ def self.log(message)
16
+ @@logger.info(message)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ module QuakeLogParser
2
+ class Patterns
3
+ def self.new_game
4
+ /InitGame:/
5
+ end
6
+
7
+ def self.new_player
8
+ /ClientUserinfoChanged:/
9
+ end
10
+
11
+ def self.new_player_infos
12
+ /ClientUserinfoChanged: [0-9]+ n\\(.*?)\\t/
13
+ end
14
+
15
+ def self.new_kill
16
+ /Kill:/
17
+ end
18
+
19
+ def self.new_kill_infos
20
+ /Kill: [0-9]+ [0-9]+ [0-9]+: (.*?) killed (.*?) by (.*?)$/
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ module QuakeLogParser
2
+ class Player
3
+ attr_accessor :name, :kills
4
+
5
+ def initialize(name:)
6
+ @name = name
7
+ @kills = 0
8
+ end
9
+
10
+ def add_kill
11
+ @kills += 1
12
+ end
13
+
14
+ def subtract_kill
15
+ return if @kills.zero?
16
+
17
+ @kills -= 1
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module QuakeLogParser
2
+ VERSION = '1.0.0'.freeze
3
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'quake-log-parser/version'
2
+ require_relative 'quake-log-parser/logger'
3
+ require_relative 'quake-log-parser/patterns'
4
+ require_relative 'quake-log-parser/kill'
5
+ require_relative 'quake-log-parser/game'
6
+ require_relative 'quake-log-parser/player'
7
+ require_relative 'quake-log-parser/line_handler'
8
+ require_relative 'quake-log-parser/log_reader'
9
+
10
+ module QuakeLogParser end
@@ -0,0 +1,27 @@
1
+ require_relative 'lib/quake-log-parser/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'quake-log-parser'
5
+ spec.version = QuakeLogParser::VERSION
6
+ spec.authors = ['Pedro Furtado']
7
+ spec.email = ['pedro.felipe.azevedo.furtado@gmail.com']
8
+ spec.summary = 'Ruby gem for quake log parsing'
9
+ spec.description = 'Ruby gem for quake log parsing'
10
+ spec.homepage = 'https://github.com/pedrofurtado/quake-log-parser'
11
+ spec.license = 'MIT'
12
+ spec.metadata['homepage_uri'] = spec.homepage
13
+ spec.metadata['source_code_uri'] = spec.homepage
14
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
15
+
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
18
+ end
19
+
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'rubocop'
27
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'lib/quake-log-parser'
2
+
3
+ parser = QuakeLogParser::LogReader.new('/app/spec/fixtures/quake.log')
4
+ parser.read
5
+ sleep 2
6
+ puts JSON.pretty_generate(parser.results)
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quake-log-parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Pedro Furtado
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ruby gem for quake log parsing
56
+ email:
57
+ - pedro.felipe.azevedo.furtado@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".github/workflows/ci.yml"
63
+ - ".github/workflows/publish_to_rubygems.yml"
64
+ - ".gitignore"
65
+ - ".rspec"
66
+ - ".rubocop.yml"
67
+ - ".ruby-gemset"
68
+ - ".ruby-version"
69
+ - CHANGELOG.md
70
+ - CODE_OF_CONDUCT.md
71
+ - Dockerfile
72
+ - Gemfile
73
+ - LICENSE.txt
74
+ - README.md
75
+ - Rakefile
76
+ - bin/console
77
+ - bin/setup
78
+ - lib/quake-log-parser.rb
79
+ - lib/quake-log-parser/game.rb
80
+ - lib/quake-log-parser/kill.rb
81
+ - lib/quake-log-parser/line_handler.rb
82
+ - lib/quake-log-parser/log_reader.rb
83
+ - lib/quake-log-parser/logger.rb
84
+ - lib/quake-log-parser/patterns.rb
85
+ - lib/quake-log-parser/player.rb
86
+ - lib/quake-log-parser/version.rb
87
+ - quake-log-parser.gemspec
88
+ - real_example_to_run.rb
89
+ homepage: https://github.com/pedrofurtado/quake-log-parser
90
+ licenses:
91
+ - MIT
92
+ metadata:
93
+ homepage_uri: https://github.com/pedrofurtado/quake-log-parser
94
+ source_code_uri: https://github.com/pedrofurtado/quake-log-parser
95
+ changelog_uri: https://github.com/pedrofurtado/quake-log-parser/CHANGELOG.md
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubygems_version: 3.3.27
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Ruby gem for quake log parsing
115
+ test_files: []