Ejemplo n.º 1
0
 public function testStringCommandDeclaration()
 {
     global $argv;
     $argv = ['test', 'mycommand'];
     ClearIce::reset();
     ClearIce::setStreamUrl('output', vfsStream::url('std/output'));
     ClearIce::addCommands('mycommand');
     $options = ClearIce::parse();
     $this->assertEquals('mycommand', $options['__command__']);
 }
Ejemplo n.º 2
0
 public function setup()
 {
     ClearIce::reset();
     ClearIce::addCommands(array('command' => 'init', 'help' => 'initialize a directory with the source files of the wiki'), array('command' => 'generate', 'help' => 'generate the data for a given directory and store it somewhere cool', 'usage' => 'generate --target=[TARGET]'), 'export');
     ClearIce::addOptions(array('command' => 'init', 'short' => 'd', 'long' => 'directory', 'has_value' => true, 'help' => "specify the directory to be initialized"), array('command' => 'init', 'short' => 't', 'long' => 'title', 'has_value' => true, 'help' => "title of the new wiki to be initialized"), array('command' => 'generate', 'short' => 't', 'long' => 'target', 'has_value' => true, "help" => "specify where the generated wiki should be"), array('command' => 'export', 'short' => 'f', 'long' => 'format', "help" => "specify the format of the exported wiki"), array('short' => 'v', 'long' => 'verbose', 'has_value' => false, "help" => "display more information"));
 }
Ejemplo n.º 3
0
Archivo: cli.php Proyecto: codogh/yentu
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
require "vendor/autoload.php";
require __DIR__ . "/../src/globals.php";
use clearice\ClearIce;
use yentu\Yentu;
use ntentan\config\Config;
ClearIce::addCommands(array('command' => 'import', 'help' => 'import the schema of an existing database'), array('command' => 'migrate', 'help' => 'run new migrations on the target database'), array('command' => 'init', 'help' => 'initialize the yentu directory'), array('command' => 'create', 'usage' => 'create [name] [options]..', 'help' => 'create a new migration'), array('command' => 'rollback', 'help' => 'rollback the previus migration which was run'), array('command' => 'status', 'help' => 'display the current status of the migrations'));
ClearIce::addOptions(array('command' => 'import', 'short' => 'd', 'long' => 'skip-defaults', 'help' => 'do not import the default values of the columns'), array('command' => 'init', 'short' => 'i', 'long' => 'interractive', 'help' => 'initialize yentu interractively'), array('command' => 'init', 'short' => 'd', 'long' => 'driver', 'help' => 'database platform. Supports postgresql', 'has_value' => true), array('command' => 'init', 'short' => 'h', 'long' => 'host', 'help' => 'the hostname of the target database', 'has_value' => true), array('command' => 'init', 'short' => 'p', 'long' => 'port', 'help' => 'the port of the target database', 'has_value' => true), array('command' => 'init', 'short' => 'n', 'long' => 'dbname', 'help' => 'the name of the target database', 'has_value' => true), array('command' => 'init', 'short' => 'u', 'long' => 'user', 'help' => 'the user name on the target database', 'has_value' => true), array('command' => 'init', 'short' => 'p', 'long' => 'password', 'help' => 'the passwrd of the user on the target database', 'has_value' => true));
ClearIce::addOptions(array('command' => 'migrate', 'long' => 'no-foreign-keys', 'help' => 'do not apply any database foriegn-key constraints'), array('command' => 'migrate', 'long' => 'only-foreign-keys', 'help' => 'apply only database foreign-key constraints (fails on errors)'), array('command' => 'migrate', 'long' => 'force-foreign-keys', 'help' => 'apply only database foreign-key constraints'), array('command' => 'migrate', 'long' => 'dump-queries', 'help' => 'just dump the query and perform no action'), array('command' => 'migrate', 'long' => 'dry', 'help' => 'perform a dry run. Do not alter the database in anyway'), array('command' => 'migrate', 'long' => 'default-schema', 'has_value' => true, 'help' => 'use this as the default schema for all migrations'), array('command' => 'migrate', 'long' => 'default-ondelete', 'help' => 'the default cascade action for foreign key deletes', 'has_value' => true), array('command' => 'migrate', 'long' => 'default-onupdate', 'help' => 'the default cascade action for foreign key updates', 'has_value' => true));
ClearIce::addCommands(array('command' => 'rollback', 'long' => 'default-schema', 'has_value' => true, 'help' => 'reverse only migrations in this default-schema'));
ClearIce::addOptions(array('short' => 'y', 'long' => 'home', 'help' => 'specifies where the yentu configurations are found', 'has_value' => true), array('short' => 'v', 'long' => 'verbose', 'help' => 'set level of verbosity. high, mid, low and none', 'has_value' => true));
ClearIce::addOptions(array('long' => 'details', 'help' => 'show details of all migrations.', 'command' => 'status'));
ClearIce::setDescription("Yentu Database Migrations\nVersion " . Yentu::getVersion());
ClearIce::setFootnote("Report bugs to jainooson@gmail.com");
ClearIce::setUsage("[command] [options]");
ClearIce::addHelp();
ClearIce::setStrict(true);
$options = ClearIce::parse();
if (isset($options['verbose'])) {
    ClearIce::setOutputLevel($options['verbose']);
}
try {
    if (isset($options['__command__'])) {
        if (isset($options['home'])) {
            Yentu::setDefaultHome($options['home']);