ãã¡ã¤ã«ã®æ´æ°ãç£è¦ãã¦ãå¤æ´ããããMozReplãªFirefoxããã«reloadæ令ãéãã
ã³ã³ãã³ãã®ãã¡ã¤ã«ãããã£ã¦ã¦ããã¡ãã¡F5ããã®ãããã©ãã®ã§ã
reloadæ令ãåçã§ããããã«
ãã¤ã³ã¹ãã¼ã«ã
ãã¼ã«âMozLabâStart Replã§éå§ã
extensions.mozlab.mozrepl.autoStartãtrueã«ããã°ãåãã£ã±ãªãã«ã§ããã®ããã
4242ã§listenãã¦ãã®ã¯localhostã ããªã®ã§ãä»ã®ãã·ã³ããtelnetãããã¨ãã¯ããã±ãããªãã¼ã¿ã使ãã
ä¾ãã°stoneã使ã£ã¦ã
- 4242å®ã¦ã®ãã±ãããlocalhost:4242ã«ãªãã¼ããã
- ãã ããæ¥ç¶ã許å¯ããã®ã¯10.6.25.201ã¨10.6.25.202ããã®ã¿
ã¨ããã¨ãã¯ãããªæã:
stone -nr localhost:4242 4242 10.6.25.201 10.6.25.202
reloadæå®ã¯ãããªã¹ã¯ãªãã (reload-firefox) ã§:
#!/bin/sh [ $# -eq 1 -o $# -eq 2 ] || { echo 'usage: reload-firefox HOST PORT'; exit 1; } host=$1 port=${2:-4242} echo "reload: $host:$port" cat <<EOF | nc $host $port content.location.reload(true) repl.quit() EOF echo
ããã§ã10.6.25.20[12]ãªãã·ã³ããã
$ reload-firefox 10.6.25.100
ããã¨ã10.6.25.100ã§åãã¦ãFirefoxã«reloadããããã¯ãã
ãã¡ã¤ã«ã®æ´æ°ãç£è¦
ãã¡ã¤ã«(è¤æ°æå®OK)ãæ´æ°ããããæå®ããã³ãã³ããå®è¡ããã¹ã¯ãªããããããã (observe-mtime):
#!/usr/bin/env perl use strict; use warnings; use Pod::Usage; use Getopt::Long; use File::Modified; my $Interval = $ENV{INTERVAL} || 3; # sec my $command; Getopt::Long::Configure("bundling"); GetOptions( 'command|c=s' => \$command, 'help|h|?' => sub { pod2usage() }, ) or pod2usage; my @files = @ARGV; ### @files ### $command my $o = File::Modified->new(files=>[ @files ]); my @changes; while (1) { if (@changes = $o->changed) { ### @changes print qx{ $command }; $o->update; } ### sleep: $Interval sleep $Interval; } __END__ =head1 SYNOPSIS observe-mtime -c command file [file...] =cut
ããã10.6.25.201ã§åããã
$ observe-mtime -c '~/bin/reload-firefox 10.6.25.100' foo.html bar.css baz.js
ãã§ãfoo.htmlããããã°ãæ°ç§ä»¥å ã«Firefoxã«reloadããããã
Windowsã®Firefoxã§ç¢ºèªãã¤ã¤ãLinuxãªãã·ã³ã®Emacs+trampã§ãªã¢ã¼ãã®Webãµã¼ãã®ãã¡ã¤ã«ãããã£ã¦ããã§ã¯ããã便å©ãã
追è¨
- reload-firefoxã§ãã$# ==ããã$# -eqãã«ç´ãã¾ãããPerlã¨shããã£ããããããã¦ãã¨ããééãã¾ãï¼ï¼
- id:ZIGOROu ããã«MozRepl::Plugin::PageReloadã¨ããã®ãæãã¦ããã ãã¾ãããã«ã¬ã¼
ãã¹ããã®ãã ãã¡ãã£ã¨è©¦ãã¦ã¿ããã¨æãã¾ãï¼