Skip to content

Commit

Permalink
Merge pull request #51 from palantirnet/includeresource-parent-direct…
Browse files Browse the repository at this point in the history
…ories

Create parent directories when using <includeresource />
  • Loading branch information
becw authored Feb 9, 2017
2 parents 485747e + e74d2dd commit 0cb93c1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/TheBuild/IncludeResourceTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function main() {
}

// Link or copy the source artifact.
$this->dest->getParentFile()->mkdirs();
if ($this->mode == 'copy') {
$this->log(sprintf("Copying '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
$this->source->copyTo($this->dest);
Expand All @@ -75,6 +76,10 @@ public function main() {
* Verify that the required attributes are set.
*/
public function validate() {
if (!in_array($this->mode, ['symlink', 'copy'])) {
throw new BuildException("mode attribute must be either 'symlink' or 'copy'", $this->location);
}

if (empty($this->source) || empty($this->dest)) {
throw new BuildException("Both the 'source' and 'dest' attributes are required.");
}
Expand All @@ -88,10 +93,6 @@ public function validate() {
* Use 'symlink' to link resources, and 'copy' to copy them.
*/
public function setMode($mode) {
if (!in_array($mode, ['symlink', 'copy'])) {
throw new BuildException("mode attribute must be either 'symlink' or 'copy'", $this->location);
}

$this->mode = $mode;
}

Expand Down

0 comments on commit 0cb93c1

Please sign in to comment.