log-analyser 0.1.1.pre.addgemtagrelease.20201106201808 → 0.1.1.pre.expandreadme.20201107175459
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +117 -0
- data/Guardfile +45 -0
- data/README.md +107 -15
- data/Rakefile +8 -3
- data/bin/setup +19 -0
- data/config/environment.rb +11 -0
- data/log-analyser.gemspec +1 -1
- metadata +7 -3
- data/manifest +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f9d523d47a6b531fa78376a0973968dd8fd5fe2b4ea1aebedb673797dc10ba0c
|
|
4
|
+
data.tar.gz: bcd5153042a04926b2d38852c3b31c2f3a038a3b71a679a9c9d822042c0b096d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04b5916754e08d990557dd0d58e2a08c6c13651193bc443a37b995f8f1c2793083aea770145590aa1bf39fd126e1302a1c4bf3e26b87408aa0e16dfff643fd11
|
|
7
|
+
data.tar.gz: '09f522da150acc9a30b1496f185df0960e585e41ebb83d90a41c8775ceda810b35d12fbc162ce608a8bcc0bc986ea34f19b114dec1c662123909c17e763becdc'
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.7.1
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
log-analyser (0.1.1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
ast (2.4.1)
|
|
10
|
+
coderay (1.1.3)
|
|
11
|
+
coveralls_reborn (0.18.0)
|
|
12
|
+
simplecov (>= 0.18.1, < 0.20.0)
|
|
13
|
+
term-ansicolor (~> 1.6)
|
|
14
|
+
thor (>= 0.20.3, < 2.0)
|
|
15
|
+
tins (~> 1.16)
|
|
16
|
+
diff-lcs (1.4.4)
|
|
17
|
+
docile (1.3.2)
|
|
18
|
+
ffi (1.13.1)
|
|
19
|
+
formatador (0.2.5)
|
|
20
|
+
guard (2.16.2)
|
|
21
|
+
formatador (>= 0.2.4)
|
|
22
|
+
listen (>= 2.7, < 4.0)
|
|
23
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
24
|
+
nenv (~> 0.1)
|
|
25
|
+
notiffany (~> 0.0)
|
|
26
|
+
pry (>= 0.9.12)
|
|
27
|
+
shellany (~> 0.0)
|
|
28
|
+
thor (>= 0.18.1)
|
|
29
|
+
guard-compat (1.2.1)
|
|
30
|
+
guard-rspec (4.7.3)
|
|
31
|
+
guard (~> 2.1)
|
|
32
|
+
guard-compat (~> 1.1)
|
|
33
|
+
rspec (>= 2.99.0, < 4.0)
|
|
34
|
+
listen (3.2.1)
|
|
35
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
36
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
37
|
+
lumberjack (1.2.8)
|
|
38
|
+
method_source (1.0.0)
|
|
39
|
+
nenv (0.3.0)
|
|
40
|
+
notiffany (0.1.3)
|
|
41
|
+
nenv (~> 0.1)
|
|
42
|
+
shellany (~> 0.0)
|
|
43
|
+
parallel (1.19.2)
|
|
44
|
+
parser (2.7.2.0)
|
|
45
|
+
ast (~> 2.4.1)
|
|
46
|
+
pry (0.13.1)
|
|
47
|
+
coderay (~> 1.1)
|
|
48
|
+
method_source (~> 1.0)
|
|
49
|
+
rainbow (3.0.0)
|
|
50
|
+
rake (12.3.3)
|
|
51
|
+
rb-fsevent (0.10.4)
|
|
52
|
+
rb-inotify (0.10.1)
|
|
53
|
+
ffi (~> 1.0)
|
|
54
|
+
regexp_parser (1.8.2)
|
|
55
|
+
require_all (3.0.0)
|
|
56
|
+
rexml (3.2.4)
|
|
57
|
+
rspec (3.10.0)
|
|
58
|
+
rspec-core (~> 3.10.0)
|
|
59
|
+
rspec-expectations (~> 3.10.0)
|
|
60
|
+
rspec-mocks (~> 3.10.0)
|
|
61
|
+
rspec-core (3.10.0)
|
|
62
|
+
rspec-support (~> 3.10.0)
|
|
63
|
+
rspec-expectations (3.10.0)
|
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
65
|
+
rspec-support (~> 3.10.0)
|
|
66
|
+
rspec-mocks (3.10.0)
|
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
68
|
+
rspec-support (~> 3.10.0)
|
|
69
|
+
rspec-support (3.10.0)
|
|
70
|
+
rspec_junit_formatter (0.4.1)
|
|
71
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
72
|
+
rubocop (1.2.0)
|
|
73
|
+
parallel (~> 1.10)
|
|
74
|
+
parser (>= 2.7.1.5)
|
|
75
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
76
|
+
regexp_parser (>= 1.8)
|
|
77
|
+
rexml
|
|
78
|
+
rubocop-ast (>= 1.0.1)
|
|
79
|
+
ruby-progressbar (~> 1.7)
|
|
80
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
81
|
+
rubocop-ast (1.1.1)
|
|
82
|
+
parser (>= 2.7.1.5)
|
|
83
|
+
ruby-progressbar (1.10.1)
|
|
84
|
+
shellany (0.0.1)
|
|
85
|
+
simplecov (0.19.1)
|
|
86
|
+
docile (~> 1.1)
|
|
87
|
+
simplecov-html (~> 0.11)
|
|
88
|
+
simplecov-html (0.12.3)
|
|
89
|
+
simplecov-lcov (0.8.0)
|
|
90
|
+
sync (0.5.0)
|
|
91
|
+
term-ansicolor (1.7.1)
|
|
92
|
+
tins (~> 1.0)
|
|
93
|
+
thor (1.0.1)
|
|
94
|
+
tins (1.26.0)
|
|
95
|
+
sync
|
|
96
|
+
unicode-display_width (1.7.0)
|
|
97
|
+
|
|
98
|
+
PLATFORMS
|
|
99
|
+
ruby
|
|
100
|
+
|
|
101
|
+
DEPENDENCIES
|
|
102
|
+
bundler
|
|
103
|
+
coveralls_reborn (~> 0.18.0)
|
|
104
|
+
guard
|
|
105
|
+
guard-rspec
|
|
106
|
+
log-analyser!
|
|
107
|
+
pry
|
|
108
|
+
rake (~> 12.0)
|
|
109
|
+
require_all
|
|
110
|
+
rspec (~> 3.8)
|
|
111
|
+
rspec_junit_formatter
|
|
112
|
+
rubocop
|
|
113
|
+
simplecov
|
|
114
|
+
simplecov-lcov
|
|
115
|
+
|
|
116
|
+
BUNDLED WITH
|
|
117
|
+
2.1.4
|
data/Guardfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A sample Guardfile
|
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
|
5
|
+
|
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
|
7
|
+
# directories %w(app lib config test spec features) \
|
|
8
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
|
9
|
+
|
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
13
|
+
#
|
|
14
|
+
# $ mkdir config
|
|
15
|
+
# $ mv Guardfile config/
|
|
16
|
+
# $ ln -s config/Guardfile .
|
|
17
|
+
#
|
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
19
|
+
|
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
|
22
|
+
# * bundler: 'bundle exec rspec'
|
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
|
25
|
+
# installed the spring binstubs per the docs)
|
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
|
27
|
+
# * 'just' rspec: 'rspec'
|
|
28
|
+
|
|
29
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
30
|
+
require 'guard/rspec/dsl'
|
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
32
|
+
|
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
|
34
|
+
|
|
35
|
+
# RSpec files
|
|
36
|
+
rspec = dsl.rspec
|
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
39
|
+
watch(rspec.spec_files)
|
|
40
|
+
watch(/^lib\/documents_analyser\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
|
|
41
|
+
|
|
42
|
+
# Ruby files
|
|
43
|
+
ruby = dsl.ruby
|
|
44
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
45
|
+
end
|
data/README.md
CHANGED
|
@@ -1,51 +1,143 @@
|
|
|
1
1
|
[](https://coveralls.io/github/DMazzei/log-analyser?branch=master)
|
|
2
|
+
[](https://badge.fury.io/rb/log-analyser)
|
|
3
|
+
[](https://app.circleci.com/pipelines/github/DMazzei/log-analyser)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
# Log-Analyser
|
|
2
8
|
|
|
9
|
+
## About
|
|
3
10
|
|
|
11
|
+
Simple ruby library to read and parse web-server's log files and aggregate pageview data.
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
### TL;DR
|
|
14
|
+
<details>
|
|
15
|
+
<summary>check minimal instructions</summary>
|
|
7
16
|
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
Install *log-analyser* gem.
|
|
18
|
+
After instantiating *log-analyser's* `PageviewsLogAggregator` class with the path to the logfile:
|
|
19
|
+
</br>- the method `all` will return the pageview count
|
|
20
|
+
</br>- whilst method `unique` will return the unique pageview count.
|
|
10
21
|
|
|
22
|
+
</details>
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
### Table of Contents
|
|
25
|
+
<details>
|
|
26
|
+
<summary>click to expand the index</summary>
|
|
13
27
|
|
|
14
|
-
|
|
28
|
+
- [Installation](#installation)
|
|
29
|
+
- [Usage](#usage)
|
|
30
|
+
- [Logs and Pageviews](#logs-and-pageviews)
|
|
31
|
+
* [Definitions](#definitions)
|
|
32
|
+
* [Log Formatting](#log-formatting)
|
|
33
|
+
- [Development](#development)
|
|
34
|
+
- [Contributing](#contributing)
|
|
35
|
+
- [Next Steps](#next-steps)
|
|
36
|
+
- [License](#license)
|
|
37
|
+
|
|
15
38
|
|
|
16
|
-
|
|
39
|
+
</details>
|
|
17
40
|
|
|
18
41
|
## Installation
|
|
19
42
|
|
|
20
|
-
|
|
43
|
+
To use *log-analyser* in your application, add this line to your Gemfile:
|
|
21
44
|
|
|
22
45
|
```ruby
|
|
23
46
|
gem 'log-analyser'
|
|
24
47
|
```
|
|
25
48
|
|
|
26
|
-
And then execute:
|
|
27
|
-
|
|
28
|
-
$ bundle install
|
|
29
|
-
|
|
30
49
|
Or install it yourself as:
|
|
31
50
|
|
|
32
51
|
$ gem install log-analyser
|
|
33
52
|
|
|
34
53
|
## Usage
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
```
|
|
56
|
+
...
|
|
57
|
+
...
|
|
58
|
+
...
|
|
59
|
+
...
|
|
60
|
+
...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Logs and Pageviews
|
|
64
|
+
|
|
65
|
+
### Definitions
|
|
66
|
+
```
|
|
67
|
+
A pageview is defined as a view of a page on your site that is being tracked by the Analytics tracking code.
|
|
68
|
+
If a user clicks reload after reaching the page, this is counted as an additional pageview.
|
|
69
|
+
If a user navigates to a different page and then returns to the original page, a second pageview is recorded as well.
|
|
70
|
+
|
|
71
|
+
A unique pageview, as seen in the Content Overview report, aggregates pageviews that are generated by the same
|
|
72
|
+
user during the same session. A unique pageview represents the number of sessions during which that page was
|
|
73
|
+
viewed one or more times.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Log Formatting
|
|
77
|
+
|
|
78
|
+
The library is prepared to parser text files, containing one entry per line, in the format: `\page_name identifier`.
|
|
79
|
+
|
|
80
|
+
A space must separate the page name (first column) from the user identifier (e.g. IP address):
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
/help_page/1 126.318.035.038
|
|
84
|
+
/contact 184.123.665.067
|
|
85
|
+
/home 184.123.665.067
|
|
86
|
+
```
|
|
37
87
|
|
|
38
88
|
## Development
|
|
39
89
|
|
|
40
|
-
|
|
90
|
+
#### Start with the project:
|
|
91
|
+
|
|
92
|
+
Install the Ruby version specified in `.ruby-version` </br>
|
|
93
|
+
Clone the project and install Bundler
|
|
41
94
|
|
|
42
|
-
|
|
95
|
+
```
|
|
96
|
+
git clone git@github.com:DMazzei/log-analyser.git
|
|
97
|
+
cd log-analyser
|
|
98
|
+
gem install bundler
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Setup:
|
|
102
|
+
|
|
103
|
+
Run the initial setup
|
|
104
|
+
|
|
105
|
+
$ bin/setup
|
|
106
|
+
|
|
107
|
+
> If you need to reinstall dependencies or something alike:
|
|
108
|
+
> ```
|
|
109
|
+
> $ bundle install
|
|
110
|
+
> ```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
You can also run `Bundle exec console` for an interactive prompt that will allow you to experiment.
|
|
114
|
+
|
|
115
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
116
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
117
|
+
|
|
118
|
+
#### Linter (rubocop)
|
|
119
|
+
|
|
120
|
+
_*Rubocop*_ is used as code analyser and maintain code formatting (as well as some best practices).
|
|
121
|
+
|
|
122
|
+
Use `Bundle exec rake rubocop` to run the checks.
|
|
123
|
+
|
|
124
|
+
#### Test coverage
|
|
125
|
+
|
|
126
|
+
Use `Bundle exec rake rspec` to run the tests.
|
|
127
|
+
|
|
128
|
+
The test coverage is handled by `rspec`, `simplecov` and `coveralls`.
|
|
129
|
+
Status and coverage history can be checked [here](https://coveralls.io/github/DMazzei/log-analyser).
|
|
43
130
|
|
|
44
131
|
## Contributing
|
|
45
132
|
|
|
46
133
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/log-analyser.
|
|
47
134
|
|
|
135
|
+
## Next Steps
|
|
136
|
+
|
|
137
|
+
- Extend the logfile formatting;
|
|
48
138
|
|
|
49
139
|
## License
|
|
50
140
|
|
|
51
141
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
142
|
+
|
|
143
|
+
|
data/Rakefile
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require '
|
|
5
|
-
|
|
3
|
+
begin
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
7
|
+
end
|
|
6
8
|
|
|
7
9
|
Bundler::GemHelper.install_tasks
|
|
8
10
|
|
|
11
|
+
require 'rubygems'
|
|
12
|
+
require 'rspec/core/rake_task'
|
|
13
|
+
|
|
9
14
|
RSpec::Core::RakeTask.new(:spec)
|
|
10
15
|
|
|
11
16
|
task default: :spec
|
data/bin/setup
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
# path to your application root.
|
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
6
|
+
|
|
7
|
+
def system!(*args)
|
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
FileUtils.chdir APP_ROOT do
|
|
12
|
+
# This script is a way to setup or update your development environment automatically.
|
|
13
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
|
14
|
+
# Add necessary setup steps to this file.
|
|
15
|
+
|
|
16
|
+
puts '== Installing dependencies =='
|
|
17
|
+
system! 'gem install bundler --conservative'
|
|
18
|
+
system('bundle check') || system!('bundle install')
|
|
19
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'pathname'
|
|
5
|
+
require 'require_all'
|
|
6
|
+
|
|
7
|
+
APP_ROOT = Pathname.new(__dir__).parent
|
|
8
|
+
$LOAD_PATH.unshift(File.join(APP_ROOT, '/lib')) unless $LOAD_PATH.include?(File.join(APP_ROOT, '/lib'))
|
|
9
|
+
|
|
10
|
+
require './version'
|
|
11
|
+
require_all './lib'
|
data/log-analyser.gemspec
CHANGED
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
|
-
spec.files = %w(CHANGELOG Gemfile LICENSE.txt
|
|
25
|
+
spec.files = %w(.ruby-version CHANGELOG Gemfile Gemfile.lock Guardfile LICENSE.txt README.md Rakefile bin/setup config/environment.rb lib/pageviews.rb lib/pageviews_log_aggregator.rb lib/parser.rb lib/unique_pageviews.rb log-analyser.gemspec version.rb)
|
|
26
26
|
spec.bindir = 'exe'
|
|
27
27
|
spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
|
|
28
28
|
spec.require_paths = ['lib']
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: log-analyser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.1.pre.
|
|
4
|
+
version: 0.1.1.pre.expandreadme.20201107175459
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Mazzei
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-11-
|
|
11
|
+
date: 2020-11-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Log reader and data aggregator for pageviews information.
|
|
14
14
|
email:
|
|
@@ -17,17 +17,21 @@ executables: []
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
+
- ".ruby-version"
|
|
20
21
|
- CHANGELOG
|
|
21
22
|
- Gemfile
|
|
23
|
+
- Gemfile.lock
|
|
24
|
+
- Guardfile
|
|
22
25
|
- LICENSE.txt
|
|
23
26
|
- README.md
|
|
24
27
|
- Rakefile
|
|
28
|
+
- bin/setup
|
|
29
|
+
- config/environment.rb
|
|
25
30
|
- lib/pageviews.rb
|
|
26
31
|
- lib/pageviews_log_aggregator.rb
|
|
27
32
|
- lib/parser.rb
|
|
28
33
|
- lib/unique_pageviews.rb
|
|
29
34
|
- log-analyser.gemspec
|
|
30
|
-
- manifest
|
|
31
35
|
- version.rb
|
|
32
36
|
homepage: https://github.com/DMazzei/log-analyser
|
|
33
37
|
licenses:
|