From c5882aa6f076842915ce8f221a9aacf18d8fff96 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Thu, 3 Mar 2022 15:40:08 -0500 Subject: [PATCH] Add a dev option (#47) --- src/NewCommand.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index 8badba4..db4b0b5 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -51,6 +51,7 @@ protected function configure() ->setName('new') ->setDescription('Create a new Statamic application') ->addArgument('name', InputArgument::REQUIRED, 'Statamic application directory name') + ->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release') ->addArgument('starter-kit', InputArgument::OPTIONAL, 'Optionally install specific starter kit') ->addOption('license', null, InputOption::VALUE_OPTIONAL, 'Optionally provide explicit starter kit license') ->addOption('local', null, InputOption::VALUE_NONE, 'Optionally install from local repo configured in composer config.json') @@ -709,9 +710,11 @@ protected function createProjectCommand() $baseRepo = self::BASE_REPO; + $version = $this->getVersion(); + $directory = $this->pathIsCwd() ? '.' : $this->relativePath; - return $composer." create-project {$baseRepo} \"{$directory}\" --remove-vcs --prefer-dist"; + return $composer." create-project {$baseRepo} \"{$directory}\" {$version} --remove-vcs --prefer-dist"; } /** @@ -828,4 +831,13 @@ public function __call($method, $args) } }; } + + protected function getVersion() + { + if ($this->input->getOption('dev')) { + return 'dev-master'; + } + + return ''; + } }