Create a local mirror of one or more resources.
978824
def fetch(opts):
    
    resources = _load(opts.resources, opts.output_dir)
    if opts.all:
        opts.resource_names = ALL
    reporthook = None if opts.quiet else lambda name: print('Fetching {}...'.format(name))
    if opts.verbose:
        backend.VERBOSE = True
    _fetch(resources, opts.resource_names, opts.mirror_url, opts.force, reporthook)
    return verify(opts)
765624
def link(self, srcdir, duplicate):
        """"""
        self.srcdir = srcdir
        self.duplicate = duplicate
        self.__clearRepositoryCache(duplicate)
        srcdir.variant_dirs.append(self)
760885
def deploy_dotfiles(self, dotfiles):
        """"""
        if self.args.server:
            return self.deploy_remote(dotfiles)
        else:
            return self.deploy_local(dotfiles)
265398
def deploy_local(self, dotfiles, target_root=None):
        """"""
        if target_root is None:
            target_root = self.args.path

        for source_path, target_path in dotfiles.items():
            source_path = path.join(self.source, source_path)
            target_path = path.join(target_root, target_path)

            if path.isfile(target_path) or path.islink(target_path):
                self.log.debug('Removing existing file at %s', target_path)
                os.unlink(target_path)

            elif path.isdir(target_path):
                self.log.debug('Removing existing dir at %s', target_path)
                shutil.rmtree(target_path)

            parent_dir = path.dirname(target_path)
            if not path.isdir(parent_dir):
                self.log.debug('Creating parent dir %s', parent_dir)
                os.makedirs(parent_dir)

            if self.args.copy:
                if path.isdir(source_path):
                    self.log.debug('Copying file %s to %s',
                                   source_path, target_path)
                    shutil.copytree(source_path, target_path)
                else:
                    self.log.debug('Copying dir %s to %s',
                                   source_path, target_path)
                    shutil.copy(source_path, target_path)

            else:
                self.log.debug('Symlinking %s -> %s', target_path, source_path)
                os.symlink(source_path, target_path)
1028719
def local_async(self, *args, **kwargs):
        '''
        
        '''
        local = salt.client.get_local_client(mopts=self.opts)
        ret = local.run_job(*args, **kwargs)
        return ret
1316297
def create(self, resource_id=None, attributes=None):
        

        return self.proxy.create(resource_id=resource_id, attributes=attributes)
666737
def bind(self, instance):
        

        p = self.clone()
        p.instance = weakref.ref(instance)
        return p
769614
def clone(self):
        
        return Monitor(org=self.org, app=self.app, env=self.env)
633851
def _mirror_groups_from_stormpath(self):
        """"""
        APPLICATION = get_application()
        sp_groups = [g.name for g in APPLICATION.groups]
        missing_from_db, missing_from_sp = self._get_group_difference(sp_groups)

        if missing_from_db:
            groups_to_create = []

            for g_name in missing_from_db:
                groups_to_create.append(Group(name=g_name))

            Group.objects.bulk_create(groups_to_create)
316756
def replicate_from(other_db, continuous = false, create_target = false, doc_ids = nil)
      replicate(other_db, continuous, :target => name, :create_target => create_target, :doc_ids => doc_ids)
    end
69967
def clone(self, *args, **kwargs):
        
        return self._client.clone_scope(*args, source_scope=self, **kwargs)
546766
def _add_remote_resources(resources):
    
    out = copy.deepcopy(resources)
    for prog, info in resources.items():
        for key, val in info.items():
            if key == "jar" and objectstore.is_remote(val):
                store_dir = utils.safe_makedir(os.path.join(os.getcwd(), "inputs", "jars", prog))
                fname = objectstore.download(val, store_dir, store_dir)
                version_file = os.path.join(store_dir, "version.txt")
                if not utils.file_exists(version_file):
                    version = install.get_gatk_jar_version(prog, fname)
                    with open(version_file, "w") as out_handle:
                        out_handle.write(version)
                else:
                    with open(version_file) as in_handle:
                        version = in_handle.read().strip()
                del out[prog][key]
                out[prog]["dir"] = store_dir
                out[prog]["version"] = version
    return out
885504
def create_mirror_settings(repo_url):
    
    cwd = os.getcwd()
    settings_path = os.path.join(cwd, "settings.xml")

    settings_file = None
    try:
        settings_file = open(settings_path, "w")
        settings_file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
        settings_file.write('<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"\n')
        settings_file.write('          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n')
        settings_file.write('          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">\n')
        settings_file.write('<mirrors>\n')
        settings_file.write('    <mirror>\n')
        settings_file.write('      <id>repo-mirror</id>\n')
        settings_file.write('        <url>%s</url>\n' % repo_url)
        settings_file.write('      <mirrorOf>*</mirrorOf>\n')
        settings_file.write('    </mirror>\n')
        settings_file.write('  </mirrors>\n')
        settings_file.write('</settings>\n')
    finally:
        if settings_file:
            settings_file.close()

    return settings_path
965773
def _prepare_resources(self, variables, overrides=None):
        """"""

        if overrides is None:
            overrides = {}

        res_map = {}
        own_map = {}

        for decl in self.resources.values():
            resource = overrides.get(decl.name)

            if resource is None:
                args = _complete_parameters(decl.args, variables)
                resource = decl.type(args)
                own_map[decl.name] = resource

            if decl.autocreate:
                resource.open()

            res_map[decl.name] = resource

        return res_map, own_map
659693
function local(rootFolder) {
    // Construct name to remote id map
    const remote = path.join(rootFolder, constants.META_DIR, constants.META_REMOTE);
    const remoteSource = fs.readJsonSync(remote, 'utf8');
    const destination = constants.META_LOCAL;
    return pack(rootFolder, destination);
}
437302
def mirror(self, tables, dest_url):
        
        from mirror import mirror
        return mirror(self, tables, dest_url)
275832
def merge_files(configuration, locale, fail_if_missing=True):
    
    for target, sources in configuration.generate_merge.items():
        merge(configuration, locale, target, sources, fail_if_missing)