Exemplo n.º 1
0
 *
 * By default the the environment detector defines the current 
 * environment. But you can force another one using the this var.
 */
$environment = 'phpunit';
/*
 *---------------------------------------------------------------
 * Require CCF
 *---------------------------------------------------------------
 *
 * load the framework file wich wil initialize CCF. 
 */
require_once __DIR__ . "/../framework.php";
/*
 *---------------------------------------------------------------
 * CCUnit resources
 *---------------------------------------------------------------
 *
 * For the unit tests we need some additional resources like
 * controllers, views, ect... 
 */
CCOrbit::enter(COREPATH . 'orbit/CCUnit');
// write header
CCCli::line("==============================\n    _____ _____ ______ \n   / ____/ ____|  ____|\n  | |   | |    | |__   \n  | |   | |    |  __|  \n  | |___| |____| |     \n   \\_____\\_____|_| ramework\n==============================\n", 'cyan');
// complete overwrite of DB configuration
CCConfig::create('database')->_data = CCConfig::create('Core::phpunit/database')->_data;
// delete all database table
DB\Migrator::hard_reset();
DB\Migrator::hard_reset('phpunit');
// run the migrations
DB\Migrator::migrate(true);
Exemplo n.º 2
0
/*
 *---------------------------------------------------------------
 * Require the application map
 *---------------------------------------------------------------
 * 
 * The application map can contain additional path information
 */
if (file_exists(APPPATH . 'map' . EXT)) {
    require APPPATH . 'map' . EXT;
}
/*
 *---------------------------------------------------------------
 * composer / vendor
 *---------------------------------------------------------------
 * 
 * After ccf is done with its own initialisation we implement the
 * composers vendor autoloader.
 */
require_once VENDORPATH . "autoload" . EXT;
// at this point vendor autoloader is registered
CCProfiler::check("CCF - Vendro autoloader registered.");
/*
 *---------------------------------------------------------------
 * installed ships
 *---------------------------------------------------------------
 * 
 * Load and wake all installed ships.
 */
CCOrbit::enter_installed_ships();
// all done
CCProfiler::check("CCF - All runtime ships entered the Orbit.");
Exemplo n.º 3
0
 /**
  * Get the current builder output
  *
  * @return string
  */
 public function output()
 {
     $namespace = null;
     $class = $this->name;
     extract(\CCConfig::create('shipyard')->defaults);
     // get namespace from the param
     if (strpos($class, '::') !== false) {
         list($namespace, $class) = explode('::', $this->name);
         // try to get the ship from namespace
         if ($ship = \CCOrbit::ship_by_namespace($namespace)) {
             $package = $ship->name;
             $version = $ship->version;
             $authors = $ship->authors;
         }
     }
     // create forge instance
     $forge = new \CCForge_Php($namespace);
     // add header
     $forge->comment($this->file_header($class, array('package' => $package, 'authors' => $authors, 'version' => $version, 'copyright' => $copyright)));
     $class_string = 'class ' . $class;
     // superclasses
     if ($this->extends) {
         $class_string .= ' extends ' . $this->extends;
     }
     // interface implementations
     if (!empty($this->implements)) {
         $class_string .= ' implements ' . implode(', ', $this->implements);
     }
     // create the closure
     $forge->closure($class_string, $this->output);
     return $forge->buffer;
 }
Exemplo n.º 4
0
 /**
  * uninstall an orbit module
  *
  * @param array 		$params 
  */
 public function action_uninstall($params)
 {
     $path = $params[0];
     if (empty($path)) {
         CCCli::line('no ship path given.', 'red');
         return;
     }
     /*
      * direct install if starting with /
      */
     if (substr($path, 0, 1) == '/') {
         // fix path
         if (substr($path, -1) != '/') {
             $path .= '/';
         }
         // is directory
         if (!is_dir($path)) {
             CCCli::line('could not find a ship at path: ' . $path, 'red');
             return;
         }
         // are ya serius..
         if (!CCCli::confirm("are you sure you want to uninstall this ship?", true)) {
             return;
         }
         // run the uninstaller
         try {
             \CCOrbit::uninstall($path);
         } catch (\Exception $e) {
             CCCli::line($e->getMessage(), 'red');
             CCCli::line('ship destroying failure.', 'red');
             return;
         }
         // also remove the direcoty?
         if (CCCli::confirm("do you also wish to remove the ship files?", true)) {
             \CCFile::delete($path);
         }
         // we are done
         CCCli::line('ship destroyed!', 'green');
         return;
     }
     // check if the module is in our orbit path
     if (is_dir(ORBITPATH . $path)) {
         // there is a ship yay
         CCCli::line('found ship at path: ' . ORBITPATH . $path, 'green');
         return static::action_uninstall(array(ORBITPATH . $path));
     }
     // nothing to do here
     CCCli::line('could not find a ship at this path or name.', 'red');
     return;
 }