Example #1
0
 public static function bundles()
 {
     return \Cherry\BundleManager::getInstance();
 }
Example #2
0
<?php

use Cherry\unipath;
use Cherry\Base\Event;
\Cherry\BundleManager::load('cherry.crypto');
// Register a post-setup hook for the CherryUtil application command. This will be
// triggered when the files have been copied.
Event::observe('cherryutil.application.post-setup', function (array $data, $log) {
    $app_root = $data['approot'];
    $cfgpath = \cherry\unipath($app_root . '/application.ini');
    if (!file_exists($cfgpath)) {
        if ($log) {
            $log->write("Application config not found. Creating...\n");
        }
        $cfg = array('application' => array());
    } else {
        $log->write("Updating application configuration...\n");
        $cfg = parse_ini_file($cfgpath, true);
    }
    $cfg['application']['namespace'] = $data['appns'];
    if (empty($cfg['application']['appname'])) {
        $cfg['application']['appname'] = 'MVC Application';
    }
    if (empty($cfg['application']['version'])) {
        $cfg['application']['version'] = '1.0.0';
    }
    if (empty($cfg['application']['uuid']) || $data['replace']) {
        printf("Generating new UUID...");
        $uuid = \cherry\crypto\Uuid::getInstance()->generate(\cherry\crypto\Uuid::UUID_V4);
        //$uuid = trim(exec('uuidgen'));
        printf("%s\n", $uuid);
Example #3
0
<?php

define('APPLICATION', 'LeptonApplication');
// Bootstrap
if (!@(include_once "lib/bootstrap.php")) {
    $libpath = getenv('CHERRY_LIB');
    if (!$libpath) {
        fprintf(STDERR, "Define the CHERRY_LIB envvar first.");
        exit(1);
    }
    require_once $libpath . '/lib/bootstrap.php';
}
$lepton = new \cherry\Lepton(__FILE__);
use cherry\base\Event;
use cherry\base\EventEmitter;
use cherry\BundleManager;
use Cherry\Extension\ExtensionManager;
BundleManager::load('cherry.net');
BundleManager::load('cherry.mvc');
BundleManager::load('cherry.crypto');
BundleManager::load('cherry.user');
//ExtensionManager::load('cherrybar');
$rt = \Cherry\Mvc\Router\StaticRoutes::getInstance();
$rt->addRoute('/start/', '\\MyApp\\Controllers\\IndexController:start');
$app = new \cherry\Mvc\Application();
$lepton->runApplication($app);
//$lv = new \cherry\mvc\view\LipsumView();
//echo $lv->getViewcontents();