Skip to content

Commit 731c45d

Browse files
committed
Watch tracks all files if given array of files. Fix: consolidation#46
1 parent af0d284 commit 731c45d

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
#### 0.4.4
4+
5+
* [Watch] bugfix: Watch only tracks last file if given array of files #46 *2014-08-05*
6+
7+
38
#### 0.4.5
49

510
* All executable tasks can configure working directory with 'dir' option

RoboFile.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function pharPublish()
130130

131131
public function watch()
132132
{
133-
$this->taskWatch()->monitor('composer.json', function() {
133+
$this->taskWatch()->monitor(['composer.json', 'composer.lock'], function() {
134134
$this->taskComposerUpdate()->run();
135135
})->run();
136136
}

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@
2727
"codeception/verify": "*",
2828
"codeception/aspect-mock": "*"
2929
}
30-
3130
}

src/Task/Watch.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ public function run()
6060
$watcher = new ResourceWatcher();
6161

6262
foreach ($this->monitor as $k => $monitor) {
63-
foreach ($monitor[0] as $dir) {
64-
$watcher->track("fs.$k", $dir, FilesystemEvent::MODIFY);
65-
$this->printTaskInfo("watching $dir for changes...");
66-
}
6763
$closure = $monitor[1];
6864
$closure->bindTo($this->bindTo);
69-
$watcher->addListener("fs.$k", $closure);
65+
foreach ($monitor[0] as $i => $dir) {
66+
$watcher->track("fs.$k.$i", $dir, FilesystemEvent::MODIFY);
67+
$this->printTaskInfo("watching <info>$dir</info> for changes...");
68+
$watcher->addListener("fs.$k.$i", $closure);
69+
}
7070
}
7171

7272
$watcher->start();

0 commit comments

Comments
 (0)