testing_your_legacy 0.1.4 → 0.1.5
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/lib/sumo_sum.rb +10 -1
- data/lib/testing_your_legacy/raw_file.rb +50 -0
- data/lib/testing_your_legacy/testing_your_legacy.rb +19 -1
- data/lib/testing_your_legacy/version.rb +1 -1
- data/testing_your_legacy.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ae5379428325e1d1178e1398d64cc90cc45aa82
|
4
|
+
data.tar.gz: 4cc4a777cc707cdf97e1f43a67ad2fa1185a667f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff4845d56e92756722e1a527918c89dfe99ec5fb2bc1b0209412d703532c70677bdc8d637b7b68914c0847934b60916ffd2e8fd5a2747ecfb82e6f7f2315073
|
7
|
+
data.tar.gz: aaca3da6f34ddc5abe0dfcee34b29e53ffbbccc2899020c7ff88582ac71f1b2624be4e1bcb99ce4a1077fcc45f7e3f75067b7ab7bbd42e9e15533f19db1d9a16
|
data/lib/sumo_sum.rb
CHANGED
@@ -7,7 +7,16 @@ module SumoSum
|
|
7
7
|
discovers = TestingYourLegacy::Discover.new(list)
|
8
8
|
|
9
9
|
discovers.each do |r|
|
10
|
-
puts discovers.
|
10
|
+
puts discovers.generate_test(r) + "\n"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.process_file(file,count)
|
15
|
+
list=TestingYourLegacy::RawFile.new(file,count)
|
16
|
+
discovers = TestingYourLegacy::Discover.new(list)
|
17
|
+
|
18
|
+
discovers.each do |r|
|
19
|
+
puts discovers.generate_test(r) + "\n"
|
11
20
|
end
|
12
21
|
|
13
22
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module TestingYourLegacy
|
2
|
+
|
3
|
+
require_relative 'testing_your_legacy'
|
4
|
+
class RawFile
|
5
|
+
|
6
|
+
def initialize(file,count = 25)
|
7
|
+
@file = file
|
8
|
+
@count = count
|
9
|
+
end
|
10
|
+
|
11
|
+
def each
|
12
|
+
to_log_summary.each { |record| yield record }
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_log_summary
|
16
|
+
TestingYourLegacy::LogSummary.new(to_a)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_a
|
20
|
+
sum.keys.each_with_object([]) do | key, memo |
|
21
|
+
memo << TestingYourLegacy::LogEntry.new(key[0],
|
22
|
+
key[1],
|
23
|
+
sum[key])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def sum
|
28
|
+
@sum ||= parsed_urls.each_with_object(Hash.new(0)) do |url,memo|
|
29
|
+
memo[[int_to_id(url[:url]),url[:protocol]]] += 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def int_to_id(url)
|
34
|
+
url.gsub(/\d+/,"id").gsub(/\?.*/,"?search_string")
|
35
|
+
end
|
36
|
+
|
37
|
+
def parsed_urls
|
38
|
+
@parsed_urls ||= started_only.map do |line|
|
39
|
+
line.match(/^Started (?<protocol>\w+) "(?<url>.*)"/)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def started_only
|
44
|
+
@started_only ||= @file.select { |line|
|
45
|
+
line.match(/^Started/) && !line.match(/assets/)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -1,3 +1,21 @@
|
|
1
1
|
module TestingYourLegacy
|
2
|
-
LogEntry=Struct.new(:url,:protocol,:visits)
|
2
|
+
LogEntry=Struct.new(:url,:protocol,:visits) {
|
3
|
+
|
4
|
+
include Comparable
|
5
|
+
|
6
|
+
def <=>(other)
|
7
|
+
visits <=> other.visits
|
8
|
+
end
|
9
|
+
|
10
|
+
}
|
11
|
+
|
12
|
+
LogSummary=Struct.new(:list) {
|
13
|
+
|
14
|
+
def each
|
15
|
+
list.sort.reverse.each do |entry|
|
16
|
+
yield entry
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
}
|
3
21
|
end
|
data/testing_your_legacy.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testing_your_legacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timothy Nordloh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sumo-search
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '5.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '5.8'
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- tnordloh@gmail.com
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/testing_your_legacy.rb
|
89
89
|
- lib/testing_your_legacy/discover.rb
|
90
90
|
- lib/testing_your_legacy/method_template.erb
|
91
|
+
- lib/testing_your_legacy/raw_file.rb
|
91
92
|
- lib/testing_your_legacy/test_template.erb
|
92
93
|
- lib/testing_your_legacy/testing_your_legacy.rb
|
93
94
|
- lib/testing_your_legacy/version.rb
|