/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$this->destinationPath = $input->getArgument('destination');
$this->version = $input->getArgument('version');
if (file_exists($this->destinationPath)) {
throw new \InvalidArgumentException(sprintf('The directory %s already exists', $this->destinationPath));
}
$this->filesystem = new Filesystem();
$io->writeln(PHP_EOL . ' Downloading Majora Standard Edition...' . PHP_EOL);
$this->download($output);
$io->writeln(PHP_EOL . PHP_EOL . ' Preparing project...' . PHP_EOL);
$io->note('Extracting...');
$this->extract();
$io->note('Installing dependencies (this operation may take a while)...');
$outputCallback = null;
if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERY_VERBOSE) {
$outputCallback = function ($type, $buffer) use($output) {
$output->write($buffer);
};
}
$this->installComposerDependencies($outputCallback);
$io->note('Cleaning...');
$this->clean();
$io->success([sprintf('Majora Standard Edition %s was successfully installed', $this->version)]);
}