Example #1
0
def check(test_name, *args):
    if test_name == 'has_command':
        if not args:
            raise ValueError('At least one argument is required. (command_name)')
        if not has_command(args[0]):
            raise ValueError('No command named "{}".'.format(args[0]))
    elif test_name == 'has_app':
        if not args:
            raise ValueError('At least one argument is required. (app_name)')
        if not has_app(args[0]):
            raise ValueError('No app named "{}".'.format(args[0]))
    else:
        raise ValueError('No such test. ({})'.format(test_name))
Example #2
0
def check(test_name, *args):
    if test_name == 'has_command':
        if not args:
            raise ValueError(
                'At least one argument is required. (command_name)')
        if not has_command(args[0]):
            raise ValueError('No command named "{}".'.format(args[0]))
    elif test_name == 'has_app':
        if not args:
            raise ValueError('At least one argument is required. (app_name)')
        if not has_app(args[0]):
            raise ValueError('No app named "{}".'.format(args[0]))
    else:
        raise ValueError('No such test. ({})'.format(test_name))
Example #3
0
def setup(verbose=False, dry_run=False):
    version(warning_only=True)

    if os_info.is_osx:
        # Check for `brew`
        if not has_command('brew'):
            if verbose:
                console.info('Install homebrew as package manager')
            command = 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
            if dry_run or verbose:
                console.show(command)
            if not dry_run:
                os.system(command)
        # Check the source of python and ruby
        python_version, _ = run('brew ls --versions python', capture_output=True)
        if not python_version:
            console.warn('You should use brew-installed python. (brew install python)')
        ruby_version, _ = run('brew ls --versions ruby', capture_output=True)
        if not ruby_version:
            console.warn('You should use brew-installed ruby. (brew install ruby)')

    elif os_info.is_linux:
        # TODO: Add yum/apt-get check
        pass
Example #4
0
 def available(self):
     return has_command(self.command) and self.packages