log-analyser 0.1.3.pre.documentation.20201108193310 → 0.1.3.pre.littleimprovements.20201109103434

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +3 -3
  3. data/README.md +31 -14
  4. data/lib/parser.rb +8 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a645c762e28326585af1cbe7f3d96e4bb46d6a72996d775692ba74c555ba6fc
4
- data.tar.gz: f98bbcd840b509840304dd1f7176e484938e29e9200326b2561f9c6dcea79962
3
+ metadata.gz: 3b62538506c3829402a9e9a867bf26d6576937c69614a4f530ef20cd64699d25
4
+ data.tar.gz: 5c77973bbe06797d4a95726439485ff254474ef3f11417787d972372e5d83d53
5
5
  SHA512:
6
- metadata.gz: 21314628d221eefc3a808c71847137a8c7ef06b2910085060c58c5f771012bb8950f00c677deaecf2c47e1b775ecfd395b0a57310dfe9e321c2cc73b2be72296
7
- data.tar.gz: 6c0243885a4c600c13b6b58145a64102c47d9e8f661e45c477f64d5b1f535a89245bba8e8e459a62ee40380c36b6870df7db1cd6c945759aa04c14a20e0685f4
6
+ metadata.gz: dc3f9e866820219b709fc2b5fab185afd51698e975cfb8bb528bc11c92132e99650431ce46af7b7d5ef722b02e915a3534876ece19d37fc5d4c6c7497dd6a677
7
+ data.tar.gz: f55d687636405327c1863950ae14c2720af6313407be1cbffc20239690a18ea88b8a92f54fbaf9f3187cd9c589d2e64d0ad244110e3f1ef798b11797028153fe
data/CHANGELOG CHANGED
@@ -1,7 +1,7 @@
1
1
  v0.1.3. completing documentation
2
2
 
3
- v0.1.2b.
3
+ v0.1.2b. add gem deployment
4
4
 
5
- v0.1.2.
5
+ v0.1.2. add circleci workflow
6
6
 
7
- v0.1.1. adding gemspec/echoe/
7
+ v0.1.1. add gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
+ [![Circle CI](https://circleci.com/gh/DMazzei/log-analyser.svg?style=shield)](https://app.circleci.com/pipelines/github/DMazzei/log-analyser)
1
2
  [![Coverage Status](https://coveralls.io/repos/github/DMazzei/log-analyser/badge.svg?branch=master)](https://coveralls.io/github/DMazzei/log-analyser?branch=master)
2
3
  [![Gem Version](https://badge.fury.io/rb/log-analyser.svg)](https://badge.fury.io/rb/log-analyser)
3
- [![Circle CI](https://circleci.com/gh/DMazzei/log-analyser.svg?style=shield)](https://app.circleci.com/pipelines/github/DMazzei/log-analyser)
4
4
  ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/dmazzei/log-analyser)
5
5
  ![Gem](https://img.shields.io/gem/dv/log-analyser/stable)
6
6
 
@@ -101,12 +101,12 @@ Run the initial setup
101
101
 
102
102
  #### Usage
103
103
 
104
- Call `./bin/parse_pageview_file.rb` passing a logfile path as argument, will return the pageview count ordered from most to less viewed.</br>
105
- Check the script with `--help` argument for more options
104
+ Call `./bin/parse_pageview_file.rb` passing a logfile path as argument, it will return the pageview count ordered from most to less viewed.</br>
105
+ Check `--help` for more options
106
106
 
107
107
  ![image](https://user-images.githubusercontent.com/3502642/98471556-0c265c00-21e5-11eb-8fc3-c029e09e41fa.png)
108
108
 
109
- An example log can be found in `resources` folder:
109
+ An example log can be found in :file_folder:`resources` folder:
110
110
 
111
111
  $ ./bin/parse_pageview_file.rb --file 'resources/webserver.log'
112
112
  |--------------------------------------------------|
@@ -169,23 +169,35 @@ $ bundle install
169
169
 
170
170
  And the world is your oyster...
171
171
 
172
- You can also run `Bundle exec console` for an interactive prompt that will allow you to experiment.
172
+ You can also run `$ bundle exec console` for an interactive prompt that will allow you to experiment.
173
173
 
174
- To install this gem onto your local machine, run `bundle exec rake install`.
175
- 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).
174
+ To install this gem onto your local machine, run `$ bundle exec rake install`.
175
+ 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).
176
176
 
177
177
  #### Linter (rubocop)
178
178
 
179
179
  _*Rubocop*_ is used as code analyser and maintain code formatting (as well as some best practices).
180
180
 
181
- Use `Bundle exec rake rubocop` to run the checks.
181
+ Use `$ bundle exec rake rubocop` to run the checks.
182
182
 
183
183
  #### Test coverage
184
184
 
185
- Use `Bundle exec rake rspec` to run the tests.
185
+ [![Coverage Status](https://coveralls.io/repos/github/DMazzei/log-analyser/badge.svg?branch=master)](https://coveralls.io/github/DMazzei/log-analyser?branch=master)
186
+
187
+ Use `$ bundle exec rspec` or `$ bundle exec rake spec:all` to run all the tests.
188
+
189
+ :white_check_mark: To run only unit-tests
190
+
191
+ $ bundle exec rake spec:unit
186
192
 
187
- The test coverage is handled by `rspec`, `simplecov` and `coveralls`.
188
- Status and coverage history can be checked [here](https://coveralls.io/github/DMazzei/log-analyser).
193
+ :white_check_mark: To run only integration tests
194
+
195
+ $ bundle exec rake spec:integration
196
+
197
+ The test coverage is handled by `rspec`, `simplecov` and `coveralls`.</br>
198
+ After running the tests, a local version of the test coverage report is available [here](http://localhost:63342/log-analyser/coverage/index.html).
199
+
200
+ Full status and coverage history can be checked online on [coveralls](https://coveralls.io/github/DMazzei/log-analyser).
189
201
 
190
202
  #### Deployment
191
203
 
@@ -197,7 +209,7 @@ The _*master branch*_ merge process will trigger the deployment process on Circl
197
209
 
198
210
  The whole deployment process will finish by building and tagging a new gem version and pushing it to [rubygems.org](https://rubygems.org/gems/log-analyser).
199
211
 
200
- > :warning: In order to merge changes into _*master branch*_, the version must be bumped up, otherwise the deployment will fail.</br>
212
+ > :warning: To merge changes into _*master*_, the version must be bumped up, otherwise the deployment will fail!</br>
201
213
  > The version must be updated in `version.rb`.
202
214
 
203
215
  ## Contributing
@@ -205,8 +217,13 @@ The whole deployment process will finish by building and tagging a new gem versi
205
217
  Bug reports and pull requests are welcome on GitHub at https://github.com/DMazzeig/log-analyser.
206
218
 
207
219
  ## Next Steps
208
-
209
- - Extend the logfile formatting;
220
+
221
+ - One conundrum faced that can be reviewed, deciding between:
222
+ * reading the file whilst aggregation data, preserving memory - e.g. using `Set`;
223
+ * loading data into memory and leaving aggregation and count to be dealt later, gaining flexibility and performance;
224
+ - Extend the accepted logfile format;
225
+ - Add more options for sorting and filtering;
226
+ - Automate library version bump up;
210
227
 
211
228
  ## License
212
229
 
@@ -12,24 +12,29 @@ module LogAnalyser
12
12
  new.call(file_path)
13
13
  end
14
14
 
15
+ def initialize
16
+ @entries = Hash.new { |h, k| h[k] = [] }
17
+ end
18
+
15
19
  def call(file_path)
16
20
  raise FileNotFoundError, file_path unless File.exist?(file_path)
17
21
 
18
22
  data = File.open(file_path).map(&:strip)
19
23
  data.reject!(&:empty?)
20
24
  parse(data)
25
+
26
+ entries
21
27
  end
22
28
 
23
29
  private
24
30
 
31
+ attr_reader :entries
32
+
25
33
  def parse(data)
26
- entries = Hash.new { |h, k| h[k] = [] }
27
34
  data.each do |entry|
28
35
  key, value = *entry.split(/\s+/)
29
36
  entries[key] << value
30
37
  end
31
-
32
- entries
33
38
  end
34
39
  end
35
40
  end
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.3.pre.documentation.20201108193310
4
+ version: 0.1.3.pre.littleimprovements.20201109103434
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mazzei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-08 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Log reader and data aggregator for pageviews information.
14
14
  email: