Rebuild cozy apps with deletion of npm directory & new npm build

def rebuild_app(app_name, quiet=False, force=True, without_exec=False,
                restart=False):
    '''
        Rebuild cozy apps with deletion of npm directory & new npm build
    '''
    user = 'cozy-{app_name}'.format(app_name=app_name)
    home = '{prefix}/{app_name}'.format(prefix=PREFIX, app_name=app_name)
    command_line = 'cd {home}'.format(home=home)
    command_line += ' && git pull'
    if force:
        command_line += ' && ([ -d node_modules ] && rm -rf node_modules || true)'
        command_line += ' && ([ -d .node-gyp ] && rm -rf .node-gyp || true)'
        command_line += ' && ([ -d .npm ] && rm -rf .npm || true)'
    command_line += ' && chown -R {user}:{user} .'.format(user=user)
    command_line += ' && sudo -u {user} env HOME={home} npm install --production'.format(
        user=user,
        home=home
    )
    if restart:
        command_line += ' && cozy-monitor update {app_name}'.format(
            app_name=app_name)
        command_line += ' && cozy-monitor restart {app_name}'.format(
            app_name=app_name)

    if not quiet:
        print 'Execute:'
        print command_line

    if not without_exec:
        result = helpers.cmd_exec(command_line)
        print result['stdout']
        print result['stderr']
        print result['error']