Ejemplo n.º 1
0
 public function executeCoreInitProject($arguments, $options)
 {
     $targetDir = realpath($_SERVER['PWD']);
     $scriptDir = sgContext::getLibDir();
     if (file_exists($targetDir . '/superglue')) {
         sgCLI::error('A project already exists in this directory.');
         return false;
     }
     if (sgCLI::confirm("Are you sure you want to initialize a superglue project in\n{$targetDir}")) {
         sgCLI::println('Initializing project...', sgCLI::STYLE_HEADER);
         sgToolkit::mkdir($targetDir . '/config', 0755);
         sgToolkit::mkdir($targetDir . '/cache', 0777);
         sgToolkit::mkdir($targetDir . '/cache', 0777);
         sgToolkit::mkdir($targetDir . '/models', 0755);
         sgToolkit::mkdir($targetDir . '/controllers', 0755);
         sgToolkit::mkdir($targetDir . '/views', 0755);
         sgToolkit::mkdir($targetDir . '/plugins', 0755);
         sgToolkit::mkdir($targetDir . '/web', 0755);
         sgToolkit::copy($scriptDir . '/skeleton/web/htaccess-dist', $targetDir . '/web/.htaccess');
         sgToolkit::copy($scriptDir . '/skeleton/web/index.php-dist', $targetDir . '/web/index.php');
         sgToolkit::copy($scriptDir . '/skeleton/config/ProjectConfiguration.class.php-dist', $targetDir . '/config/ProjectConfiguration.class.php');
         sgToolkit::copy($scriptDir . '/skeleton/config/config.php-dist', $targetDir . '/config/config.php');
         sgToolkit::copy($scriptDir . '/skeleton/config/routing.php-dist', $targetDir . '/config/routing.php');
         sgToolkit::copy($scriptDir . '/skeleton/views/index.html', $targetDir . '/views/index.html');
         if (sgToolkit::checkFileLocation($scriptDir, $targetDir)) {
             sgToolkit::symlink($this->relPath($scriptDir, $targetDir) . '/superglue', $targetDir . '/superglue');
         } else {
             sgToolkit::mkdir($targetDir . '/lib', 0755);
             sgToolkit::symlink($scriptDir, $targetDir . '/lib/superglue');
             sgToolkit::symlink($scriptDir, $targetDir . '/superglue');
         }
         sgToolkit::chmod($targetDir . '/superglue', 0755);
         sgCLI::println('Done.', sgCLI::STYLE_INFO);
     }
 }
Ejemplo n.º 2
0
 private static function _initAutoloader()
 {
     if (!sgAutoloader::checkCache()) {
         $paths = array(sgContext::getLibDir());
         foreach (self::$enabledPlugins as $plugin) {
             $paths[] = sgContext::getRootDir() . '/plugins/' . $plugin->name . '/';
         }
         $paths[] = sgContext::getRootDir() . '/config/';
         $paths[] = sgContext::getRootDir() . '/lib/';
         $paths[] = sgContext::getRootDir() . '/controllers/';
         $paths[] = sgContext::getRootDir() . '/models/';
         sgAutoloader::setExclusions(self::get('settings.autoload_exclusions', array()));
         sgAutoloader::loadPaths($paths);
     }
     Twig_Autoloader::register();
 }