Install an app file by moving it into the specified Applications directory

    Args:
        app (str): The location of the .app file
        target (str): The target in which to install the package to
                      Default is ''/Applications/''

    Returns:
        str: The results of the rsync command

    CLI Example:

    .. code-block:: bash

        salt '*' macpackage.install_app /tmp/tmp.app /Applications/

def install_app(app, target='/Applications/'):
    '''
    Install an app file by moving it into the specified Applications directory

    Args:
        app (str): The location of the .app file
        target (str): The target in which to install the package to
                      Default is ''/Applications/''

    Returns:
        str: The results of the rsync command

    CLI Example:

    .. code-block:: bash

        salt '*' macpackage.install_app /tmp/tmp.app /Applications/
    '''

    if target[-4:] != '.app':
        if app[-1:] == '/':
            base_app = os.path.basename(app[:-1])
        else:
            base_app = os.path.basename(app)

        target = os.path.join(target, base_app)

    if not app[-1] == '/':
        app += '/'

    cmd = 'rsync -a --delete "{0}" "{1}"'.format(app, target)
    return __salt__['cmd.run'](cmd)