log-analyser 0.1.3.pre.documentation.20201108193310 → 0.1.3.pre.documentation.20201108212148

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -9
  3. data/lib/parser.rb +8 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a645c762e28326585af1cbe7f3d96e4bb46d6a72996d775692ba74c555ba6fc
4
- data.tar.gz: f98bbcd840b509840304dd1f7176e484938e29e9200326b2561f9c6dcea79962
3
+ metadata.gz: 03efda757aa22b9f9ea0f423141e06e6511652d96413e8cb17126fc683534a52
4
+ data.tar.gz: b48a0a4c69058d611a3195297c2df0a81a5057d5b7f32119a8cb40ac05b26c31
5
5
  SHA512:
6
- metadata.gz: 21314628d221eefc3a808c71847137a8c7ef06b2910085060c58c5f771012bb8950f00c677deaecf2c47e1b775ecfd395b0a57310dfe9e321c2cc73b2be72296
7
- data.tar.gz: 6c0243885a4c600c13b6b58145a64102c47d9e8f661e45c477f64d5b1f535a89245bba8e8e459a62ee40380c36b6870df7db1cd6c945759aa04c14a20e0685f4
6
+ metadata.gz: 300cddabf1f0b4ebd49f45aebc8a248086801184a8a2c01efae5d1f316d96beb0fd26dd3310234799dd95b070b7cd5b3197d139b80a70a59f27a03339f0c09a9
7
+ data.tar.gz: c45d4fd9cb2f49b7a0da8f93a74e6180d24bcd245e7f48d576d34c9d1ae1fd036240f685154cb123ddd5432a0e179c3e26ce2cf670d9988929d2443b2831e59d
data/README.md CHANGED
@@ -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,20 +169,30 @@ $ 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 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
192
+
193
+ :white_check_mark: To run only integration tests
194
+
195
+ $bundle exec rake spec:integration
186
196
 
187
197
  The test coverage is handled by `rspec`, `simplecov` and `coveralls`.
188
198
  Status and coverage history can be checked [here](https://coveralls.io/github/DMazzei/log-analyser).
@@ -197,7 +207,7 @@ The _*master branch*_ merge process will trigger the deployment process on Circl
197
207
 
198
208
  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
209
 
200
- > :warning: In order to merge changes into _*master branch*_, the version must be bumped up, otherwise the deployment will fail.</br>
210
+ > :warning: To merge changes into _*master*_, the version must be bumped up, otherwise the deployment will fail!</br>
201
211
  > The version must be updated in `version.rb`.
202
212
 
203
213
  ## Contributing
@@ -207,6 +217,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/DMazze
207
217
  ## Next Steps
208
218
 
209
219
  - Extend the logfile formatting;
220
+ - Add more options for sorting and filtering;
221
+ - Automate library version bump up;
210
222
 
211
223
  ## License
212
224
 
@@ -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,7 +1,7 @@
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.documentation.20201108212148
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mazzei