heroku-nav 0.1.5 → 0.1.6

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/Rakefile CHANGED
@@ -21,7 +21,7 @@ begin
21
21
  gemspec.add_dependency(%q<rest-client>, [">= 1.0"])
22
22
  gemspec.add_dependency(%q<json>, [">= 0"])
23
23
 
24
- gemspec.version = '0.1.5'
24
+ gemspec.version = '0.1.6'
25
25
  end
26
26
  rescue LoadError
27
27
  puts "Jeweler not available. Install it with: gem install jeweler"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{heroku-nav}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Todd Matthews", "Pedro Belo"]
@@ -29,13 +29,13 @@ module Heroku
29
29
  end
30
30
 
31
31
  def refresh
32
- @html, @css = fetch
32
+ @html = fetch
33
33
  end
34
34
 
35
35
  def fetch
36
36
  raw = RestClient.get(resource_url, :accept => :json)
37
37
  attrs = JSON.parse(raw)
38
- [attrs['html'], attrs['css']]
38
+ attrs['html']
39
39
  rescue => e
40
40
  STDERR.puts "Failed to fetch the Heroku #{resource}: #{e.class.name} - #{e.message}"
41
41
  nil
@@ -56,16 +56,20 @@ module Heroku
56
56
 
57
57
  class Header < Base
58
58
  def insert!
59
- @body.send(@body_accessor).gsub!(/(<head>)/i, "\\1<link href='#{api_url}/header.css' media='all' rel='stylesheet' type='text/css' />") if @css
60
- @body.send(@body_accessor).gsub!(/(<body.*?>\s*(<div .*?class=["'].*?container.*?["'].*?>)?)/i, "\\1#{@html}") if @html
59
+ if @html
60
+ @body.send(@body_accessor).gsub!(/(<head>)/i, "\\1<link href='#{api_url}/header.css' media='all' rel='stylesheet' type='text/css' />")
61
+ @body.send(@body_accessor).gsub!(/(<body.*?>\s*(<div .*?class=["'].*?container.*?["'].*?>)?)/i, "\\1#{@html}")
62
+ end
61
63
  @headers['Content-Length'] = @body.send(@body_accessor).size.to_s
62
64
  end
63
65
  end
64
66
 
65
67
  class Footer < Base
66
68
  def insert!
67
- @body.send(@body_accessor).gsub!(/(<head>)/i, "\\1<link href='#{api_url}/footer.css' media='all' rel='stylesheet' type='text/css' />") if @css
68
- @body.send(@body_accessor).gsub!(/(<\/body>)/i, "#{@html}\\1") if @html
69
+ if @html
70
+ @body.send(@body_accessor).gsub!(/(<head>)/i, "\\1<link href='#{api_url}/footer.css' media='all' rel='stylesheet' type='text/css' />")
71
+ @body.send(@body_accessor).gsub!(/(<\/body>)/i, "#{@html}\\1")
72
+ end
69
73
  @headers['Content-Length'] = @body.send(@body_accessor).size.to_s
70
74
  end
71
75
  end
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/base'
2
2
 
3
3
  describe "Api" do
4
4
  before do
5
- RestClient.stubs(:get).returns({ :html => '<!-- header -->', :css => '#header' }.to_json)
5
+ RestClient.stubs(:get).returns({ :html => '<!-- header -->' }.to_json)
6
6
  @header = Heroku::Nav::Header.new(:app)
7
7
  end
8
8
 
@@ -20,6 +20,6 @@ describe "Api" do
20
20
  end
21
21
 
22
22
  it "parses the JSON response, returning the html and css" do
23
- @header.fetch.should == ['<!-- header -->', '#header']
23
+ @header.fetch.should == '<!-- header -->'
24
24
  end
25
25
  end
@@ -2,13 +2,13 @@ require File.dirname(__FILE__) + '/base'
2
2
 
3
3
  class Heroku::Nav::Header
4
4
  def fetch
5
- ['<!-- header -->', '#header']
5
+ '<!-- header -->'
6
6
  end
7
7
  end
8
8
 
9
9
  class Heroku::Nav::Footer
10
10
  def fetch
11
- ['<!-- footer -->', '#footer']
11
+ '<!-- footer -->'
12
12
  end
13
13
  end
14
14
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Todd Matthews