rack-weinre is a rack middleware, which inserts a script tag that loads weinre target script file into your text/html pages.
First, add to your Gemfile:
gem 'rack-weinre'
then bundle
as usual.
in config/environments/development.rb
:
MyApp::Application.configure do
...
config.middleware.use 'Rack::Weinre'
end
use Rack::Weinre
Once enabled (see below), it inserts a script
tag just before the closing head
tag of your html pages. the tag is something like:
<script src="http://localhost:8080/target/target-script-min.js#anonymous"></script>
but the host name depends on to which host the request was made.
you may use a port number other than 8080, say, 9090. :port
option will come in handy then.
use Rack::Weinre, :port => 9090
if you give a :switch
option, it is considered as a file name in a relative path from the working rack application. in that case, rake-weinre is active only when the file exists at the exact path.
use Rack::Weinre, :switch => 'file' # inserts tag if the file exists (relative)
it is always active when no :switch
option is given.
Copyright © 2012 Hiroki Yoshioka. See MIT-LICENSE for further details.