From f830396dbfd8cb5447ec25bd2e2ecdd95f2cc27e Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 16 Mar 2016 07:21:00 -0400 Subject: [PATCH 1/2] [middleware-ordering] Switch from hashrockets -> new hash style --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c351e40..dcf30d0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Use this with [guard-livereload](http://github.com/guard/guard-livereload) for m Add the gem to your Gemfile. ```ruby -gem "rack-livereload", :group => :development +gem "rack-livereload", group: :development ``` Then add the middleware to your Rails middleware stack by editing your `config/environments/development.rb`. @@ -37,11 +37,11 @@ end ```ruby # Specifying Rack::LiveReload options. config.middleware.use(Rack::LiveReload, - :min_delay => 500, # default 1000 - :max_delay => 10_000, # default 60_000 - :live_reload_port => 56789, # default 35729 - :host => 'myhost.cool.wow', - :ignore => [ %r{dont/modify\.html$} ] + min_delay : 500, # default 1000 + max_delay : 10_000, # default 60_000 + live_reload_port : 56789, # default 35729 + host : 'myhost.cool.wow', + ignore : [ %r{dont/modify\.html$} ] ) ``` @@ -54,7 +54,7 @@ require 'rack-livereload' use Rack::LiveReload # ...or... -use Rack::LiveReload, :min_delay => 500, ... +use Rack::LiveReload, min_delay: 500, ... ``` ## How it works @@ -82,13 +82,13 @@ your browser doesn't need it. The SWF WebSocket implementor won't be loaded unle WebSockets support or if you force it in the middleware stack: ``` ruby -use Rack::LiveReload, :force_swf => true +use Rack::LiveReload, force_swf: true ``` If you don't want any of the web-sockets-js code included at all, use the `no_swf` option: ``` ruby -use Rack::LiveReload, :no_swf => true +use Rack::LiveReload, no_swf: true ``` Once more browsers support WebSockets than don't, this option will be reversed and you'll have From 16c1ba76ed5b75a8b3716622122d5eda141246fe Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 16 Mar 2016 07:21:22 -0400 Subject: [PATCH 2/2] [middleware-ordering] Improve middlware docs, fixes #51 --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dcf30d0..1457291 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,12 @@ Then add the middleware to your Rails middleware stack by editing your `config/e # config/environments/development.rb MyApp::Application.configure do - # Add Rack::LiveReload to the bottom of the middleware stack with the default options. + # Add Rack::LiveReload to the bottom of the middleware stack with the default options: config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload - + + # or, if you're using better_errors: + config.middleware.insert_before Rack::Lock, Rack::LiveReload + # ... end ``` @@ -45,7 +48,11 @@ config.middleware.use(Rack::LiveReload, ) ``` -In addition, Rack::LiveReload's position within middleware stack can be specified by inserting it relative to an exsiting middleware via `insert_before` or `insert_after`. See the [Rails on Rack: Adding a Middleware](http://guides.rubyonrails.org/rails_on_rack.html#adding-a-middleware) section for more detail. +In addition, Rack::LiveReload's position within middleware stack can be +specified by inserting it relative to an exsiting middleware via +`insert_before` or `insert_after`. See the [Rails on Rack: Adding a +Middleware](http://guides.rubyonrails.org/rails_on_rack.html#adding-a-middleware) +section for more detail. ### Sinatra / config.ru