Ejemplo n.º 1
0
def cli(box, command):
    """
    Run a git command
    """
    if not box.is_running():
        click.secho('error: box %s is not running' % (box.name()),
                    fg='red', err=True)
        sys.exit(1)

    if sync(box, 'up') is False:
        # sync failed, message should already be displayed, exit
        sys.exit(1)

    res = box.ssh_shell('git %s' % ' '.join(map(quote, command)))

    if res == box.NO_PROJECT_DIR:
        click.secho('error: project folder does not exists!',
                    fg='red')

    if sync(box, 'down') is False:
        # sync failed, message should already be displayed, exit
        sys.exit(1)

    sys.exit(res)
Ejemplo n.º 2
0
def _up(box, make):
    click.echo('\nStarting box %s\n' %
               style(box.name(), bold=True))

    if not box.is_running():
        start_box(box)
    else:
        box.vagrant('provision')

    if make:
        click.echo('\nRunning make %s in your box\n' %
                   style(make, bold=True))
        if box.ssh_shell('make %s' % make) != 0:
            fatal('make command failed!')

        if sync(box, 'down') is False:
            # sync failed, message should already be displayed, exit
            sys.exit(1)
Ejemplo n.º 3
0
def cli(box, command):
    """
    Run a make command
    """
    if not box.is_running():
        click.secho('error: box %s is not running' % (box.name()),
                    fg='red', err=True)
        sys.exit(1)

    if sync(box, 'up') is False:
        # sync failed, message should already be displayed, exit
        sys.exit(1)

    res = box.ssh_shell('make %s' % ' '.join(map(quote, command)))

    # make returns ENOENT if any error happened so we need to use
    # another code
    if res == box.NO_PROJECT_DIR:
        click.secho('error: project folder does not exists!',
                    fg='red')

    sys.exit(res)
Ejemplo n.º 4
0
 def start(self):
     self.state = 'starting'
     sync(self.box, 'up')
     self.process = self.box.ssh_shell(self.command, popen=True)
     self.state = 'started'