Skip to content

Commit

Permalink
Add a dev option (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga authored Mar 3, 2022
1 parent 37319d2 commit c5882aa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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";
}

/**
Expand Down Expand Up @@ -828,4 +831,13 @@ public function __call($method, $args)
}
};
}

protected function getVersion()
{
if ($this->input->getOption('dev')) {
return 'dev-master';
}

return '';
}
}

0 comments on commit c5882aa

Please sign in to comment.