Skip to content

Instantly share code, notes, and snippets.

@twada
Created February 16, 2009 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twada/65020 to your computer and use it in GitHub Desktop.
Save twada/65020 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
require 'net/telnet'
module Filetter
class MozRepl
def self.run
begin
telnet = Net::Telnet.new("Port" => 4242) {|c| print c}
telnet.cmd("content.location.reload(true)")
ensure
telnet.close if telnet
end
puts "DONE."
end
end
Observer.add_hook :modified,:created,:deleted do |paths|
MozRepl.run if paths.any?{|path| File.file?(path) && /.*\.js\Z/ =~ path }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment