Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ignore vim swap and temp files on restarter #359

Merged
merged 1 commit into from

2 participants

@nihen

add ignore

  • .swx
  • .swpx
  • /path/to/4913-5036
@miyagawa miyagawa merged commit 9ac9168 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 30, 2012
  1. @nihen
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 3 deletions.
  1. +7 −1 lib/Plack/Loader/Restarter.pm
  2. +9 −2 t/Plack-Loader/restarter_valid.t
View
8 lib/Plack/Loader/Restarter.pm
@@ -46,7 +46,13 @@ sub _kill_child {
sub valid_file {
my($self, $file) = @_;
- $file->{path} !~ m!\.(?:git|svn)[/\\]|\.(?:bak|swp)$|~$|_flymake\.p[lm]!;
+
+ # vim temporary file is 4913 to 5036
+ # http://www.mail-archive.com/vim_dev@googlegroups.com/msg07518.html
+ if ( $file->{path} =~ m{(\d+)$} && $1 >= 4913 && $1 <= 5036) {
+ return 0;
+ }
+ $file->{path} !~ m!\.(?:git|svn)[/\\]|\.(?:bak|swp|swpx|swx)$|~$|_flymake\.p[lm]$!;
}
sub run {
View
11 t/Plack-Loader/restarter_valid.t
@@ -4,8 +4,15 @@ use Test::More;
my $r = Plack::Loader::Restarter->new;
-my @match = qw(Foo.pm foo.t lib/Bar.pm view/index.tt _myapp/foo.psgi .www/bar.pl _sass.css /Users/joe/foo/bar.pm);
-my @ignore = qw(.git/123 .svn/abc Foo.pm~ _flymake.pl /Users/joe/foo.pl~ /foo/bar/x.txt.bak);
+my @match = qw(
+ Foo.pm foo.t lib/Bar.pm view/index.tt _myapp/foo.psgi .www/bar.pl _sass.css /Users/joe/foo/bar.pm
+ /path/to/4912 /path/to/5037
+);
+my @ignore = qw(
+ .git/123 .svn/abc Foo.pm~ _flymake.pl /Users/joe/foo.pl~ /foo/bar/x.txt.bak
+ /path/to/foo.swp /path/to/foo.swpx /path/to/foo.swx
+ /path/to/4913 /path/to/5036
+);
ok $r->valid_file({ path => $_ }), "$_ is valid" for @match;
ok !$r->valid_file({ path => $_ }), "$_ should be ignored" for @ignore;
Something went wrong with that request. Please try again.