示例#1
0
 /**
  * Installer step: Configure application manifest, create directories, and
  * copy files.
  * @param array $data POST data.
  * @return \Jivoo\Routing\Response|string Response.
  */
 public function configure($data = null)
 {
     if (isset($data)) {
         $this->configForm->addData($data['Configure']);
         $manifest = array('name' => $this->configForm->name, 'version' => $this->configForm->version, 'modules' => array_merge(array('Assets', 'Helpers', 'Models', 'Routing', 'View'), array_values($this->configForm->modules)), 'install' => 'Jivoo\\Setup\\DefaultInstaller', 'update' => 'Jivoo\\Setup\\DefaultUpdater');
         mkdir($this->p('app', ''));
         mkdir($this->p('app', 'config'));
         mkdir($this->p('app', 'config/environments'));
         $this->installFile('Core', 'config/environments/development.php');
         $this->installFile('Core', 'config/environments/production.php');
         mkdir($this->p('user', ''));
         mkdir($this->p('log', ''));
         mkdir($this->p('state', ''));
         $file = fopen($this->p('app', 'app.json'), 'w');
         if ($file) {
             fwrite($file, Json::prettyPrint($manifest));
             fclose($file);
             return $this->next();
         }
     } else {
         $this->configForm->name = $this->app->name;
         $this->configForm->version = $this->app->version;
         $this->configForm->modules = array('Controllers', 'Snippets', 'Databases', 'Migrations', 'ActiveModels', 'Extensions', 'Themes', 'AccessControl', 'Setup', 'Jtk', 'Console', 'Generators', 'Content');
     }
     return $this->render();
 }
示例#2
0
文件: JsonStore.php 项目: jivoo/jivoo
 /**
  * {@inheritdoc}
  */
 protected function encode(array $data)
 {
     if ($this->prettyPrint) {
         return Json::prettyPrint($data);
     }
     return Json::encode($data);
 }
示例#3
0
 /**
  * Run build script.
  * @param string $root Package root.
  * @throws InstallException on failure.
  */
 public function run($root)
 {
     $this->buildPath = $this->p('tmp/build/' . $this->name);
     if (!Utilities::dirExists($this->buildPath, true, true)) {
         throw new InstallException('Could not create build directory: ' . $this->buildPath);
     }
     $this->installPath = Paths::combinePaths($root, $this->name);
     if (!Utilities::dirExists($this->installPath, true, true)) {
         throw new InstallException('Could not create install directory: ' . $this->installPath);
     }
     if (isset($this->prepare)) {
         $this->info(tr('Preparing...'));
         call_user_func($this->prepare, $this);
     }
     $this->fetchSources();
     if (isset($this->build)) {
         $this->info(tr('Building...'));
         call_user_func($this->build, $this);
     }
     if (isset($this->install)) {
         $this->info(tr('Installing...'));
         call_user_func($this->install, $this);
     }
     $this->manifest['name'] = $this->name;
     $this->manifest['version'] = $this->version;
     if (isset($this->manifestFile) and isset($this->manifest)) {
         $this->info(tr('Creating manifest...'));
         $manifestFile = $this->installPath . '/' . $this->manifestFile;
         file_put_contents($manifestFile, Json::prettyPrint($this->manifest));
     }
 }