Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactor —dev to use processArguments() method.
  • Loading branch information
jesseleite committed Mar 4, 2022
commit 0cc58069d27b94d17cc25b6b15bf324df8e29b98
18 changes: 6 additions & 12 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class NewCommand extends Command
public $relativePath;
public $absolutePath;
public $name;
public $version;
public $starterKit;
public $starterKitVcs;
public $starterKitLicense;
Expand Down Expand Up @@ -160,6 +161,10 @@ protected function processArguments()

$this->name = pathinfo($this->absolutePath)['basename'];

$this->version = $this->input->getOption('dev')
? 'dev-master'
: '';

$this->starterKit = $this->input->getArgument('starter-kit');
$this->starterKitLicense = $this->input->getOption('license');
$this->local = $this->input->getOption('local');
Expand Down Expand Up @@ -721,11 +726,9 @@ protected function createProjectCommand()

$baseRepo = self::BASE_REPO;

$version = $this->getVersion();

$directory = $this->pathIsCwd() ? '.' : $this->relativePath;

return $composer." create-project {$baseRepo} \"{$directory}\" {$version} --remove-vcs --prefer-dist";
return $composer." create-project {$baseRepo} \"{$directory}\" {$this->version} --remove-vcs --prefer-dist";
}

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

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

return '';
}
}