har 0.0.3 → 0.0.4

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/har.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency "launchy"
20
20
 
21
21
  s.add_development_dependency "rspec", "~> 2.0"
22
+ s.add_development_dependency "simplecov"
22
23
 
23
24
  s.files = `git ls-files`.split("\n")
24
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/lib/har/archive.rb CHANGED
@@ -13,7 +13,7 @@ module HAR
13
13
  def self.by_merging(hars)
14
14
  hars = hars.dup
15
15
 
16
- result = hars.shift
16
+ result = hars.shift or raise ArgumentError, "no HARs given"
17
17
  result = from_file(result) unless result.kind_of? self
18
18
 
19
19
  hars.each do |har|
data/lib/har/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HAR
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/har/viewer.rb CHANGED
@@ -14,7 +14,9 @@ module HAR
14
14
  args = validate(args)
15
15
  end
16
16
 
17
- @har = Archive.by_merging(args)
17
+ progress("Merging HARs...") {
18
+ @har = Archive.by_merging(args)
19
+ }
18
20
  end
19
21
 
20
22
  def show
@@ -48,18 +50,6 @@ module HAR
48
50
  }
49
51
  end
50
52
 
51
- def merge(hars)
52
- progress("Merging hars...") {
53
- har = hars.shift or raise Error, "no HARs given"
54
-
55
- unless hars.empty?
56
- hars.each { |h| har.merge! h }
57
- end
58
-
59
- har
60
- }
61
- end
62
-
63
53
  DEFAULT_OPTIONS = {
64
54
  :port => 9292,
65
55
  :validate => false
@@ -135,4 +125,4 @@ module HAR
135
125
  end
136
126
 
137
127
  end # Viewer
138
- end # HAR
128
+ end # HAR
@@ -19,9 +19,13 @@ module HAR
19
19
  end
20
20
 
21
21
  it "creates a single archive by merging the given paths" do
22
- ar = Archive.by_merging good_hars.first(2)
22
+ ar = Archive.by_merging [har_path("browser-blocking-time"), har_path("google.com")]
23
23
  ar.pages.size.should == 3
24
24
  end
25
+
26
+ it "raises ArgumentError if the given array is empty" do
27
+ lambda { Archive.by_merging [] }.should raise_error(ArgumentError)
28
+ end
25
29
  end
26
30
 
27
31
  context "fetching data" do
@@ -132,4 +136,4 @@ module HAR
132
136
  end
133
137
 
134
138
  end # Archive
135
- end # HAR
139
+ end # HAR
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,11 @@
1
+ if ENV['COVERAGE']
2
+ raise "simplecov only works on 1.9" unless RUBY_PLATFORM >= "1.9"
3
+ require 'simplecov'
4
+ SimpleCov.start {
5
+ add_filter "spec/"
6
+ }
7
+ end
8
+
1
9
  $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
10
  require "har"
3
11
 
@@ -31,4 +39,4 @@ end
31
39
 
32
40
  RSpec.configure do |c|
33
41
  c.include HAR::SpecHelper
34
- end
42
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jari Bakken
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-10 00:00:00 +01:00
17
+ date: 2011-01-17 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,19 @@ dependencies:
72
72
  version: "2.0"
73
73
  type: :development
74
74
  version_requirements: *id004
75
+ - !ruby/object:Gem::Dependency
76
+ name: simplecov
77
+ prerelease: false
78
+ requirement: &id005 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ type: :development
87
+ version_requirements: *id005
75
88
  description: Ruby library to work with HTTP archives
76
89
  email:
77
90
  - jari.bakken@gmail.com