diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c1a8e..54c5dd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,11 @@ Tapestry currently operates a one month release cycle between releases, see the ## [1.0.12] - Unreleased ### Fixed +- #272 Disable self-update command if not executed within a phar - #148 Frontmatter is now parsed in files with an empty body. ### Added -- #157 Added lock file support so Tapestry doesn't run concurrently. +- #157 Added lock file support so Tapestry doesn't run concurrently ## [1.0.11] - 2017-11-23 diff --git a/src/Providers/CommandServiceProvider.php b/src/Providers/CommandServiceProvider.php index d871ca5..6b8b699 100644 --- a/src/Providers/CommandServiceProvider.php +++ b/src/Providers/CommandServiceProvider.php @@ -25,10 +25,13 @@ class CommandServiceProvider extends AbstractServiceProvider * from the ContainerAwareTrait. * * @return void + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface */ public function register() { $container = $this->getContainer(); + $commands = []; $container->add(InitCommand::class) ->withArguments([ @@ -36,26 +39,30 @@ public function register() \Symfony\Component\Finder\Finder::class, ]); + array_push($commands, $container->get(InitCommand::class)); + $this->getContainer()->add(BuildCommand::class) ->withArguments([ Tapestry::class, $this->getContainer()->get('Compile.Steps'), ]); - $container->add(SelfUpdateCommand::class) - ->withArguments([ - \Symfony\Component\Filesystem\Filesystem::class, - \Symfony\Component\Finder\Finder::class, - ]); + array_push($commands, $container->get(BuildCommand::class)); + + if (strlen(\Phar::running() > 0)) { + $container->add(SelfUpdateCommand::class) + ->withArguments([ + \Symfony\Component\Filesystem\Filesystem::class, + \Symfony\Component\Finder\Finder::class, + ]); + + array_push($commands, $container->get(SelfUpdateCommand::class)); + } $container->share(Application::class) ->withArguments([ Tapestry::class, - [ - $container->get(InitCommand::class), - $container->get(BuildCommand::class), - $container->get(SelfUpdateCommand::class), - ], + $commands, ]); } }