har 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/har +1 -0
- data/lib/har/archive.rb +13 -2
- data/lib/har/version.rb +1 -1
- data/lib/har/viewer.rb +10 -4
- data/spec/har/archive_spec.rb +6 -0
- metadata +4 -25
data/bin/har
CHANGED
data/lib/har/archive.rb
CHANGED
@@ -6,8 +6,19 @@ module HAR
|
|
6
6
|
new JSON.parse(str), uri
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.from_file(
|
10
|
-
|
9
|
+
def self.from_file(path_or_io)
|
10
|
+
case path_or_io
|
11
|
+
when String
|
12
|
+
from_string File.read(path_or_io), path_or_io
|
13
|
+
when IO
|
14
|
+
from_string path_or_io.read, path_or_io.to_s
|
15
|
+
else
|
16
|
+
unless path_or_io.respond_to?(:to_io)
|
17
|
+
raise TypeError, "expected String, IO or #to_io"
|
18
|
+
end
|
19
|
+
|
20
|
+
from_file path_or_io.to_io
|
21
|
+
end
|
11
22
|
end
|
12
23
|
|
13
24
|
def self.by_merging(hars)
|
data/lib/har/version.rb
CHANGED
data/lib/har/viewer.rb
CHANGED
@@ -14,9 +14,15 @@ module HAR
|
|
14
14
|
args = validate(args)
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
if args == ["-"]
|
18
|
+
progress("Reading HAR from stdin...") {
|
19
|
+
@har = Archive.from_file $stdin
|
20
|
+
}
|
21
|
+
else
|
22
|
+
progress("Merging HARs...") {
|
23
|
+
@har = Archive.by_merging args
|
24
|
+
}
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def show
|
@@ -59,7 +65,7 @@ module HAR
|
|
59
65
|
options = DEFAULT_OPTIONS.dup
|
60
66
|
|
61
67
|
OptionParser.new do |opts|
|
62
|
-
opts.banner = "Usage: har [options] [files]"
|
68
|
+
opts.banner = "Usage: har [options] [files|-]"
|
63
69
|
|
64
70
|
opts.on "-p", "--port PORT", Integer do |int|
|
65
71
|
options[:port] = int
|
data/spec/har/archive_spec.rb
CHANGED
@@ -12,6 +12,12 @@ module HAR
|
|
12
12
|
Archive.from_file(har_path("browser-blocking-time")).should be_kind_of(Archive)
|
13
13
|
end
|
14
14
|
|
15
|
+
it "can be created from an IO" do
|
16
|
+
File.open(har_path("browser-blocking-time"), "r") do |io|
|
17
|
+
Archive.from_file(io).should be_kind_of(Archive)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
it "saves the archive URI if created from a file" do
|
16
22
|
ar = Archive.from_file(har_path("browser-blocking-time"))
|
17
23
|
ar.uri.should_not be_nil
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: har
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.5
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jari Bakken
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-02-12 00:00:00 +01:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
24
|
version: "0"
|
31
25
|
type: :runtime
|
32
26
|
version_requirements: *id001
|
@@ -38,10 +32,6 @@ dependencies:
|
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
|
-
- 1
|
44
|
-
- 10
|
45
35
|
version: 0.1.10
|
46
36
|
type: :runtime
|
47
37
|
version_requirements: *id002
|
@@ -53,8 +43,6 @@ dependencies:
|
|
53
43
|
requirements:
|
54
44
|
- - ">="
|
55
45
|
- !ruby/object:Gem::Version
|
56
|
-
segments:
|
57
|
-
- 0
|
58
46
|
version: "0"
|
59
47
|
type: :runtime
|
60
48
|
version_requirements: *id003
|
@@ -66,9 +54,6 @@ dependencies:
|
|
66
54
|
requirements:
|
67
55
|
- - ~>
|
68
56
|
- !ruby/object:Gem::Version
|
69
|
-
segments:
|
70
|
-
- 2
|
71
|
-
- 0
|
72
57
|
version: "2.0"
|
73
58
|
type: :development
|
74
59
|
version_requirements: *id004
|
@@ -80,8 +65,6 @@ dependencies:
|
|
80
65
|
requirements:
|
81
66
|
- - ">="
|
82
67
|
- !ruby/object:Gem::Version
|
83
|
-
segments:
|
84
|
-
- 0
|
85
68
|
version: "0"
|
86
69
|
type: :development
|
87
70
|
version_requirements: *id005
|
@@ -264,21 +247,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
264
247
|
requirements:
|
265
248
|
- - ">="
|
266
249
|
- !ruby/object:Gem::Version
|
267
|
-
segments:
|
268
|
-
- 0
|
269
250
|
version: "0"
|
270
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
252
|
none: false
|
272
253
|
requirements:
|
273
254
|
- - ">="
|
274
255
|
- !ruby/object:Gem::Version
|
275
|
-
segments:
|
276
|
-
- 0
|
277
256
|
version: "0"
|
278
257
|
requirements: []
|
279
258
|
|
280
259
|
rubyforge_project: har
|
281
|
-
rubygems_version: 1.
|
260
|
+
rubygems_version: 1.5.0
|
282
261
|
signing_key:
|
283
262
|
specification_version: 3
|
284
263
|
summary: Ruby library to work with HTTP archives
|