Skip to content

Commit

Permalink
Add * option to include the entire base directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondfrancis committed Jun 5, 2021
1 parent 855f9f7 commit fc47354
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.4 - 2021-06-05

- Added `*` option to include the entire base directory in the package.

## 0.1.3 - 2021-05-24

- Fix more `sidecar:configure` AWS errors.
Expand Down
7 changes: 7 additions & 0 deletions src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ public function getBasePath()
protected function pathsForMerging($paths)
{
return array_map(function ($path) {
// `*` means everything in the base directory, whatever
// that may be. By resetting it to an empty string and
// prepending the base path, everything is included.
if ($path === '*') {
$path = '';
}

// Make every path relative to the base directory.
return $this->prependBasePath($path);
}, Arr::wrap($paths));
Expand Down
11 changes: 11 additions & 0 deletions tests/PackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ public function it_sets_the_base_path_correctly()
}
}

/** @test */
public function start_includes_everything_in_base_path()
{
$package = $this->makePackageClass();

$package->setBasePath(__DIR__ . '/Support/Files');
$package->include('*');

$this->assertCount(3, $package->files());
}

/** @test */
public function base_path_order()
{
Expand Down

0 comments on commit fc47354

Please sign in to comment.