From fc47354bfd5f69b92f79f7f97c915aaa97014223 Mon Sep 17 00:00:00 2001 From: Aaron Francis Date: Sat, 5 Jun 2021 18:55:49 -0500 Subject: [PATCH] Add `*` option to include the entire base directory --- CHANGELOG.md | 4 ++++ src/Package.php | 7 +++++++ tests/PackageTest.php | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b69042..28f1fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/Package.php b/src/Package.php index fcaf137..7ce9f96 100644 --- a/src/Package.php +++ b/src/Package.php @@ -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)); diff --git a/tests/PackageTest.php b/tests/PackageTest.php index 9ce043a..b6a8845 100644 --- a/tests/PackageTest.php +++ b/tests/PackageTest.php @@ -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() {