/**
     * @param Input $input
     */
    public function __invoke(Input $input)
    {
        $this->climate->br();
        $name = $input->getArgument('name');
        if (FALSE === strstr($name, '/')) {
            $name = 'middleout/arhitect-' . $name;
        }
        $ownerName = explode('/', $name);
        $packageName = $ownerName[1];
        $ownerName = $ownerName[0];
        $this->climate->yellow('Installing Arhitect Package ' . $ownerName . '/' . $packageName);
        $version = '';
        $inputVersion = $input->getArgument('version');
        if ($inputVersion) {
            $version = ':' . $inputVersion;
        }
        $preferDev = ' require ';
        $inputVersion = $input->getOption('dev');
        if ($inputVersion) {
            $preferDev = ' require --dev ';
        }
        $this->climate->darkGray("composer" . $preferDev . $name . $version . ' --prefer-dist');
        $result = shell_exec("composer" . $preferDev . $name . $version . ' --prefer-dist');
        $this->climate->yellow($result);
        $configOwnerName = $ownerName;
        $configPackageName = $packageName;
        if ($configOwnerName == 'middleout') {
            $configOwnerName = 'arhitect';
            $configPackageName = str_replace('arhitect-', '', $configPackageName);
        }
        $path = getcwd() . '/vendor/' . $ownerName . '/' . $packageName . '/app/config';
        $path = str_replace('config/middleout/arhitect-', 'config/arhitect/', $path);
        if (is_dir($path)) {
            $this->copy($path, $this->configuration->getApplicationPath() . '/config/' . $configOwnerName);
        }
        $readme = getcwd() . '/vendor/' . $ownerName . '/' . $packageName . '/post-install.md';
        if (is_file($readme)) {
            $postInstallMessage = file_get_contents($readme);
        }
        $this->climate->br(2);
        if (!$postInstallMessage) {
            $this->climate->green(<<<ART
               ______________________________________
      ________|                                      |_______
      \\       |            MODULE INSTALLED          |      /
       \\      |    Let the coding session begin !    |     /
       /      |______________________________________|     \\
      /__________)                                (_________\\

ART
);
        } else {
            $this->climate->green('Module installed. The developer would like to tell you the following:');
            $this->climate->br(2);
            $this->climate->yellow($postInstallMessage);
        }
        $this->climate->br(2);
    }
Exemplo n.º 2
0
 /**
  * @param Input $input
  */
 public function __invoke(Input $input)
 {
     $file = NULL;
     $testSuite = $input->getArgument('testSuite');
     if (FALSE !== strstr($testSuite, '.php')) {
         $file = $testSuite;
         $testSuite = NULL;
     }
     $debug = (bool) $input->getArgument('debug');
     passthru("phpunit -c app/config/arhitect/phpunit.xml " . ($testSuite ? '--testsuite ' . $testSuite : '') . ($file ? $file : '') . ($debug ? ' --debug' : ''));
     $this->climate->green('Tests have run!');
 }
Exemplo n.º 3
0
    /**
     * @param Input $input
     */
    public function __invoke(Input $input)
    {
        $this->climate->br();
        $name = $input->getArgument('name');
        if (FALSE === strstr($name, '/')) {
            $name = 'middleout/arhitect-' . $name;
        }
        $ownerName = explode('/', $name);
        $packageName = $ownerName[1];
        $ownerName = $ownerName[0];
        $this->climate->yellow('Updating Arhitect Package ' . $ownerName . '/' . $packageName);
        $version = '';
        $inputVersion = $input->getArgument('version');
        if ($inputVersion) {
            $version = ':' . $inputVersion;
        }
        $preferDev = ' require ';
        $inputVersion = $input->getOption('dev');
        if ($inputVersion) {
            $preferDev = ' require --dev ';
        }
        $this->climate->darkGray("composer" . $preferDev . $name . $version . ' --prefer-dist');
        $result = shell_exec("composer" . $preferDev . $name . $version . ' --prefer-dist');
        $this->climate->yellow($result);
        $configOwnerName = $ownerName;
        $configPackageName = $packageName;
        if ($configOwnerName == 'middleout') {
            $configOwnerName = 'arhitect';
            $configPackageName = str_replace('arhitect-', '', $configPackageName);
        }
        $path = getcwd() . '/vendor/' . $ownerName . '/' . $packageName . '/app/config/' . $configOwnerName . '/' . $configPackageName;
        $path = str_replace('config/middleout/arhitect-', 'config/arhitect/', $path);
        if (is_dir($path)) {
            $this->copy($path, $this->configuration->getApplicationPath() . '/config/' . $configOwnerName . '/' . $configPackageName);
        }
        $this->climate->br(2);
        $this->climate->green(<<<ART
           ______________________________________
  ________|                                      |_______
  \\       |            MODULE UPDATED            |      /
   \\      |  Let the coding session continue :)  |     /
   /      |______________________________________|     \\
  /__________)                                (_________\\

ART
);
        $this->climate->br(2);
    }
 public function it_throws_exception_on_invalid_url(Input $input, Output $output)
 {
     $input->bind(Argument::any())->willReturn();
     $input->isInteractive()->willReturn(false);
     $input->validate()->willReturn();
     $input->getArgument("url")->willReturn("i_am_an_invalid_url");
     $this->shouldThrow(\Exception::class)->during("run", [$input, $output]);
 }