heroku-nav 0.1.20 → 0.1.21

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.
@@ -0,0 +1 @@
1
+ pkg/
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.20'
24
+ gemspec.version = '0.1.21'
25
25
  end
26
26
  rescue LoadError
27
27
  puts "Jeweler not available. Install it with: gem install jeweler"
@@ -1,43 +1,46 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{heroku-nav}
8
- s.version = "0.1.20"
8
+ s.version = "0.1.21"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Dollar", "Pedro Belo", "Todd Matthews"]
12
- s.date = %q{2011-01-10}
12
+ s.date = %q{2011-01-13}
13
13
  s.description = %q{}
14
14
  s.email = ["david@heroku.com", "pedro@heroku.com", "todd@heroku.com"]
15
15
  s.extra_rdoc_files = [
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
- "README.md",
20
- "Rakefile",
21
- "heroku-nav.gemspec",
22
- "lib/heroku/nav.rb",
23
- "spec/api_spec.rb",
24
- "spec/base.rb",
25
- "spec/nav_spec.rb"
19
+ ".gitignore",
20
+ "README.md",
21
+ "Rakefile",
22
+ "heroku-nav.gemspec",
23
+ "lib/heroku/nav.rb",
24
+ "spec/api_spec.rb",
25
+ "spec/base.rb",
26
+ "spec/nav_spec.rb"
26
27
  ]
27
28
  s.homepage = %q{http://heroku.com}
29
+ s.rdoc_options = ["--charset=UTF-8"]
28
30
  s.require_paths = ["lib"]
29
- s.rubygems_version = %q{1.4.2}
31
+ s.rubygems_version = %q{1.3.6}
30
32
  s.summary = %q{}
31
33
  s.test_files = [
32
34
  "spec/api_spec.rb",
33
- "spec/base.rb",
34
- "spec/nav_spec.rb"
35
+ "spec/base.rb",
36
+ "spec/nav_spec.rb"
35
37
  ]
36
38
 
37
39
  if s.respond_to? :specification_version then
40
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
41
  s.specification_version = 3
39
42
 
40
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
44
  s.add_development_dependency(%q<baconmocha>, [">= 0"])
42
45
  s.add_development_dependency(%q<sinatra>, [">= 0"])
43
46
  s.add_development_dependency(%q<rack-test>, [">= 0"])
@@ -38,7 +38,7 @@ module Heroku
38
38
  raw = RestClient.get(resource_url, :accept => :json).to_s
39
39
  return JSON.parse(raw)
40
40
  end
41
- rescue => e
41
+ rescue Exception => e
42
42
  STDERR.puts "Failed to fetch the Heroku #{resource}: #{e.class.name} - #{e.message}"
43
43
  {}
44
44
  end
@@ -1,68 +1,80 @@
1
1
  require File.dirname(__FILE__) + '/base'
2
2
 
3
3
  describe Heroku::Nav::Header do
4
- before do
5
- Heroku::Nav::Header.stubs(:fetch).returns('html' => '<!-- header -->')
6
- end
7
-
8
4
  def app
9
5
  make_app { use Heroku::Nav::Header }
10
6
  end
11
7
 
12
- it "doesn't apply if content-type is not html" do
13
- get '/text', :body => '<html><body>hi'
14
- last_response.body.should.equal '<html><body>hi'
15
- end
16
-
17
- it "adds the html right after the body" do
8
+ it "rescues exceptions" do
9
+ RestClient.stubs(:get).raises(Timeout::Error)
18
10
  get '/', :body => '<html><body>hi'
19
- last_response.body.should.equal '<html><body><!-- header -->hi'
11
+ last_response.status.should.equal 200
20
12
  end
21
13
 
22
- it "adds the html right after the body, even if it has properties" do
23
- get '/', :body => '<html><body id="a" class="b">hi'
24
- last_response.body.should.equal '<html><body id="a" class="b"><!-- header -->hi'
25
- end
14
+ describe "fetching" do
15
+ before do
16
+ Heroku::Nav::Header.stubs(:fetch).returns('html' => '<!-- header -->')
17
+ end
26
18
 
27
- it "adds the html right after the first div if class is container" do
28
- get '/', :body => '<html><body><div class="container">hi</div>'
29
- last_response.body.should.equal '<html><body><div class="container"><!-- header -->hi</div>'
30
- end
19
+ def app
20
+ make_app { use Heroku::Nav::Header }
21
+ end
31
22
 
32
- it "adds the css right after the head" do
33
- get '/', :body => '<html><head>... <body>'
34
- last_response.body.should.equal "<html><head><link href='http://nav.heroku.com/header.css' media='all' rel='stylesheet' type='text/css' />... <body><!-- header -->"
35
- end
23
+ it "doesn't apply if content-type is not html" do
24
+ get '/text', :body => '<html><body>hi'
25
+ last_response.body.should.equal '<html><body>hi'
26
+ end
36
27
 
37
- it "doesn't add for non 200 responses" do
38
- get '/404', :body => '<html><body>hi'
39
- last_response.body.should.not =~ /<!-- header -->/
40
- end
28
+ it "adds the html right after the body" do
29
+ get '/', :body => '<html><body>hi'
30
+ last_response.body.should.equal '<html><body><!-- header -->hi'
31
+ end
41
32
 
42
- describe "defining response status" do
43
- def app
44
- make_app { use Heroku::Nav::Header, :status => [404] }
33
+ it "adds the html right after the body, even if it has properties" do
34
+ get '/', :body => '<html><body id="a" class="b">hi'
35
+ last_response.body.should.equal '<html><body id="a" class="b"><!-- header -->hi'
45
36
  end
46
37
 
47
- it "respects the :status option" do
48
- get '/404', :body => '<html><body>hi'
49
- last_response.body.should =~ /<!-- header -->/
38
+ it "adds the html right after the first div if class is container" do
39
+ get '/', :body => '<html><body><div class="container">hi</div>'
40
+ last_response.body.should.equal '<html><body><div class="container"><!-- header -->hi</div>'
50
41
  end
51
42
 
52
- it "allows overriding the default status" do
53
- get '/', :body => '<html><body>hi'
43
+ it "adds the css right after the head" do
44
+ get '/', :body => '<html><head>... <body>'
45
+ last_response.body.should.equal "<html><head><link href='http://nav.heroku.com/header.css' media='all' rel='stylesheet' type='text/css' />... <body><!-- header -->"
46
+ end
47
+
48
+ it "doesn't add for non 200 responses" do
49
+ get '/404', :body => '<html><body>hi'
54
50
  last_response.body.should.not =~ /<!-- header -->/
55
51
  end
56
- end
57
52
 
58
- describe "excluding paths" do
59
- def app
60
- make_app { use Heroku::Nav::Header, :except => [/x/, /alt/] }
53
+ describe "defining response status" do
54
+ def app
55
+ make_app { use Heroku::Nav::Header, :status => [404] }
56
+ end
57
+
58
+ it "respects the :status option" do
59
+ get '/404', :body => '<html><body>hi'
60
+ last_response.body.should =~ /<!-- header -->/
61
+ end
62
+
63
+ it "allows overriding the default status" do
64
+ get '/', :body => '<html><body>hi'
65
+ last_response.body.should.not =~ /<!-- header -->/
66
+ end
61
67
  end
62
68
 
63
- it "respects the :except option" do
64
- get '/alternate', :body => '<html><body>hi'
65
- last_response.body.should.not =~ /<!-- header -->/
69
+ describe "excluding paths" do
70
+ def app
71
+ make_app { use Heroku::Nav::Header, :except => [/x/, /alt/] }
72
+ end
73
+
74
+ it "respects the :except option" do
75
+ get '/alternate', :body => '<html><body>hi'
76
+ last_response.body.should.not =~ /<!-- header -->/
77
+ end
66
78
  end
67
79
  end
68
80
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-nav
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 20
10
- version: 0.1.20
8
+ - 21
9
+ version: 0.1.21
11
10
  platform: ruby
12
11
  authors:
13
12
  - David Dollar
@@ -17,18 +16,16 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-01-10 00:00:00 -05:00
19
+ date: 2011-01-13 00:00:00 -08:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: baconmocha
25
24
  prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
26
  requirements:
29
27
  - - ">="
30
28
  - !ruby/object:Gem::Version
31
- hash: 3
32
29
  segments:
33
30
  - 0
34
31
  version: "0"
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: sinatra
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 3
46
41
  segments:
47
42
  - 0
48
43
  version: "0"
@@ -52,11 +47,9 @@ dependencies:
52
47
  name: rack-test
53
48
  prerelease: false
54
49
  requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
51
  - - ">="
58
52
  - !ruby/object:Gem::Version
59
- hash: 3
60
53
  segments:
61
54
  - 0
62
55
  version: "0"
@@ -66,11 +59,9 @@ dependencies:
66
59
  name: rest-client
67
60
  prerelease: false
68
61
  requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
62
  requirements:
71
63
  - - ">="
72
64
  - !ruby/object:Gem::Version
73
- hash: 15
74
65
  segments:
75
66
  - 1
76
67
  - 0
@@ -81,11 +72,9 @@ dependencies:
81
72
  name: json
82
73
  prerelease: false
83
74
  requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
75
  requirements:
86
76
  - - ">="
87
77
  - !ruby/object:Gem::Version
88
- hash: 3
89
78
  segments:
90
79
  - 0
91
80
  version: "0"
@@ -103,6 +92,7 @@ extensions: []
103
92
  extra_rdoc_files:
104
93
  - README.md
105
94
  files:
95
+ - .gitignore
106
96
  - README.md
107
97
  - Rakefile
108
98
  - heroku-nav.gemspec
@@ -115,32 +105,28 @@ homepage: http://heroku.com
115
105
  licenses: []
116
106
 
117
107
  post_install_message:
118
- rdoc_options: []
119
-
108
+ rdoc_options:
109
+ - --charset=UTF-8
120
110
  require_paths:
121
111
  - lib
122
112
  required_ruby_version: !ruby/object:Gem::Requirement
123
- none: false
124
113
  requirements:
125
114
  - - ">="
126
115
  - !ruby/object:Gem::Version
127
- hash: 3
128
116
  segments:
129
117
  - 0
130
118
  version: "0"
131
119
  required_rubygems_version: !ruby/object:Gem::Requirement
132
- none: false
133
120
  requirements:
134
121
  - - ">="
135
122
  - !ruby/object:Gem::Version
136
- hash: 3
137
123
  segments:
138
124
  - 0
139
125
  version: "0"
140
126
  requirements: []
141
127
 
142
128
  rubyforge_project:
143
- rubygems_version: 1.4.2
129
+ rubygems_version: 1.3.6
144
130
  signing_key:
145
131
  specification_version: 3
146
132
  summary: ""