env.ACCEPTABLE = 864000 env.msgid = 'intersphinx' #### Helper functions def download_file(file, url): cmd = ['curl', '-s', '--remote-time', url, '-o', file] with hide('running'): local(' '.join(cmd)) def file_timestamp(path): return os.stat(path)[8] #### Tasks env._ui = ad({'url': None, 'file': None}) @task def url(url): env._ui.url = url @task def file(file): env._ui.file = file @task def download(): f = env._ui.file s = env._ui.url if os.path.isfile(f):
from fabric.api import cd, local, task, abort, env, puts, parallel from fabric.utils import _AttributeDict as ad import os.path from docs_meta import get_conf, render_paths, get_branch, get_commit from urllib2 import urlopen _pub_hosts = ['www-c1.10gen.cc', 'www-c2.10gen.cc'] _stage_hosts = ['*****@*****.**'] env.rsync_options = ad() env.rsync_options.default = '-cqltz' env.rsync_options.recursive = None env.rsync_options.delete = None env.paths = render_paths('dict') def validate_branch(branch): if branch == 'override': pass elif branch is None: abort('must specify a branch') elif branch not in get_conf().git.branches.published: abort('must specify a published branch.') def rsync_options(recursive, delete): r = [env.rsync_options.default] if recursive is True: r.append('--recursive') if delete is True: r.append('--delete')
env.ACCEPTABLE = 864000 env.msgid = 'intersphinx' #### Helper functions def download_file(file, url): cmd = ['curl', '-s', '--remote-time', url, '-o', file] local(' '.join(cmd)) def file_timestamp(path): return os.stat(path)[8] #### Tasks env._ui = ad({'url': None, 'file': None}) @task def url(url): env._ui.url = url @task def file(file): env._ui.file = file @task def download(): f = env._ui.file s = env._ui.url if os.path.isfile(f):
import os.path from fabric.api import local, task, abort, env, puts from fabric.utils import _AttributeDict as ad from fabfile.utils.config import lazy_conf from fabfile.utils.project import edition_setup from fabfile.utils.serialization import ingest_yaml_list from fabfile.utils.structures import conf_from_list from fabfile.make import runner _pub_hosts = ['www-c1.10gen.cc', 'www-c2.10gen.cc'] _stage_hosts = ['*****@*****.**'] env.rsync_options = ad() env.rsync_options.default = '-cqltz' env.rsync_options.recursive = None env.rsync_options.delete = None def rsync_options(recursive, delete, environ): r = [env.rsync_options.default] if recursive is True: r.append('--recursive') if delete is True: r.append('--delete') if environ == 'production': r.extend(['--rsh="ssh"', '--rsync-path="sudo -u www rsync"'])