/** * @param Project $project */ public function init(Project $project) { $this->build = $project->getPath('build fenom'); $filesystem = new Filesystem(); $filesystem->mkdir($this->build); $this->source[] = $project->getPath('resources fenom'); }
public function build($script) { $dependencies = array_merge($this->dependency->getList($this->project->getPath("resources coffee {$script}.coffee")), $this->dependency->getList($this->sencha->getPath('src coffee Cti.coffee'))); $fs = new Filesystem(); $result = ''; $sourceList = array(); $stopwatch = new Stopwatch(); foreach (array_reverse($dependencies) as $coffee) { $sourceList[] = $coffee; $local = $this->source->getLocalPath($coffee); $local_js = dirname($local) . DIRECTORY_SEPARATOR . basename($local, 'coffee') . 'js'; $javascript = $this->project->getPath(sprintf('build js %s', $local_js)); if (!file_exists($javascript) || filemtime($coffee) >= filemtime($javascript)) { if ($this->debug) { $stopwatch->start($local); echo '- compile ' . $local; } $code = \CoffeeScript\Compiler::compile(file_get_contents($coffee), array('filename' => $coffee, 'bare' => true, 'header' => false)); if ($this->debug) { $event = $stopwatch->stop($local); echo ' (' . String::formatMilliseconds($event->getDuration()) . ' using ' . String::formatBytes($event->getMemory()) . ')' . PHP_EOL; } $fs->dumpFile($javascript, $code); } else { $code = file_get_contents($javascript); } $result .= $code . PHP_EOL; } $this->hash[$script] = $sourceList; $this->cache->set(__CLASS__, $this->hash); $filename = $this->project->getPath("public js {$script}.js"); $fs->dumpFile($filename, $result); return $filename; }
/** * render template * @param string $name * @param array $data * @return string */ public function render($name, $data = array()) { try { extract($data); ob_start(); include $this->project->getPath('resources php view ' . func_get_arg(0) . '.php'); return ob_get_clean(); } catch (\Exception $e) { return $e->getMessage(); } }
public function init(\Cti\Core\Module\Cache $cache) { parent::init($cache); $this->path = dirname(dirname(__DIR__)); $source = $this->application->getManager()->get('Cti\\Sencha\\Coffee\\Source'); $source->add($this->getPath('resources coffee')); $source->add($this->getPath('src coffee')); $source->add($this->project->getPath('src coffee')); $source->add($this->project->getPath('build coffee')); $source->add($this->project->getPath('resources coffee')); foreach ($this->getClasses('Direct') as $class) { $this->application->getManager()->getConfiguration()->push('Cti\\Direct\\Service', 'list', $class); } }
public function init() { $this->addSource($this->project->getPath('src coffee')); $this->addSource($this->project->getPath('resources coffee')); }
function addSource(Fenom $fenom, Project $project) { $fenom->addSource($project->getPath('resources another-fenom')); }