Example #1
0
 public static function start($buildOptions = array())
 {
     try {
         $buildOptions['VERBOSE_MODE'] = array('', false);
         Environment::init($buildOptions);
         self::processArg();
     } catch (\Exception $e) {
         self::help($e->getMessage());
     }
 }
 public static function init($aOptions)
 {
     parent::init($aOptions);
     $options = static::getVars();
     //url to the app package dir, i.e. /__
     $path = preg_replace('/^' . preg_quote(realpath($_SERVER['DOCUMENT_ROOT']), '/') . '/', '', realpath($options->get('appPackageFilePath')));
     $path = str_replace('\\', '/', $path);
     $options->add('appPackageWebPath', $path);
     //url to app dependencies dir, i.e. /__/deps
     $options->add('appDependenciesWebPath', $options->get('appPackageWebPath') . '/deps');
     //url to the app source dir
     //NOTE: this defaults to the same as appPackageWebPath, but can be overridden at the app level if desired
     //
     //Possible use cases are:
     //
     //- if you want to use a 'src' dir as a sibling to the 'deps' dir, i.e. /__/src.
     //  Components would therefore be at /__/src/App/Controller.js
     //
     //- if you want to append a virtual dir for versioning/cache-busting purposes.
     //  e.g. /__/@v1.0/App/Controller.js
     $options->add('appSourceWebPath', $options->get('appPackageWebPath'));
 }
Example #3
0
<?php

/**
 * This is the bootstrap file for console application.
 */
// Set environment
require_once dirname(__FILE__) . '/protected/extensions/environment/Environment.php';
$env = new Environment();
$env->init();
Yii::createConsoleApplication($env->console)->run();
// When you execute a PHP script from the command line, it inherits the environment variables defined in your shell.
// That means you can set an environment variable using the export command like so:
// export YII_ENVIRONMENT='TEST'
// Shell: php /path/to/cron.php command
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 public function setUp()
 {
     Environment::init();
 }
Example #5
0
 *                               init.php
 *                            -------------------
 *   begin                : October 06, 2011
 *   copyright            : (C) 2011 Kevin MASSY
 *   email                : kevin.massy@phpboost.com
 *
 *
 ###################################################
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ###################################################*/
defined('PATH_TO_ROOT') or define('PATH_TO_ROOT', '..');
require_once PATH_TO_ROOT . '/kernel/framework/core/environment/Environment.class.php';
Environment::load_imports();
Environment::init();
/* DEPRECATED VARS */
$Bread_crumb = new BreadCrumb();
/* END DEPRECATED */
 /**
  * Read configuration key
  *
  * @param string $key Key name
  * @param string $environment Environment name
  * @return false|string false or value
  */
 public static function read($key = '', $environment = '')
 {
     Environment::init();
     if (empty($environment)) {
         $environment = Environment::get();
     }
     $value = Configure::read('Environment.' . $environment . '.' . $key);
     if ($value !== null) {
         return $value;
     }
     return false;
 }