Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: laravel/installer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: pyrocms/installer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 7 commits
  • 7 files changed
  • 1 contributor

Commits on Jan 29, 2017

  1. Pyro-ize

    RyanThompson committed Jan 29, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6d74815 View commit details
  2. Pyro

    RyanThompson committed Jan 29, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    39e850f View commit details
  3. Der

    RyanThompson committed Jan 29, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    17e68c2 View commit details
  4. Pyro

    RyanThompson committed Jan 29, 2017
    Copy the full SHA
    e6fe8c0 View commit details
  5. Change namespace maybe.

    RyanThompson committed Jan 29, 2017
    Copy the full SHA
    018f6ed View commit details
  6. Aha

    RyanThompson committed Jan 29, 2017
    Copy the full SHA
    0593458 View commit details

Commits on Apr 2, 2019

  1. Create README.md

    RyanThompson authored Apr 2, 2019
    Copy the full SHA
    767654a View commit details
Showing with 66 additions and 155 deletions.
  1. +1 −0 .gitignore
  2. +5 −0 README.md
  3. +11 −6 composer.json
  4. +0 −13 laravel
  5. +13 −0 pyro
  6. +36 −126 src/NewCommand.php
  7. +0 −10 zipper.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
.idea
.DS_Store
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Installer

### DEPRECATED

Use `composer create-project pyrocms/pyrocms` instead.
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
{
"name": "laravel/installer",
"description": "Laravel application installer.",
"keywords": ["laravel"],
"name": "pyrocms/installer",
"description": "PyroCMS application installer.",
"keywords": [
"pyrocms"
],
"license": "MIT",
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
},
{
"name": "Ryan Thompson",
"email": "ryan@pyrocms.com"
}
],
"autoload": {
"psr-4": {
"Laravel\\Installer\\Console\\": "src/"
"Pyro\\Installer\\Console\\": "src/"
}
},
"require": {
"ext-zip": "*",
"guzzlehttp/guzzle": "~4.0|~5.0|~6.0",
"symfony/console": "~2.3|~3.0",
"symfony/process": "~2.3|~3.0"
},
"bin": [
"laravel"
"pyro"
]
}
13 changes: 0 additions & 13 deletions laravel

This file was deleted.

13 changes: 13 additions & 0 deletions pyro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env php
<?php

if (file_exists(__DIR__ . '/../../autoload.php')) {
require __DIR__ . '/../../autoload.php';
} else {
require __DIR__ . '/vendor/autoload.php';
}

$app = new Symfony\Component\Console\Application('PyroCMS Installer', '1.3.9');
$app->add(new Pyro\Installer\Console\NewCommand);

$app->run();
162 changes: 36 additions & 126 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?php

namespace Laravel\Installer\Console;
namespace Pyro\Installer\Console;

use ZipArchive;
use RuntimeException;
use GuzzleHttp\Client;
use Symfony\Component\Process\Process;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;

class NewCommand extends Command
{

/**
* Configure the command options.
*
@@ -23,50 +22,51 @@ protected function configure()
{
$this
->setName('new')
->setDescription('Create a new Laravel application.')
->setDescription('Create a new Pyro application.')
->addArgument('name', InputArgument::OPTIONAL)
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release')
->addOption('5.2', null, InputOption::VALUE_NONE, 'Installs the "5.2" release');
->addOption('tag', null, InputOption::VALUE_OPTIONAL, 'Installs a specific version tag of Pyro.')
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs Pyro with source preferred.');
}

/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (! class_exists('ZipArchive')) {
throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
}

$this->verifyApplicationDoesntExist(
$directory = ($input->getArgument('name')) ? getcwd().'/'.$input->getArgument('name') : getcwd()
$directory = ($input->getArgument('name')) ? getcwd() . '/' . $input->getArgument('name') : getcwd()
);

$output->writeln('<info>Crafting application...</info>');
$options = '';

$version = $this->getVersion($input);
if ($input->getOption('dev')) {
$options .= ' --prefer-source';
}

if ($tag = $input->getOption('tag')) {
$tag = '=' . $tag;
}

$this->download($zipFile = $this->makeFilename(), $version)
->extract($zipFile, $directory)
->cleanUp($zipFile);
$output->writeln('<info>Installing Pyro...</info>');

$composer = $this->findComposer();

$commands = [
$composer.' install --no-scripts',
$composer.' run-script post-root-package-install',
$composer.' run-script post-install-cmd',
$composer.' run-script post-create-project-cmd',
$composer . ' create-project pyrocms/pyrocms' . $tag . ' ' . $directory . $options,
$composer . ' install',
];

if ($input->getOption('no-ansi')) {
$commands = array_map(function ($value) {
return $value.' --no-ansi';
}, $commands);
$commands = array_map(
function ($value) {
return $value . ' --no-ansi';
},
$commands
);
}

$process = new Process(implode(' && ', $commands), $directory, null, null, null);
@@ -75,17 +75,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
$process->setTty(true);
}

$process->run(function ($type, $line) use ($output) {
$output->write($line);
});
$process->run(
function ($type, $line) use ($output) {
$output->write($line);
}
);

$output->writeln('<comment>Application ready! Build something amazing.</comment>');
$output->writeln('<comment>Pyro is ready!</comment>');
}

/**
* Verify that the application does not already exist.
*
* @param string $directory
* @param string $directory
* @return void
*/
protected function verifyApplicationDoesntExist($directory)
@@ -95,107 +97,15 @@ protected function verifyApplicationDoesntExist($directory)
}
}

/**
* Generate a random temporary filename.
*
* @return string
*/
protected function makeFilename()
{
return getcwd().'/laravel_'.md5(time().uniqid()).'.zip';
}

/**
* Download the temporary Zip to the given file.
*
* @param string $zipFile
* @param string $version
* @return $this
*/
protected function download($zipFile, $version = 'master')
{
switch ($version) {
case 'develop':
$filename = 'latest-develop.zip';
break;
case 'master':
$filename = 'latest.zip';
break;
case '5.2':
$filename = 'latest-52.zip';
break;
}

$response = (new Client)->get('http://cabinet.laravel.com/'.$filename);

file_put_contents($zipFile, $response->getBody());

return $this;
}

/**
* Extract the Zip file into the given directory.
*
* @param string $zipFile
* @param string $directory
* @return $this
*/
protected function extract($zipFile, $directory)
{
$archive = new ZipArchive;

$archive->open($zipFile);

$archive->extractTo($directory);

$archive->close();

return $this;
}

/**
* Clean-up the Zip file.
*
* @param string $zipFile
* @return $this
*/
protected function cleanUp($zipFile)
{
@chmod($zipFile, 0777);

@unlink($zipFile);

return $this;
}

/**
* Get the version that should be downloaded.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @return string
*/
protected function getVersion(InputInterface $input)
{
if ($input->getOption('dev')) {
return 'develop';
}

if ($input->getOption('5.2')) {
return '5.2';
}

return 'master';
}

/**
* Get the composer command for the environment.
*
* @return string
*/
protected function findComposer()
{
if (file_exists(getcwd().'/composer.phar')) {
return '"'.PHP_BINARY.'" composer.phar';
if (file_exists(getcwd() . '/composer.phar')) {
return '"' . PHP_BINARY . '" composer.phar';
}

return 'composer';
10 changes: 0 additions & 10 deletions zipper.sh

This file was deleted.