diff --git a/Gemfile b/Gemfile index 54061d5b..204f8345 100644 --- a/Gemfile +++ b/Gemfile @@ -47,8 +47,6 @@ group :test, :development do gem 'ruby-debug19', :platforms => :mri_19 gem 'bushido_stub', :git => 'git://github.com/did/bushido_stub.git' - # :path => '../gems/bushido_stub' - # gem 'bushido' end group :production do diff --git a/app/views/admin/layouts/application.html.haml b/app/views/admin/layouts/application.html.haml index 028e7d6d..fba4976a 100644 --- a/app/views/admin/layouts/application.html.haml +++ b/app/views/admin/layouts/application.html.haml @@ -13,7 +13,7 @@ #submenu %ul = yield :submenu - + - if content_for? :actions .action = yield :actions diff --git a/lib/locomotive/hosting/bushido.rb b/lib/locomotive/hosting/bushido.rb index fa11d805..b34d51e9 100644 --- a/lib/locomotive/hosting/bushido.rb +++ b/lib/locomotive/hosting/bushido.rb @@ -71,7 +71,7 @@ module Locomotive def add_middleware ::Locomotive::Application.configure do |config| - config.middleware.use '::Locomotive::Hosting::Bushido::Middleware' + config.middleware.use ::Locomotive::Hosting::Bushido::Middleware end end diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index 10df1bf7..b8e8437f 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -5,43 +5,33 @@ module Locomotive module Bushido class Middleware - # BUSHIDO_JS_URL = 'http://localhost:4567/javascripts/bushido.js' - BUSHIDO_JS_URL = 'http://bushi.do/api/bushido.js' - include Rack::Utils def initialize(app, opts = {}) @app = app - @bushido_app_name = ENV['BUSHIDO_APP'] - @bushido_metrics_token = ENV['BUSHIDO_METRICS_TOKEN'] - @bushido_claimed = ::Locomotive.bushido_app_claimed? + @path_regexp = %r{^/admin/} end def call(env) - status, headers, response = @app.call(env) + if env['PATH_INFO'] =~ @path_regexp + status, headers, response = @app.call(env) - content = "" - response.each { |part| content += part } + content = "" + response.each { |part| content += part } - # "claiming" bar + stats ? - content.gsub!(/<\/body>/i, <<-STR - - - STR - ) + # "claiming" bar + stats ? + content.gsub!(/<\/body>/i, <<-STR + + + STR + ) - headers['content-length'] = bytesize(content).to_s + headers['content-length'] = bytesize(content).to_s - [status, headers, [content]] + [status, headers, [content]] + else + @app.call(env) + end end end