protected function execute(InputInterface $input, OutputInterface $output)
 {
     $tangler = new Tangler();
     $tangler->setAutoloader($this->getApplication()->autoloader);
     $filename = $input->getArgument('filename');
     $data = file_get_contents($filename);
     $xml = $movies = new SimpleXMLElement($data);
     foreach ($xml->autoload as $autoloadnode) {
         $prefix = (string) $autoloadnode['prefix'];
         $path = (string) $autoloadnode['path'];
         echo "Adding autoload prefix: " . $prefix . ' (' . $path . ')' . "\n";
         $tangler->getAutoloader()->add($prefix, $path);
     }
     $indexhtml = '<h1>Module index</h1>';
     foreach ($xml->moduledoc as $moduledocnode) {
         $classname = (string) $moduledocnode['class'];
         $output = (string) $moduledocnode['output'];
         //echo "CLASS: $classname\n";
         $module = new $classname();
         $html = $module->getHtml();
         $indexhtml .= $module->getIndexHtml();
         $data = array();
         $data['body'] = $html;
         file_put_contents($output, json_encode($data));
     }
     $data = array();
     $data['body'] = $indexhtml;
     file_put_contents('contents/modules.json', json_encode($data));
 }
Beispiel #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $tangler = new Tangler();
     $tangler->setAutoloader($this->getApplication()->autoloader);
     $loader = new TanglerLoader();
     $filename = $input->getArgument('filename');
     $loader->load($tangler, $filename);
     /*
     
             $channel = new Channel();
             $channel->setKey('test.channel.label');
             $channel->setLabel('Test channel label');
             $channel->setDescription('Test channel description');
     
             $trigger = new \Tangler\Service\File\NewFileTrigger();
             $trigger->parameter->setValue('dir', '/tmp/tangler.in/');
     
             $channel->setTrigger($trigger);
     
             $action = new \Tangler\Service\File\CreateFileAction();
             $action->parameter->setValue('dir', '/tmp/tangler.out/');
             $action->parameter->setValue('filename', 'new.{{filename}}.bin');
             $action->parameter->setValue('content', 'Content: {{content}}.the end');
             $channel->addAction($action);
     
             $action = new \Tangler\Service\Smtp\SendEmailAction();
             $action->parameter->setValue('smtp.host', 'mail.example.web');
             $action->parameter->setValue('smtp.username', 'qweqweqwe');
             $action->parameter->setValue('smtp.password', 'qweqweqwe');
             $action->parameter->setValue('subject', 'New file: {{filename}}');
             $action->parameter->setValue('from', '*****@*****.**');
             $action->parameter->setValue('to', '*****@*****.**');
             $action->parameter->setValue('body', "Found a file {{filename}}:\n{{content}}\nThe end!");
             $channel->addAction($action);
     
             $tangler->addChannel($channel);
     */
     $tangler->Run();
 }