butternut 0.0.0 → 0.0.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
data/butternut.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{butternut}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremy Stephens"]
12
- s.date = %q{2009-11-04}
12
+ s.date = %q{2009-11-10}
13
13
  s.description = %q{Based on Cucumber's HTML formatter, Butternut uses Celerity to capture page sources after each step.}
14
14
  s.email = %q{viking415@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "spec/butternut/formatter_spec.rb",
34
34
  "spec/butternut/helpers_spec.rb",
35
35
  "spec/butternut_spec.rb",
36
+ "spec/fixtures/css/bar.css",
36
37
  "spec/fixtures/foo.css",
37
38
  "spec/fixtures/foo.html",
38
39
  "spec/fixtures/foo.js",
@@ -416,9 +416,6 @@ module Butternut
416
416
  def transform_page_source(page_source, page_url)
417
417
  page_uri = URI.parse(page_url)
418
418
  page_uri.query = nil
419
- page_uri.path = File.dirname(page_uri.path)
420
- page_url = page_uri.to_s
421
-
422
419
  collected_files = []
423
420
 
424
421
  doc = Nokogiri.HTML(page_source)
@@ -437,9 +434,10 @@ module Butternut
437
434
  local_file = File.join(@source_output_dir, basename)
438
435
  remote_file = case elt_url
439
436
  when %r{^\w+://} then elt_url
437
+ when %r{^/} then
438
+ "#{page_uri.scheme}://#{page_uri.host}:#{page_uri.port}#{elt_url}"
440
439
  else
441
- elt_url.sub!(/^\//, "")
442
- page_url + "/" + elt_url
440
+ page_url.to_s + "/" + elt_url
443
441
  end
444
442
  File.open(local_file, "w") { |f| f.write open(remote_file).read }
445
443
  collected_files << elt_url
@@ -265,7 +265,8 @@ module Butternut
265
265
 
266
266
  it "saves images and stylesheets and rewrites urls in page source" do
267
267
  @page_doc.at('img')['src'].should == "picard.jpg"
268
- @page_doc.at('link[rel="stylesheet"]')['href'].should == "foo.css"
268
+ @page_doc.at('link:first[rel="stylesheet"]')['href'].should == "foo.css"
269
+ @page_doc.at('link:last[rel="stylesheet"]')['href'].should == "bar.css"
269
270
  end
270
271
 
271
272
  it "turns off links" do
@@ -0,0 +1,3 @@
1
+ h1 {
2
+ font-size: 2em;
3
+ }
@@ -2,6 +2,7 @@
2
2
  <head>
3
3
  <title>Foo</title>
4
4
  <link rel="stylesheet" href="foo.css" type="text/css"/>
5
+ <link rel="stylesheet" href="/css/bar.css" type="text/css"/>
5
6
  <script type="text/javascript" src="foo.js"></script>
6
7
  </head>
7
8
  <body>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: butternut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Stephens
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 Z
12
+ date: 2009-11-10 00:00:00 Z
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -78,6 +78,7 @@ files:
78
78
  - spec/butternut/formatter_spec.rb
79
79
  - spec/butternut/helpers_spec.rb
80
80
  - spec/butternut_spec.rb
81
+ - spec/fixtures/css/bar.css
81
82
  - spec/fixtures/foo.css
82
83
  - spec/fixtures/foo.html
83
84
  - spec/fixtures/foo.js