log-analyser 0.1.2 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -1
- data/README.md +114 -38
- data/lib/pageviews.rb +15 -13
- data/lib/pageviews_log_aggregator.rb +16 -14
- data/lib/parser.rb +28 -21
- data/lib/unique_pageviews.rb +8 -6
- metadata +21 -15
- data/.ruby-version +0 -1
- data/Gemfile +0 -24
- data/Guardfile +0 -45
- data/Rakefile +0 -16
- data/bin/setup +0 -19
- data/config/environment.rb +0 -11
- data/log-analyser.gemspec +0 -29
- data/version.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03efda757aa22b9f9ea0f423141e06e6511652d96413e8cb17126fc683534a52
|
|
4
|
+
data.tar.gz: b48a0a4c69058d611a3195297c2df0a81a5057d5b7f32119a8cb40ac05b26c31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 300cddabf1f0b4ebd49f45aebc8a248086801184a8a2c01efae5d1f316d96beb0fd26dd3310234799dd95b070b7cd5b3197d139b80a70a59f27a03339f0c09a9
|
|
7
|
+
data.tar.gz: c45d4fd9cb2f49b7a0da8f93a74e6180d24bcd245e7f48d576d34c9d1ae1fd036240f685154cb123ddd5432a0e179c3e26ce2cf670d9988929d2443b2831e59d
|
data/CHANGELOG
CHANGED
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,44 +54,30 @@ Or install it yourself as:
|
|
|
50
54
|
|
|
51
55
|
$ gem install log-analyser
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
57
|
+
#### Gem Usage
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
viewed one or more times.
|
|
74
|
-
```
|
|
59
|
+
```ruby
|
|
60
|
+
#!/usr/bin/env ruby
|
|
75
61
|
|
|
76
|
-
|
|
62
|
+
require 'pageviews_log_aggregator'
|
|
77
63
|
|
|
78
|
-
|
|
64
|
+
file_path = '/Users/dmazzei/projects/personal/ruby/sp_test/log-analyser/resources/webserver.log'
|
|
65
|
+
log_aggregator = LogAnalyser::PageviewsLogAggregator.new(file_path)
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
puts "\nAll pageviews"
|
|
68
|
+
log_aggregator.all.each do |key, value|
|
|
69
|
+
puts "#{key&.to_s&.ljust(28, '.')} | #{value}"
|
|
70
|
+
end
|
|
81
71
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
puts "\nUnique pageviews"
|
|
73
|
+
log_aggregator.unique.each do |key, value|
|
|
74
|
+
puts "#{key&.to_s&.ljust(28, '.')} | #{value}"
|
|
75
|
+
end
|
|
86
76
|
```
|
|
87
77
|
|
|
88
|
-
|
|
78
|
+

|
|
89
79
|
|
|
90
|
-
|
|
80
|
+
### Project
|
|
91
81
|
|
|
92
82
|
Install the Ruby version specified in `.ruby-version` </br>
|
|
93
83
|
Clone the project and install Bundler
|
|
@@ -109,32 +99,116 @@ Run the initial setup
|
|
|
109
99
|
> $ bundle install
|
|
110
100
|
> ```
|
|
111
101
|
|
|
102
|
+
#### Usage
|
|
103
|
+
|
|
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
|
+
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
An example log can be found in :file_folder:`resources` folder:
|
|
110
|
+
|
|
111
|
+
$ ./bin/parse_pageview_file.rb --file 'resources/webserver.log'
|
|
112
|
+
|--------------------------------------------------|
|
|
113
|
+
| All pageviews |
|
|
114
|
+
|--------------------------------------------------|
|
|
115
|
+
| /about/2.................... | 90 |
|
|
116
|
+
| /contact.................... | 89 |
|
|
117
|
+
| /index...................... | 82 |
|
|
118
|
+
| /about...................... | 81 |
|
|
119
|
+
| /help_page/1................ | 80 |
|
|
120
|
+
| /home....................... | 78 |
|
|
121
|
+
|--------------------------------------------------|
|
|
122
|
+
|
|
123
|
+
The `-u` or `--unique` option will also display the unique pageview count:
|
|
124
|
+
|
|
125
|
+
$ ./bin/parse_pageview_file.rb --file 'resources/webserver.log' -u
|
|
126
|
+
|
|
127
|
+
And any specific page can be filtered with `-p` or `--page`:
|
|
128
|
+
|
|
129
|
+
$ ./bin/parse_pageview_file.rb --file 'resources/webserver.log' -p '/index'
|
|
130
|
+
|--------------------------------------------------|
|
|
131
|
+
| View count for page: /index |
|
|
132
|
+
|--------------------------------------------------|
|
|
133
|
+
| All pageviews |
|
|
134
|
+
|--------------------------------------------------|
|
|
135
|
+
| /index...................... | 82 |
|
|
136
|
+
|--------------------------------------------------|
|
|
137
|
+
|
|
138
|
+
## Logs and Pageviews
|
|
139
|
+
|
|
140
|
+
### Definitions
|
|
141
|
+
|
|
142
|
+
> :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.
|
|
143
|
+
|
|
144
|
+
> :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.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Log Formatting
|
|
148
|
+
|
|
149
|
+
The library is prepared to parser text files, containing one entry per line, in the format: `\page_name identifier`.
|
|
112
150
|
|
|
113
|
-
|
|
151
|
+
A space must separate the page name (first column) from the user identifier (e.g. IP address):
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
/help_page/1 126.318.035.038
|
|
155
|
+
/contact 184.123.665.067
|
|
156
|
+
/home 184.123.665.067
|
|
157
|
+
```
|
|
114
158
|
|
|
115
|
-
|
|
116
|
-
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
#### Start with the project:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
$ git clone git@github.com:DMazzei/log-analyser.git
|
|
165
|
+
$ cd log-analyser
|
|
166
|
+
$ gem install bundler
|
|
167
|
+
$ bundle install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
And the world is your oyster...
|
|
171
|
+
|
|
172
|
+
You can also run `bundle exec console` for an interactive prompt that will allow you to experiment.
|
|
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).
|
|
117
176
|
|
|
118
177
|
#### Linter (rubocop)
|
|
119
178
|
|
|
120
179
|
_*Rubocop*_ is used as code analyser and maintain code formatting (as well as some best practices).
|
|
121
180
|
|
|
122
|
-
Use
|
|
181
|
+
Use `$ bundle exec rake rubocop` to run the checks.
|
|
123
182
|
|
|
124
183
|
#### Test coverage
|
|
125
184
|
|
|
126
|
-
|
|
185
|
+
[](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
|
|
127
196
|
|
|
128
197
|
The test coverage is handled by `rspec`, `simplecov` and `coveralls`.
|
|
129
198
|
Status and coverage history can be checked [here](https://coveralls.io/github/DMazzei/log-analyser).
|
|
130
199
|
|
|
131
200
|
#### Deployment
|
|
132
201
|
|
|
133
|
-
|
|
134
|
-
|
|
202
|
+
Following the creation of a _*Pull Request*_ a CI workflow is triggered in CircleCI, that can be checked [here](https://app.circleci.com/pipelines/github/DMazzei/log-analyser).</br>
|
|
203
|
+
This workflow consist in _building_ the library; Running _rubocop_ and _rspec_ to validate integrity and code quality; And lastly generating and pushing a _feature-gem_ that can be used for development and tests.
|
|
204
|
+
|
|
205
|
+
After passing all checks and requirements on github, a *PR* can be merged as soon as it is reviewed and approved.
|
|
206
|
+
The _*master branch*_ merge process will trigger the deployment process on CircleCI, and this workflow ends with the generation of a _*tagged-gem*_.
|
|
135
207
|
|
|
136
|
-
The deployment process will
|
|
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).
|
|
137
209
|
|
|
210
|
+
> :warning: To merge changes into _*master*_, the version must be bumped up, otherwise the deployment will fail!</br>
|
|
211
|
+
> The version must be updated in `version.rb`.
|
|
138
212
|
|
|
139
213
|
## Contributing
|
|
140
214
|
|
|
@@ -143,6 +217,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/DMazze
|
|
|
143
217
|
## Next Steps
|
|
144
218
|
|
|
145
219
|
- Extend the logfile formatting;
|
|
220
|
+
- Add more options for sorting and filtering;
|
|
221
|
+
- Automate library version bump up;
|
|
146
222
|
|
|
147
223
|
## License
|
|
148
224
|
|
data/lib/pageviews.rb
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
module LogAnalyser
|
|
4
|
+
class Pageviews
|
|
5
|
+
InvalidLogEntriesError = Class.new(StandardError)
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
def self.for(entries = {})
|
|
8
|
+
new.generate_view_count(entries)
|
|
9
|
+
rescue StandardError
|
|
10
|
+
raise InvalidLogEntriesError
|
|
11
|
+
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
def generate_view_count(entries)
|
|
14
|
+
entries
|
|
15
|
+
.transform_values(&:size)
|
|
16
|
+
.sort_by(&:last)
|
|
17
|
+
.reverse
|
|
18
|
+
.to_h
|
|
19
|
+
end
|
|
18
20
|
end
|
|
19
21
|
end
|
|
@@ -4,24 +4,26 @@ require_relative 'parser'
|
|
|
4
4
|
require_relative 'pageviews'
|
|
5
5
|
require_relative 'unique_pageviews'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
module LogAnalyser
|
|
8
|
+
class PageviewsLogAggregator
|
|
9
|
+
def initialize(file_path)
|
|
10
|
+
@file_path = file_path
|
|
11
|
+
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
def all
|
|
14
|
+
Pageviews.for(entries)
|
|
15
|
+
end
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
def unique
|
|
18
|
+
UniquePageviews.for(entries)
|
|
19
|
+
end
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
private
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
attr_accessor :file_path
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
def entries
|
|
26
|
+
@entries ||= Parser.call(file_path)
|
|
27
|
+
end
|
|
26
28
|
end
|
|
27
29
|
end
|
data/lib/parser.rb
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
class
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
module LogAnalyser
|
|
4
|
+
class Parser
|
|
5
|
+
class FileNotFoundError < StandardError
|
|
6
|
+
def initialize(path)
|
|
7
|
+
super("File not found for path: [#{path}]")
|
|
8
|
+
end
|
|
7
9
|
end
|
|
8
|
-
end
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
def self.call(file_path)
|
|
12
|
+
new.call(file_path)
|
|
13
|
+
end
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
def initialize
|
|
16
|
+
@entries = Hash.new { |h, k| h[k] = [] }
|
|
17
|
+
end
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
parse(data)
|
|
20
|
-
end
|
|
19
|
+
def call(file_path)
|
|
20
|
+
raise FileNotFoundError, file_path unless File.exist?(file_path)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
data = File.open(file_path).map(&:strip)
|
|
23
|
+
data.reject!(&:empty?)
|
|
24
|
+
parse(data)
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
entries = Hash.new { |h, k| h[k] = [] }
|
|
26
|
-
data.each do |entry|
|
|
27
|
-
key, value = *entry.split(/\s+/)
|
|
28
|
-
entries[key] << value
|
|
26
|
+
entries
|
|
29
27
|
end
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
attr_reader :entries
|
|
32
|
+
|
|
33
|
+
def parse(data)
|
|
34
|
+
data.each do |entry|
|
|
35
|
+
key, value = *entry.split(/\s+/)
|
|
36
|
+
entries[key] << value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
32
39
|
end
|
|
33
40
|
end
|
data/lib/unique_pageviews.rb
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
entries
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
module LogAnalyser
|
|
4
|
+
class UniquePageviews < Pageviews
|
|
5
|
+
def generate_view_count(entries)
|
|
6
|
+
entries.transform_values { |value| value.uniq.size }
|
|
7
|
+
.sort_by(&:last)
|
|
8
|
+
.reverse
|
|
9
|
+
.to_h
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
end
|
metadata
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: log-analyser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3.pre.documentation.20201108212148
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Mazzei
|
|
8
8
|
autorequire:
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-11-
|
|
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:
|
|
15
15
|
- danielmazzei@gmail.com
|
|
16
16
|
executables: []
|
|
17
17
|
extensions: []
|
|
18
|
-
extra_rdoc_files:
|
|
18
|
+
extra_rdoc_files:
|
|
19
|
+
- CHANGELOG
|
|
20
|
+
- LICENSE.txt
|
|
21
|
+
- README.md
|
|
19
22
|
files:
|
|
20
|
-
- ".ruby-version"
|
|
21
23
|
- CHANGELOG
|
|
22
|
-
- Gemfile
|
|
23
|
-
- Guardfile
|
|
24
24
|
- LICENSE.txt
|
|
25
25
|
- README.md
|
|
26
|
-
- Rakefile
|
|
27
|
-
- bin/setup
|
|
28
|
-
- config/environment.rb
|
|
29
26
|
- lib/pageviews.rb
|
|
30
27
|
- lib/pageviews_log_aggregator.rb
|
|
31
28
|
- lib/parser.rb
|
|
32
29
|
- lib/unique_pageviews.rb
|
|
33
|
-
- log-analyser.gemspec
|
|
34
|
-
- version.rb
|
|
35
30
|
homepage: https://github.com/DMazzei/log-analyser
|
|
36
31
|
licenses:
|
|
37
32
|
- MIT
|
|
38
33
|
metadata:
|
|
39
34
|
homepage_uri: https://github.com/DMazzei/log-analyser
|
|
35
|
+
source_code_uri: https://github.com/DMazzei/log-analyser
|
|
36
|
+
changelog_uri: https://github.com/DMazzei/log-analyser/blob/master/CHANGELOG
|
|
37
|
+
bug_tracker_uri: https://github.com/DMazzei/log-analyser/issues
|
|
38
|
+
documentation_uri: https://www.rubydoc.info/gems/log-analyser
|
|
40
39
|
post_install_message:
|
|
41
|
-
rdoc_options:
|
|
40
|
+
rdoc_options:
|
|
41
|
+
- "--title"
|
|
42
|
+
- Emoticon - emotions in terminal
|
|
43
|
+
- "--main"
|
|
44
|
+
- README.md
|
|
45
|
+
- "--line-numbers"
|
|
46
|
+
- "--inline-source"
|
|
47
|
+
- "--quiet"
|
|
42
48
|
require_paths:
|
|
43
49
|
- lib
|
|
44
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -48,9 +54,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
48
54
|
version: '2.7'
|
|
49
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
56
|
requirements:
|
|
51
|
-
- - "
|
|
57
|
+
- - ">"
|
|
52
58
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
59
|
+
version: 1.3.1
|
|
54
60
|
requirements: []
|
|
55
61
|
rubygems_version: 3.1.4
|
|
56
62
|
signing_key:
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.7.1
|
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
|
data/config/environment.rb
DELETED
|
@@ -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'
|
data/log-analyser.gemspec
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'log-analyser'
|
|
7
|
-
spec.version = VERSION
|
|
8
|
-
spec.authors = ['Dan Mazzei']
|
|
9
|
-
spec.email = ['danielmazzei@gmail.com']
|
|
10
|
-
|
|
11
|
-
spec.summary = 'Log reader and data aggregator for pageviews information.'
|
|
12
|
-
spec.description = 'Log reader and data aggregator for pageviews information.'
|
|
13
|
-
spec.homepage = 'https://github.com/DMazzei/log-analyser'
|
|
14
|
-
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.7')
|
|
16
|
-
|
|
17
|
-
# spec.metadata['allowed_push_host'] = "'TODO: Set to 'http://mygemserver.com''"
|
|
18
|
-
|
|
19
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
|
20
|
-
# spec.metadata['source_code_uri'] = "'TODO: Put your gem's public repo URL here.'"
|
|
21
|
-
# spec.metadata['changelog_uri'] = "'TODO: Put your gem's CHANGELOG.md URL here.'"
|
|
22
|
-
|
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
|
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)
|
|
26
|
-
spec.bindir = 'exe'
|
|
27
|
-
spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
|
|
28
|
-
spec.require_paths = ['lib']
|
|
29
|
-
end
|
data/version.rb
DELETED