New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignore dotfiles and backup files in the watch list #3
Conversation
my ($self, $args) = @_; | ||
my ($self, $changed, $args) = @_; | ||
do { warn "[prowess] no desired changes\n" if DEBUG; } and return unless $changed; | ||
return if DEBUG > 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think $changed
should be passed into this method... se my comment later.
@@ -40,17 +42,20 @@ sub run { | |||
my $self = shift; | |||
my $args = $self->parse_argv(@_); | |||
my $watcher = Filesys::Notify::Simple->new($args->{watch}); | |||
my $ignore = qr{(?:/\.[^/]+$|\.bak$|\.old$|\.swp$|~$)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
my $exit = 0; | ||
|
||
while (1) { | ||
my $pid = $self->run_prove($args->{prove}); | ||
my $pid = $self->run_prove($changed, $args->{prove}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be this instead:
my $pid = $changed ? $self->run_prove($args->{prove}) : 0;
$watcher->wait( | ||
sub { | ||
return unless my @changed = grep { !-d $_ } map { $_->{path} } @_; | ||
warn "[prowess] changed: @changed\n" if DEBUG; | ||
return unless $changed = my @changed = grep { !-d $_ && $_ !~ $ignore } map { $_->{path} } @_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need both @Changed and $changed?
24c46a8
to
7e543b8
Compare
Good suggestions! I think this meets all your feedback! What do you think about the DEBUG level 2 ability? Too much? Unnecessary? Shoot, proly so... Rather than testing on a big project with lots of tests, test on app-prowess itself! |
7e543b8
to
ed078b3
Compare
my $exit = 0; | ||
|
||
while (1) { | ||
my $pid = $self->run_prove($args->{prove}); | ||
my $pid = @changed ? $self->run_prove($args->{prove}) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was way more simple. Why do sometimes the most simple and obvious solutions elude me??
$watcher->wait( | ||
sub { | ||
return unless my @changed = grep { !-d $_ } map { $_->{path} } @_; | ||
return unless @changed = grep { !-d $_ && $_ !~ $ignore } map { $_->{path} } @_; | ||
warn "[prowess] changed: @changed\n" if DEBUG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was no real value to showing the number of files changed.
LGTM! |
- Ignore dotfiles and backup files in the watch list #3
No description provided.