示例#1
0
def autogen(num_posts=1):
    sites = [
        './octopress_site_1',
        './octopress_site_2',
        './octopress_site_3',
        './octopress_site_4',
    ]
    for site in sites:
        print genpost(gen_posts_dir="{}/source/_posts".format(site), num_posts=num_posts)

        sh.cd(site)
        print sh.rake('generate')
        print sh.rake('push')
        sh.cd("../")
示例#2
0
def rake(rakefile,
         debug=False,
         env=os.environ.copy(),
         out=print_stdout,
         err=print_stderr):
    """
    Runs rake with specified rakefile

    :param rakefile: Path to rakefile
    :param debug: Pass trace flag to rake
    :param env: Environment to pass to underlying sh call
    :param out: Function to process STDOUT for underlying sh call
    :param err: Function to process STDERR for underlying sh call
    :return: sh response object
    """
    kwargs = {
        '_env': env,
        '_out': out,
        '_err': err,
        'trace': debug,
        'rakefile': rakefile
    }

    if 'HOME' not in kwargs['_env']:
        kwargs['_env']['HOME'] = os.path.expanduser('~')

    return sh.rake(**kwargs)
示例#3
0
def rake(rakefile,
         debug=False,
         env=os.environ.copy(),
         out=print_stdout,
         err=print_stderr):
    """
    Runs rake with specified rakefile

    :param rakefile: Path to rakefile
    :param debug: Pass trace flag to rake
    :param env: Environment to pass to underlying sh call
    :param out: Function to process STDOUT for underlying sh call
    :param err: Function to process STDERR for underlying sh call
    :return: sh response object
    """
    kwargs = {'_env': env,
              '_out': out,
              '_err': err,
              'trace': debug,
              'rakefile': rakefile}

    if 'HOME' not in kwargs['_env']:
        kwargs['_env']['HOME'] = os.path.expanduser('~')

    return sh.rake(**kwargs)
示例#4
0
    def _rake(self,
              rakefile,
              debug=False,
              env=os.environ.copy(),
              out=LOG.info,
              err=LOG.error):
        """
        Executes rake against specified rakefile, and returns a :func:`sh`
        response object.

        :param rakefile: A string containing path to the rakefile.
        :param debug: An optional bool to toggle debug output.
        :param env: An optional environment to pass to underlying :func:`sh`
         call.
        :param out: An optional function to process STDOUT for underlying
         :func:`sh` call.
        :param err: An optional function to process STDERR for underlying
         :func:`sh` call.
        :return: :func:`sh` response object.
        """
        kwargs = {
            '_env': env,
            '_out': out,
            '_err': err,
            'trace': debug,
            'rakefile': rakefile
        }

        msg = 'Executing serverspec tests found in {}/.'.format(
            self._serverspec_dir)
        util.print_info(msg)

        return sh.rake(**kwargs)
示例#5
0
    def _rake(self,
              rakefile,
              debug=False,
              env=os.environ.copy(),
              out=LOG.info,
              err=LOG.error):
        """
        Runs rake with specified rakefile.

        :param rakefile: Path to rakefile
        :param debug: Pass trace flag to rake
        :param env: Environment to pass to underlying sh call
        :param out: Function to process STDOUT for underlying sh call
        :param err: Function to process STDERR for underlying sh call
        :return: sh response object
        """
        kwargs = {'_env': env,
                  '_out': out,
                  '_err': err,
                  'trace': debug,
                  'rakefile': rakefile}

        if 'HOME' not in kwargs['_env']:
            kwargs['_env']['HOME'] = os.path.expanduser('~')

        msg = 'Executing serverspec tests found in {}/.'.format(
            self._serverspec_dir)
        util.print_info(msg)

        return sh.rake(**kwargs)
示例#6
0
    def _rake(self, rakefile, debug=False, out=LOG.info, err=LOG.error):
        """
        Executes rake against specified rakefile, and returns a :func:`sh`
        response object.

        :param rakefile: A string containing path to the rakefile.
        :param debug: An optional bool to toggle debug output.
        :param out: An optional function to process STDOUT for underlying
         :func:`sh` call.
        :param err: An optional function to process STDERR for underlying
         :func:`sh` call.
        :return: :func:`sh` response object.
        """
        kwargs = {
            '_out': out,
            '_err': err,
            'trace': debug,
            'rakefile': rakefile
        }

        msg = 'Executing serverspec tests found in {}/.'.format(
            self._serverspec_dir)
        util.print_info(msg)

        return sh.rake(**kwargs)