Permalink
Browse files

don't use rhonav in dev mode

  • Loading branch information...
1 parent a24869c commit 99de689234f0a82c4ef2c57fa39bd07a6e80c610 @larsburgess larsburgess committed Jan 4, 2011
Showing with 7 additions and 66 deletions.
  1. +0 −1 Gemfile
  2. +0 −4 Gemfile.lock
  3. +1 −5 README.md
  4. +0 −1 config.yml
  5. +6 −3 docs.rb
  6. +0 −52 lib/heroku_header.rb
View
@@ -8,7 +8,6 @@ gem 'rest-client', '1.2.0'
gem 'haml', '2.2.17'
gem 'json'
gem 'thin'
-gem 'heroku-nav', '~>0'
gem "rhomobile-nav", '0.0.30', :require => "rhomobile/nav", :git => "git://github.com/rhomobile/rhomobile-nav.git"
#gem 'newrelic_rpm'
gem 'coderay'
View
@@ -30,9 +30,6 @@ GEM
daemons (1.1.0)
eventmachine (0.12.10)
haml (2.2.17)
- heroku-nav (0.1.17)
- json
- rest-client (>= 1.0)
json (1.4.6)
mime-types (1.16)
nokogiri (1.4.3.1)
@@ -61,7 +58,6 @@ DEPENDENCIES
coderay
faraday!
haml (= 2.2.17)
- heroku-nav (~> 0)
indextank!
json
rack (= 1.2.1)
View
@@ -9,11 +9,7 @@ This tool is based off the excellent [heroku-docs project!](https://github.com/h
Setup
-----
- # start rhonav or edit config.yml to use http://rhonav.heroku.com
- $ cd rhonav
- $ rackup -p8080
-
- # shotgun the docs server
+ # install prereqs and shotgun the docs server
$ cd rhomobile-docs
$ bundle install
$ rake start #=> this will start the server and load the docs home page in your browser
View
@@ -6,7 +6,6 @@ development:
rhogallery: '../rhogallery/doc/'
guides: 'docs/'
index: 'rhodocs_edge'
- rhonav_host: http://localhost:8080
edge:
dirs:
rhosync: '../rhosync/doc/'
View
@@ -4,11 +4,14 @@
require 'sass'
require 'indextank'
require 'topic'
-require 'rhomobile/nav'
-use Rhomobile::Nav::Base, {
+
+unless development?
+ require 'rhomobile/nav'
+ use Rhomobile::Nav::Base, {
:nav_host => "#{AppConfig['rhonav_host']}/#{ENV["RACK_ENV"]}",
:blog => true, :subscribe => false, :support => false
-}
+ }
+end
require 'coderay'
require './lib/term.rb'
View
@@ -1,52 +0,0 @@
-require 'rest_client'
-require 'json'
-
-module Heroku
- class Header
- def initialize(app, options={})
- @app = app
- @active = options[:active]
- @theme = options[:theme]
- update
- end
-
- def call(env)
- status, headers, body = @app.call(env)
- if headers['Content-Type'] == 'text/html' && body.respond_to?(:[]) && body[0] =~ /<body.*?>/
- body[0].gsub!(/(<head>)/, "\\1<style type='text/css'>#{@css}</style>")
- body[0].gsub!(/(<body.*?>\s*(<div .*?class='.*?container.*?'.*?>)?)/, "\\1#{@html}")
- body[0].gsub!(/(<\/body>)/, "#{@analytics}\\1") if insert_analytics?
- headers['Content-Length'] = body[0].size.to_s
- end
- [status, headers, body]
- end
-
- def insert_analytics?
- ENV['HEADER_ANALYTICS'] && @analytics
- end
-
- def update
- @html, @css, @analytics = fetch_latest
- end
-
- def header_url
- ENV['HEADER_URL'] || "http://header.heroku.com"
- end
-
- def heroku_domain
- ENV['HEROKU_HOST'] || 'heroku.com'
- end
-
- def fetch_latest
- url = header_url.dup
- url << "/#{@theme}" if @theme
- url << "?active=#{@active}" if @active
- raw = RestClient.get(url, :accept => :json)
- attrs = JSON.parse(raw)
- [attrs['html'], attrs['css'], attrs['analytics']]
- rescue => e
- STDERR.puts "Failed to fetch the Heroku header: #{e.class.name} - #{e.message}"
- nil
- end
- end
-end

0 comments on commit 99de689

Please sign in to comment.