Ejemplo n.º 1
0
 public static function onPostPackageInstall(CommandEvent $event)
 {
     $projectRoot = realpath(__DIR__ . '/../../../..') . '/';
     $packageRoot = __DIR__ . '/';
     $appRoot = $projectRoot . 'app/Admin/';
     $io = $event->getIO();
     if ($io->askConfirmation('Would you like to install admin panel? (Y/n) ', true)) {
         if (!is_dir($projectRoot . 'app')) {
             die('Solve project is not found in ' . $projectRoot . ', exiting...');
         }
         $name = $io->ask('Enter the app name (admin): ', 'admin');
         $kernel = Kernel::getMainInstance();
         $appRoot = $projectRoot . 'app/' . ucfirst($name) . '/';
         $kernel->getEnvironment()->setProjectRoot($projectRoot);
         $config = DC::getProjectConfig();
         while ($name && $config->get('applications/' . $name)) {
             $name = $io->ask('Application exists, specify other name(or type exit): ');
         }
         $config->set('applications/' . $name, $name);
         $config->save();
     }
     if ($io->askConfirmation('Would you like to update assets? (Y/n) ', true)) {
         FSService::makeWritable($appRoot);
         FSService::makeWritable($projectRoot . 'web/admin/');
         FSService::copyRecursive($packageRoot . 'app/', $appRoot);
         FSService::copyRecursive($packageRoot . 'assets/', $projectRoot . 'web/admin/');
         exec('cd ' . $projectRoot . 'web/admin/ && npm install');
     }
 }
Ejemplo n.º 2
0
 public function testBasic()
 {
     $this->buildTestStructure();
     $kernel = Kernel::getMainInstance();
     $env = $kernel->getEnvironment();
     $this->assertEquals(realpath(__DIR__ . '/../../../') . '/', $env->getProjectRoot(), 'root detected correctly');
     $kernel->getEnvironment()->setProjectRoot(realpath(__DIR__ . '/project/') . '/', true);
     $this->assertEquals('Test project', DC::getProjectConfig('name'));
     $_SERVER['REQUEST_URI'] = '/';
     $_SERVER['QUERY_STRING'] = '';
     $_SERVER['HTTP_HOST'] = 'test.com';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['DOCUMENT_ROOT'] = $env->getWebRoot();
     $_SERVER['HTTP_ACCEPT'] = 'text/html';
     $kernel->run();
 }
Ejemplo n.º 3
0
Archivo: DC.php Proyecto: solve/solve
 public static function getEnvironment()
 {
     return Kernel::getMainInstance()->getEnvironment();
 }
Ejemplo n.º 4
0
<?php

$vendorPath = __DIR__ . '/../vendor/';
if (!is_file($vendorPath . 'autoload.php')) {
    $invalidMessage = "You have corrupted installation of Solve Framework.\n" . "Please, follow the instructions from http://solve-project.org/install/\n" . "or run \"php -f http://solve-project.org/install-script/\" to setup new instance!";
    if (!empty($_SERVER['DOCUMENT_ROOT'])) {
        $invalidMessage = nl2br($invalidMessage);
    }
    die($invalidMessage);
}
require_once $vendorPath . 'autoload.php';
use Solve\Kernel\Kernel;
Kernel::getMainInstance()->run();