class Weinre
Public Class Methods
new(app, options_hash={}, &block)
click to toggle source
Calls superclass method
# File lib/middleman-weinre.rb, line 65 def initialize(app, options_hash={}, &block) super # app.extend WeinreMethods app.ready do if :environment != :build require 'socket' hostname = options_hash[:hostname] || UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last} if !options_hash[:bin].blank? wnr = fork do exec "#{$WEINRE_BIN} --httpPort #{options_hash[:port]} --boundHost #{hostname} &>/dev/null" end Process.detach(wnr) puts "== Weinre is running at http://#{hostname}:#{options_hash[:port]}" # puts "== Weinre remote debugging is at http://#{hostname}:#{options_hash[:port]}/client/#anonymous" else puts "== Winre was not found on your system. Could not auto-start it for you. :(" puts "== Type 'weinre' in a separate terminal to start the server" end app.set :weinre_hostname, hostname app.set :weinre_port, options_hash[:port] app.set :weinre_bin, options_hash[:bin] else # Nothing end end end
Public Instance Methods
weinre_include_tag()
click to toggle source
# File lib/middleman-weinre.rb, line 93 def weinre_include_tag "<script src=\"//#{config[:weinre_hostname]}:#{config[:weinre_port]}/target/target-script-min.js#anonymous\" defer></script>" end