How to use dotbot - 10 common examples

To help you get started, we’ve selected a few dotbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anishathalye / dotbot / dotbot / cli.py View on Github external
from .plugins import Clean, Create, Link, Shell
        plugin_paths = []
        for directory in plugin_directories:
          for plugin_path in glob.glob(os.path.join(directory, '*.py')):
            plugin_paths.append(plugin_path)
        for plugin_path in options.plugins:
            plugin_paths.append(plugin_path)
        for plugin_path in plugin_paths:
            abspath = os.path.abspath(plugin_path)
            module.load(abspath)
        if not options.config_file:
            log.error('No configuration file specified')
            exit(1)
        tasks = read_config(options.config_file)
        if not isinstance(tasks, list):
            raise ReadingError('Configuration file must be a list of tasks')
        if options.base_directory:
            base_directory = options.base_directory
        else:
            # default to directory of config file
            base_directory = os.path.dirname(os.path.realpath(options.config_file))
        os.chdir(base_directory)
        dispatcher = Dispatcher(base_directory)
        success = dispatcher.dispatch(tasks)
        if success:
            log.info('\n==> All tasks executed successfully')
        else:
            raise DispatchError('\n==> Some tasks were not executed successfully')
    except (ReadingError, DispatchError) as e:
        log.error('%s' % e)
        exit(1)
    except KeyboardInterrupt:
github anishathalye / dotbot / dotbot / cli.py View on Github external
tasks = read_config(options.config_file)
        if not isinstance(tasks, list):
            raise ReadingError('Configuration file must be a list of tasks')
        if options.base_directory:
            base_directory = options.base_directory
        else:
            # default to directory of config file
            base_directory = os.path.dirname(os.path.realpath(options.config_file))
        os.chdir(base_directory)
        dispatcher = Dispatcher(base_directory)
        success = dispatcher.dispatch(tasks)
        if success:
            log.info('\n==> All tasks executed successfully')
        else:
            raise DispatchError('\n==> Some tasks were not executed successfully')
    except (ReadingError, DispatchError) as e:
        log.error('%s' % e)
        exit(1)
    except KeyboardInterrupt:
        log.error('\n==> Operation aborted')
        exit(1)
github anishathalye / dotbot / dotbot / cli.py View on Github external
exit(1)
        tasks = read_config(options.config_file)
        if not isinstance(tasks, list):
            raise ReadingError('Configuration file must be a list of tasks')
        if options.base_directory:
            base_directory = options.base_directory
        else:
            # default to directory of config file
            base_directory = os.path.dirname(os.path.realpath(options.config_file))
        os.chdir(base_directory)
        dispatcher = Dispatcher(base_directory)
        success = dispatcher.dispatch(tasks)
        if success:
            log.info('\n==> All tasks executed successfully')
        else:
            raise DispatchError('\n==> Some tasks were not executed successfully')
    except (ReadingError, DispatchError) as e:
        log.error('%s' % e)
        exit(1)
    except KeyboardInterrupt:
        log.error('\n==> Operation aborted')
        exit(1)
github anishathalye / dotbot / dotbot / cli.py View on Github external
def main():
    log = Messenger()
    try:
        parser = ArgumentParser()
        add_options(parser)
        options = parser.parse_args()
        if options.version:
            print('Dotbot version %s (yaml: %s)' % (dotbot.__version__, yaml.__version__))
            exit(0)
        if options.super_quiet:
            log.set_level(Level.WARNING)
        if options.quiet:
            log.set_level(Level.INFO)
        if options.verbose:
            log.set_level(Level.DEBUG)
        if options.no_color:
            log.use_color(False)
        plugin_directories = list(options.plugin_dirs)
github anishathalye / dotbot / dotbot / cli.py View on Github external
def main():
    log = Messenger()
    try:
        parser = ArgumentParser()
        add_options(parser)
        options = parser.parse_args()
        if options.version:
            print('Dotbot version %s (yaml: %s)' % (dotbot.__version__, yaml.__version__))
            exit(0)
        if options.super_quiet:
            log.set_level(Level.WARNING)
        if options.quiet:
            log.set_level(Level.INFO)
        if options.verbose:
            log.set_level(Level.DEBUG)
        if options.no_color:
            log.use_color(False)
        plugin_directories = list(options.plugin_dirs)
        if not options.disable_built_in_plugins:
            from .plugins import Clean, Create, Link, Shell
        plugin_paths = []
        for directory in plugin_directories:
          for plugin_path in glob.glob(os.path.join(directory, '*.py')):
            plugin_paths.append(plugin_path)
        for plugin_path in options.plugins:
            plugin_paths.append(plugin_path)
        for plugin_path in plugin_paths:
            abspath = os.path.abspath(plugin_path)
            module.load(abspath)
github anishathalye / dotbot / dotbot / cli.py View on Github external
def main():
    log = Messenger()
    try:
        parser = ArgumentParser()
        add_options(parser)
        options = parser.parse_args()
        if options.version:
            print('Dotbot version %s (yaml: %s)' % (dotbot.__version__, yaml.__version__))
            exit(0)
        if options.super_quiet:
            log.set_level(Level.WARNING)
        if options.quiet:
            log.set_level(Level.INFO)
        if options.verbose:
            log.set_level(Level.DEBUG)
        if options.no_color:
            log.use_color(False)
        plugin_directories = list(options.plugin_dirs)
        if not options.disable_built_in_plugins:
            from .plugins import Clean, Create, Link, Shell
        plugin_paths = []
        for directory in plugin_directories:
          for plugin_path in glob.glob(os.path.join(directory, '*.py')):
            plugin_paths.append(plugin_path)
        for plugin_path in options.plugins:
            plugin_paths.append(plugin_path)
        for plugin_path in plugin_paths:
github anishathalye / dotbot / dotbot / messenger / messenger.py View on Github external
def _color(self, level):
        '''
        Get a color (terminal escape sequence) according to a level.
        '''
        if not self._should_use_color():
            return ''
        elif level < Level.DEBUG:
            return ''
        elif Level.DEBUG <= level < Level.LOWINFO:
            return Color.YELLOW
        elif Level.LOWINFO <= level < Level.INFO:
            return Color.BLUE
        elif Level.INFO <= level < Level.WARNING:
            return Color.GREEN
        elif Level.WARNING <= level < Level.ERROR:
            return Color.MAGENTA
        elif Level.ERROR <= level:
            return Color.RED
github anishathalye / dotbot / dotbot / messenger / messenger.py View on Github external
def _color(self, level):
        '''
        Get a color (terminal escape sequence) according to a level.
        '''
        if not self._should_use_color():
            return ''
        elif level < Level.DEBUG:
            return ''
        elif Level.DEBUG <= level < Level.LOWINFO:
            return Color.YELLOW
        elif Level.LOWINFO <= level < Level.INFO:
            return Color.BLUE
        elif Level.INFO <= level < Level.WARNING:
            return Color.GREEN
        elif Level.WARNING <= level < Level.ERROR:
            return Color.MAGENTA
        elif Level.ERROR <= level:
            return Color.RED
github anishathalye / dotbot / dotbot / messenger / messenger.py View on Github external
def debug(self, message):
        self.log(Level.DEBUG, message)
github anishathalye / dotbot / dotbot / messenger / messenger.py View on Github external
    def __init__(self, level = Level.LOWINFO):
        self.set_level(level)
        self.use_color(True)