Skip to content
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

Merged
merged 1 commit into from Oct 2, 2016

Conversation

s1037989
Copy link
Collaborator

@s1037989 s1037989 commented Oct 2, 2016

No description provided.

my ($self, $args) = @_;
my ($self, $changed, $args) = @_;
do { warn "[prowess] no desired changes\n" if DEBUG; } and return unless $changed;
return if DEBUG > 1;
Copy link
Owner

@jhthorsen jhthorsen Oct 2, 2016

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$|~$)};
Copy link
Owner

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});
Copy link
Owner

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} } @_;
Copy link
Owner

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?

@s1037989
Copy link
Collaborator Author

s1037989 commented Oct 2, 2016

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!

my $exit = 0;

while (1) {
my $pid = $self->run_prove($args->{prove});
my $pid = @changed ? $self->run_prove($args->{prove}) : 0;
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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.

@jhthorsen
Copy link
Owner

LGTM!

@jhthorsen jhthorsen merged commit 67ed6d0 into master Oct 2, 2016
@jhthorsen jhthorsen deleted the ignore_some_files branch October 2, 2016 18:01
jhthorsen pushed a commit that referenced this pull request Oct 2, 2016
 - Ignore dotfiles and backup files in the watch list #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants