Example #1
0
def watch():
    """Watch for changes to the markdown files, and build the book and the
    sample pdf upon each change."""
    handler = ShellCommandTrick(shell_command=MAKE_BOOK + " && " + MAKE_SAMPLE,
                                patterns=PATTERNS,
                                terminate_on_event=True)
    observer = Observer(timeout=TIMEOUT)
    observe_with(observer, handler, DIRECTORIES, RECURSIVE)
Example #2
0
def watch():
    """Renerate documentation when it changes."""

    # Start with a clean build
    call(['sphinx-build', '-b', 'html', '-E', 'docs', 'docs/_build/html'])

    handler = ShellCommandTrick(
        shell_command='sphinx-build -b html docs docs/_build/html',
        patterns=['*.rst', '*.py'],
        ignore_patterns=['_build/*'],
        ignore_directories=['.tox'],
        drop_during_process=True)
    observer = Observer()
    observe_with(observer, handler, pathnames=['.'], recursive=True)
Example #3
0
def watch():
    """Renerate documentation when it changes."""

    # Start with a clean build
    sphinx_build['-b', 'html', '-E', 'docs', 'docs/_build/html'] & FG

    handler = ShellCommandTrick(
        shell_command='sphinx-build -b html docs docs/_build/html',
        patterns=['*.rst', '*.py'],
        ignore_patterns=['_build/*'],
        ignore_directories=['.tox'],
        drop_during_process=True)
    observer = Observer()
    observe_with(observer, handler, pathnames=['.'], recursive=True)
Example #4
0
def watch(command, directories='.', patterns='*', ignore_patterns='', ignore_directories=False, wait_for_process=False, drop_during_process=False, timeout=5, recursive=True):
    """
    Subcommand to execute shell commands in response to file system events.
    :param args:
        Command line argument options.
    """
    from watchdog.watchmedo import parse_patterns, observe_with
    from watchdog.tricks import ShellCommandTrick
    from watchdog.observers import Observer

    patterns, ignore_patterns = parse_patterns(patterns, ignore_patterns)
    handler = ShellCommandTrick(shell_command=command,
                                patterns=patterns,
                                ignore_patterns=ignore_patterns,
                                ignore_directories=ignore_directories,
                                wait_for_process=wait_for_process,
                                drop_during_process=drop_during_process)
    observer = Observer(timeout=timeout)
    observe_with(observer, handler, directories, recursive)
Example #5
0
 def _watcher(args):
     from watchdog.observers import Observer 
     handler = CtagsTrick(filetypes=args.filetypes, ctags=args.ctags, rebuild=args.rebuild)
     observer = Observer(timeout=1.0)
     observe_with(observer, handler, ['.'], True) 
Example #6
0
 def _watcher(args):
     "Watch changes in less directory and auto-compile modified file to css"
     from watchdog.observers import Observer 
     handler = LessTrick(src_dir=args.LESS_DIR, dest_dir=args.CSS_DIR, compiler=args.lessc_path)
     observer = Observer(timeout=1.0)
     observe_with(observer, handler, [args.LESS_DIR], True)