webgme/webgme-cli

View on GitHub
bin/webgme-new-seed

Summary

Maintainability
Test Coverage
#!/usr/bin/env node

'use strict';
var Command = require('commander').Command,
    SeedManager = require('../src/SeedManager'),
    program = new Command(),
    nop = require('nop');

program
    .arguments('<project>')
    .description('Create a seed from an existing WebGME project')
    .option('-n, --seed-name [name]', 'Create different name for the seed')
    .option('-u, --user [name]', 'User with access to the seed project (if using authentication)')
    .option('-b, --branch [branch]', 'Branch to use. Default is master')
    .option('-f, --file <file path>', 'Create seed from existing project file')
    .action(function(project) {
        // FIXME: This is only called if an arg is passed!
        // Otherwise, it fails silently
        var manager = new SeedManager();

        program.project = project;
        manager.new(program, function(err) {
            // Seed generation has a bug where it needs to be killed manually :/
            if (err) {
                process.exit(1);
            } else {
                process.exit();
            }
        });
    })
    .parse(process.argv);