Author: Victor Farazdagi
Beispiel #1
0
 /**
  * Create runner
  *
  * @param \Phrozn\Autoloader $loader Instance of auto-loader
  * @param array $paths Folder paths
  */
 public function __construct($loader)
 {
     $this->paths = $loader->getPaths();
     $this->loader = $loader;
     // load main config
     $this->config = Yaml::load($this->paths['configs'] . 'phrozn.yml');
 }
Beispiel #2
0
 /**
  * If configuration options are passed then twig environment
  * is initialized right away
  *
  * @param array $options Processor options
  *
  * @return \Phrozn\Processor\Twig
  */
 public function __construct($options = array())
 {
     $path = Loader::getInstance()->getPath('library');
     if (count($options)) {
         $this->setConfig($options)->getEnvironment();
     }
 }
Beispiel #3
0
 private function autoloadPlugins($plugins)
 {
     $loader = \Phrozn\Autoloader::getInstance()->getLoader();
     $plugins .= '/plugins/';
     if (is_dir($plugins)) {
         $loader->add('PhroznPlugin', $plugins);
     }
 }
Beispiel #4
0
 /**
  * If configuration options are passes then twig environment
  * is initialized right away
  *
  * @param array $options Processor options
  *
  * @return void
  */
 public function __construct($options = array())
 {
     $path = Loader::getInstance()->getPath('library');
     require_once $path . '/Vendor/Extra/scss.inc.php';
     if (count($options)) {
         $this->setConfig($options)->getEnvironment();
     }
 }
 public function setUp()
 {
     $this->outputter = new Outputter($this);
     $this->fout = fopen(self::STDOUT, 'w+');
     define('STDOUT', $this->fout);
     require_once 'Phrozn/Autoloader.php';
     $loader = Loader::getInstance();
     $this->runner = new Runner($loader);
 }
Beispiel #6
0
 public function setUp()
 {
     $this->phr = realpath(__DIR__ . '/../../../bin/phrozn.php');
     $this->outputter = new Outputter($this);
     $this->fout = tmpfile();
     define('STDOUT', $this->fout);
     require_once 'Phrozn/Autoloader.php';
     $loader = Loader::getInstance();
     $this->runner = new Runner($loader);
 }
Beispiel #7
0
 /**
  * If configuration options are passed then twig environment
  * is initialized right away
  *
  * @param array $options Processor options
  *
  * @return \Phrozn\Processor\Twig
  */
 public function __construct($options = array())
 {
     $path = Loader::getInstance()->getPath('library');
     // Twig uses perverted file naming (due to absense of NSs at a time it was written)
     // so fire up its own autoloader
     require_once $path . '/Vendor/Twig/Autoloader.php';
     \Twig_Autoloader::register();
     if (count($options)) {
         $this->setConfig($options)->getEnvironment();
     }
 }
Beispiel #8
0
#!/usr/bin/env php
<?php 
use Phrozn\Autoloader as Loader;
error_reporting(E_ALL & ~E_NOTICE);
// rely on configuration files
require_once dirname(__FILE__) . '/../Phrozn/Autoloader.php';
$loader = Loader::getInstance()->getLoader();
$config = new \Phrozn\Config(dirname(__FILE__) . '/../configs/');
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$pack = new PEAR_PackageFileManager2();
$outputDir = realpath(dirname(__FILE__) . '/../') . '/';
$inputDir = realpath(dirname(__FILE__) . '/../');
$e = $pack->setOptions(array('baseinstalldir' => '/', 'packagedirectory' => $inputDir, 'ignore' => array('build/', 'tests/', 'extras/', 'plugin/', 'phrozn.png', '*.tgz', 'bin/release', 'tags'), 'outputdirectory' => $outputDir, 'simpleoutput' => true, 'roles' => array('textile' => 'doc'), 'dir_roles' => array('Phrozn' => 'php', 'configs' => 'data', 'skeleton' => 'data', 'tests' => 'test'), 'exceptions' => array('bin/phrozn.php' => 'script', 'bin/phr.php' => 'script', 'LICENSE' => 'doc'), 'installexceptions' => array(), 'clearchangelog' => true));
$pack->setPackage('Phrozn');
$pack->setSummary($config['phrozn']['summary']);
$pack->setDescription($config['phrozn']['description']);
$pack->setChannel('pear.phrozn.info');
$pack->setPackageType('php');
// this is a PEAR-style php script package
$pack->setReleaseVersion($config['phrozn']['version']);
$pack->setAPIVersion($config['phrozn']['version']);
$pack->setReleaseStability($config['phrozn']['stability']);
$pack->setAPIStability($config['phrozn']['stability']);
$pack->setNotes('
    * The first public release of Phrozn
');
$pack->setLicense('Apache License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0');
$pack->addMaintainer('lead', 'victor', 'Victor Farazdagi', '*****@*****.**');
$pack->addRelease();
$pack->addInstallAs('bin/phr.php', 'phr');
Beispiel #9
0
 /**
  * Processor can be setup at initialization time
  *
  * @param array $options Processor options
  *
  * @return void
  */
 public function __construct($options = array())
 {
     $path = Loader::getInstance()->getPath('library');
     require_once $path . '/Vendor/Extra/textile.php';
     $this->textile = new \Textile;
 }
Beispiel #10
0
 /**
  * Processor can be setup at initialization time
  *
  * @param array $options Processor options
  *
  * @return void
  */
 public function __construct($options = array())
 {
     $path = Loader::getInstance()->getPath('library');
     require_once $path . '/Vendor/Extra/markdown.php';
     $this->markdown = new \Markdown_Parser();
 }
Beispiel #11
0
 /**
  * Make sure that absolute application path is prepended to config paths
  *
  * @return \Phrozn\Config
  */
 public function updatePaths()
 {
     if (isset($this->configs['paths'])) {
         $paths = Loader::getInstance()->getPaths();
         foreach ($this->configs['paths'] as $key => $file) {
             $file = str_replace('@PEAR-DIR@', $paths['php_dir'], $file);
             $file = str_replace('@DATA-DIR@', $paths['data_dir'], $file);
             $this->configs['paths'][$key] = $file;
         }
     }
     return $this;
 }
Beispiel #12
0
 private function getAppConfig()
 {
     if (null === $this->appConfig) {
         $path = Loader::getInstance()->getPath('configs') . '/phrozn.yml';
         $this->appConfig = Yaml::load(file_get_contents($path));
     }
     return $this->appConfig;
 }
Beispiel #13
0
#!/usr/bin/env php
<?php
namespace Phrozn;
use Phrozn\Runner\CommandLine as Runner,
    Phrozn\Autoloader as Loader;

if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { // stand-alone version is running
    $base = dirname(__FILE__) . '/../';
    set_include_path($base . PATH_SEPARATOR . get_include_path());
}

require_once 'Phrozn/Autoloader.php';
$loader = Loader::getInstance();
$runner = new Runner($loader);
$runner->run();

unset($runner, $loader);