Exemplo n.º 1
0
 function testReadEmpty()
 {
     $cli = new lmbCliInput();
     $this->assertEqual($cli->getOptions(), array());
     $this->assertEqual($cli->getArguments(), array());
     $this->assertNull($cli->getOption('f'));
     $this->assertNull($cli->getOptionValue('f'));
     $this->assertFalse($cli->hasOption('f'));
     $this->assertEqual($cli->getOptionValue('f', 'wow'), 'wow');
     $this->assertNull($cli->getArgument(0));
     $this->assertEqual($cli->getArgument(0, 'wow'), 'wow');
 }
Exemplo n.º 2
0
 function updateTranslations($argv)
 {
     $input = new lmbCliInput('t|test');
     $input->read($argv, false);
     $dry_run = $input->isOptionPresent('t');
     $input_dir = realpath($input->getArgument(0, '.'));
     if (!$input_dir) {
         $this->_error('Input directory is not valid');
     }
     $output_dir = realpath($input->getArgument(1, $input_dir . '/i18n/translations'));
     if (!$output_dir) {
         $this->_error('Output directory is not valid');
     }
     $qt = new lmbQtDictionaryBackend();
     $qt->setSearchPath($output_dir);
     $util = new lmbDictionaryUpdater($qt, $this->output);
     if ($dry_run) {
         $util->dryrun($input_dir);
     } else {
         $util->updateTranslations($input_dir);
     }
     return 0;
 }
Exemplo n.º 3
0
 function create($argv)
 {
     $input = new lmbCliInput();
     $input->setMinimumArguments(1);
     if (!$input->read($argv, false)) {
         $this->help($argv);
         return 1;
     }
     $dst_dir = $input->getArgument(0);
     if (file_exists($dst_dir)) {
         echo "Directory or file '{$dst_dir}' already exists\n";
         return 1;
     }
     echo "Copying skeleton Limb3 WEB_APP application to '{$dst_dir}'...\n";
     lmbFs::cp(dirname(__FILE__) . '/../skel', $dst_dir, '~^\\.svn~');
     echo "Generating code from templates...\n";
     $this->_resolveTemplate("{$dst_dir}/setup.override.php.tpl", array('%LIMB_PARENT_DIR%' => realpath(dirname(__FILE__) . '/../../../')));
     echo "done!";
 }