har 0.0.2 → 0.0.3
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.
- data/bin/har +6 -1
- data/har.gemspec +1 -1
- data/lib/har.rb +1 -5
- data/lib/har/archive.rb +13 -0
- data/lib/har/error.rb +4 -0
- data/lib/har/page.rb +0 -4
- data/lib/har/version.rb +1 -1
- data/lib/har/viewer.rb +11 -10
- data/spec/har/archive_spec.rb +5 -0
- metadata +6 -3
data/bin/har
CHANGED
data/har.gemspec
CHANGED
data/lib/har.rb
CHANGED
@@ -2,11 +2,7 @@ require 'json'
|
|
2
2
|
require 'json-schema'
|
3
3
|
require 'time'
|
4
4
|
|
5
|
-
|
6
|
-
class Error < StandardError; end
|
7
|
-
class ValidationError < StandardError; end
|
8
|
-
end
|
9
|
-
|
5
|
+
require 'har/error'
|
10
6
|
require 'har/version'
|
11
7
|
require 'har/serializable'
|
12
8
|
require 'har/schema_type'
|
data/lib/har/archive.rb
CHANGED
@@ -10,6 +10,19 @@ module HAR
|
|
10
10
|
from_string File.read(path), path
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.by_merging(hars)
|
14
|
+
hars = hars.dup
|
15
|
+
|
16
|
+
result = hars.shift
|
17
|
+
result = from_file(result) unless result.kind_of? self
|
18
|
+
|
19
|
+
hars.each do |har|
|
20
|
+
result.merge! har.kind_of?(self) ? har : from_file(har)
|
21
|
+
end
|
22
|
+
|
23
|
+
result
|
24
|
+
end
|
25
|
+
|
13
26
|
attr_reader :uri
|
14
27
|
|
15
28
|
def initialize(input, uri = nil)
|
data/lib/har/error.rb
ADDED
data/lib/har/page.rb
CHANGED
data/lib/har/version.rb
CHANGED
data/lib/har/viewer.rb
CHANGED
@@ -10,7 +10,11 @@ module HAR
|
|
10
10
|
@running = false
|
11
11
|
@options = parse(args)
|
12
12
|
|
13
|
-
@
|
13
|
+
if @options[:validate]
|
14
|
+
args = validate(args)
|
15
|
+
end
|
16
|
+
|
17
|
+
@har = Archive.by_merging(args)
|
14
18
|
end
|
15
19
|
|
16
20
|
def show
|
@@ -21,16 +25,13 @@ module HAR
|
|
21
25
|
|
22
26
|
private
|
23
27
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
progress("Validating archives...") do
|
29
|
-
hars.each { |h| h.validate! }
|
30
|
-
end
|
31
|
-
end
|
28
|
+
def validate(hars)
|
29
|
+
progress("Validating archives...") {
|
30
|
+
hars = hars.map { |path| Archive.from_file(path) }
|
31
|
+
hars.each { |h| h.validate! }
|
32
32
|
|
33
|
-
|
33
|
+
hars
|
34
|
+
}
|
34
35
|
end
|
35
36
|
|
36
37
|
def create_root
|
data/spec/har/archive_spec.rb
CHANGED
@@ -17,6 +17,11 @@ module HAR
|
|
17
17
|
ar.uri.should_not be_nil
|
18
18
|
ar.uri.should include("browser-blocking-time")
|
19
19
|
end
|
20
|
+
|
21
|
+
it "creates a single archive by merging the given paths" do
|
22
|
+
ar = Archive.by_merging good_hars.first(2)
|
23
|
+
ar.pages.size.should == 3
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
context "fetching data" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jari Bakken
|
@@ -40,7 +40,9 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
segments:
|
42
42
|
- 0
|
43
|
-
|
43
|
+
- 1
|
44
|
+
- 10
|
45
|
+
version: 0.1.10
|
44
46
|
type: :runtime
|
45
47
|
version_requirements: *id002
|
46
48
|
- !ruby/object:Gem::Dependency
|
@@ -90,6 +92,7 @@ files:
|
|
90
92
|
- har.gemspec
|
91
93
|
- lib/har.rb
|
92
94
|
- lib/har/archive.rb
|
95
|
+
- lib/har/error.rb
|
93
96
|
- lib/har/page.rb
|
94
97
|
- lib/har/schema_type.rb
|
95
98
|
- lib/har/schemas/browserType
|