log-analyser 0.1.2 → 0.1.3.pre.documentation.20201108181359

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb90df084483bf604c36ad9948de85acf67106d600d638e8f5ab0e6108893eb9
4
- data.tar.gz: 180dd9ed4317bdf485911d9ad2f3d3bd40e6c1b34fa6b66c5592b099125ac563
3
+ metadata.gz: e6524a24c2a502423d99cbb9461b86bb54068ee3ce9fe8562186ba1e8d66e05a
4
+ data.tar.gz: c0ae8e1d4783d80fada235ba7bdf98aec05a15f8666751baf9a9f54dd34dd543
5
5
  SHA512:
6
- metadata.gz: a56588d152eaa2f08cb5881b60872670d1e473cd81ff161706914076494b47a7fde8c5489eac2793133e5065f34733f9fd245d4b73dc46edb11049aab7e01dde
7
- data.tar.gz: f5f025c9a088cfd2ccb7926188c2011c391cc5e7c9361c4df4891e42a60255ce890b9aaf931b7dd9f89523b7375fcebef0fe8991cefc1b3d45a22c2ceb39c7ea
6
+ metadata.gz: e9b0d8f5e528b4c925d1a50e410a2afdae5a5779208216c8f776dd0ba47e92bc10e9b583917c2cf57f3de197bdafc4c1780ac283d75f7dba2337a43ff05f6bbb
7
+ data.tar.gz: 421a8d2a04f7246643cde2f09f85aa01bd89715830ea434486df3a0f5fbca19357d3d439b98c0ba3b76170338410ebc693e06129fee90d778540adc0bfdd669a
data/README.md CHANGED
@@ -26,6 +26,8 @@ After instantiating *log-analyser's* `PageviewsLogAggregator` class with the pat
26
26
  <summary>click to expand the index</summary>
27
27
 
28
28
  - [Installation](#installation)
29
+ * [Gem](#gem)
30
+ * [Project](#project)
29
31
  - [Usage](#usage)
30
32
  - [Logs and Pageviews](#logs-and-pageviews)
31
33
  * [Definitions](#definitions)
@@ -40,6 +42,8 @@ After instantiating *log-analyser's* `PageviewsLogAggregator` class with the pat
40
42
 
41
43
  ## Installation
42
44
 
45
+ ### Gem
46
+
43
47
  To use *log-analyser* in your application, add this line to your Gemfile:
44
48
 
45
49
  ```ruby
@@ -50,7 +54,7 @@ Or install it yourself as:
50
54
 
51
55
  $ gem install log-analyser
52
56
 
53
- ## Usage
57
+ #### Gem Usage
54
58
 
55
59
  ```
56
60
  ...
@@ -60,18 +64,72 @@ Or install it yourself as:
60
64
  ...
61
65
  ```
62
66
 
67
+ ### Project
68
+
69
+ Install the Ruby version specified in `.ruby-version` </br>
70
+ Clone the project and install Bundler
71
+
72
+ ```
73
+ git clone git@github.com:DMazzei/log-analyser.git
74
+ cd log-analyser
75
+ gem install bundler
76
+ ```
77
+
78
+ #### Setup:
79
+
80
+ Run the initial setup
81
+
82
+ $ bin/setup
83
+
84
+ > If you need to reinstall dependencies or something alike:
85
+ > ```
86
+ > $ bundle install
87
+ > ```
88
+
89
+ #### Usage
90
+
91
+ Call `./bin/parse_pageview_file.rb` passing a logfile path as argument, will return the pageview count ordered from most to less viewed.</br>
92
+ Check the script with `--help` argument for more options
93
+
94
+ ![image](https://user-images.githubusercontent.com/3502642/98471556-0c265c00-21e5-11eb-8fc3-c029e09e41fa.png)
95
+
96
+ An example log can be found in `resources` folder:
97
+
98
+ $ ./bin/parse_pageview_file.rb --file 'resources/webserver.log'
99
+ |--------------------------------------------------|
100
+ | All pageviews |
101
+ |--------------------------------------------------|
102
+ | /about/2.................... | 90 |
103
+ | /contact.................... | 89 |
104
+ | /index...................... | 82 |
105
+ | /about...................... | 81 |
106
+ | /help_page/1................ | 80 |
107
+ | /home....................... | 78 |
108
+ |--------------------------------------------------|
109
+
110
+ The `-u` or `--unique` option will also display the unique pageview count:
111
+
112
+ $ ./bin/parse_pageview_file.rb --file 'resources/webserver.log' -u
113
+
114
+ And any specific page can be filtered with `-p` or `--page`:
115
+
116
+ $ ./bin/parse_pageview_file.rb --file 'resources/webserver.log' -p '/index'
117
+ |--------------------------------------------------|
118
+ | View count for page: /index |
119
+ |--------------------------------------------------|
120
+ | All pageviews |
121
+ |--------------------------------------------------|
122
+ | /index...................... | 82 |
123
+ |--------------------------------------------------|
124
+
63
125
  ## Logs and Pageviews
64
126
 
65
127
  ### 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
128
 
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
- ```
129
+ > :page_facing_up: A pageview is defined as a view of a page on your site that is being tracked by the Analytics tracking code. If a user clicks reload after reaching the page, this is counted as an additional pageview. If a user navigates to a different page and then returns to the original page, a second pageview is recorded as well.
130
+
131
+ > :page_with_curl: A unique pageview, as seen in the Content Overview report, aggregates pageviews that are generated by the same user during the same session. A unique pageview represents the number of sessions during which that page was viewed one or more times.
132
+
75
133
 
76
134
  ### Log Formatting
77
135
 
@@ -89,25 +147,6 @@ A space must separate the page name (first column) from the user identifier (e.g
89
147
 
90
148
  #### Start with the project:
91
149
 
92
- Install the Ruby version specified in `.ruby-version` </br>
93
- Clone the project and install Bundler
94
-
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
150
 
112
151
 
113
152
  You can also run `Bundle exec console` for an interactive prompt that will allow you to experiment.
@@ -135,6 +174,8 @@ The _*master branch*_ merge process will trigger the deployment process on Circl
135
174
 
136
175
  The deployment process will build and tag a new gem version and push it to [rubygems.org](https://rubygems.org/gems/log-analyser).
137
176
 
177
+ > :warning: In order to merge changes into _*master branch*_, the version must be bumped up, otherwise the deployment will fail.</br>
178
+ > The version must be updated in `version.rb`.
138
179
 
139
180
  ## Contributing
140
181
 
@@ -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(.ruby-version CHANGELOG Gemfile 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)
25
+ spec.files = %w(.ruby-version CHANGELOG LICENSE.txt README.md 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']
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
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.2
4
+ version: 0.1.3.pre.documentation.20201108181359
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-07 00:00:00.000000000 Z
11
+ date: 2020-11-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Log reader and data aggregator for pageviews information.
14
14
  email:
@@ -19,13 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".ruby-version"
21
21
  - CHANGELOG
22
- - Gemfile
23
- - Guardfile
24
22
  - LICENSE.txt
25
23
  - README.md
26
- - Rakefile
27
- - bin/setup
28
- - config/environment.rb
29
24
  - lib/pageviews.rb
30
25
  - lib/pageviews_log_aggregator.rb
31
26
  - lib/parser.rb
@@ -48,9 +43,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
43
  version: '2.7'
49
44
  required_rubygems_version: !ruby/object:Gem::Requirement
50
45
  requirements:
51
- - - ">="
46
+ - - ">"
52
47
  - !ruby/object:Gem::Version
53
- version: '0'
48
+ version: 1.3.1
54
49
  requirements: []
55
50
  rubygems_version: 3.1.4
56
51
  signing_key:
data/Gemfile DELETED
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'bundler'
6
- gem 'rake', '~> 12.0'
7
- gem 'require_all'
8
-
9
- group :development, :test do
10
- gem 'coveralls_reborn', '~> 0.18.0', require: false
11
- gem 'rspec', '~> 3.8'
12
- gem 'rspec_junit_formatter'
13
- gem 'rubocop', require: false
14
- gem 'simplecov', require: false
15
- gem 'simplecov-lcov'
16
- end
17
-
18
- group :development do
19
- gem 'guard'
20
- gem 'guard-rspec'
21
- gem 'pry'
22
- end
23
-
24
- gemspec name: 'log-analyser'
data/Guardfile DELETED
@@ -1,45 +0,0 @@
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/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
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
8
-
9
- Bundler::GemHelper.install_tasks
10
-
11
- require 'rubygems'
12
- require 'rspec/core/rake_task'
13
-
14
- RSpec::Core::RakeTask.new(:spec)
15
-
16
- task default: :spec
data/bin/setup DELETED
@@ -1,19 +0,0 @@
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
@@ -1,11 +0,0 @@
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'