Fetches a README from GitHub
@param  {String} repo URL of repo to fetch
512599
function fetchRepoREADME (repo) {
  request({
    uri: 'https://api.github.com/repos/' + repo + '/readme',
    headers: _.extend(headers, {

      // Get raw README content
      'Accept': 'application/vnd.github.VERSION.raw'
    })
  },
  function (error, response, body) {
    if (!error && response.statusCode === 200) {
      lintMarkdown(body, repo);
    } else {
      if (response.headers['x-ratelimit-remaining'] === '0') {
        getAuthToken();
      } else {
        console.log('README for https://github.com/' + repo.blue + ' not found.'.red);
        return;
      }
    }
  });
}
1254382
function (buildConfig) {
        var projectRoot = buildConfig.projectRoot;
        var packageFile = path.join(projectRoot, 'package.json');

        var url = require(packageFile).repository.url;
        var prefix = 'github.com/';

        return url.substring(url.indexOf(prefix) + prefix.length, url.lastIndexOf('.git'));
    }
800635
def fetch_pull_request_url(repo_slug, build_number, token)
      build_json = fetch_build(repo_slug, build_number, token)
      pull_requests = build_json[:pull_requests]
      return nil unless pull_requests.first
      pull_requests.first[:url]
    end
1357185
def download_repo(repo_url, destination, commit=None):
    '''
    '''
    command = "git clone %s %s" % (repo_url, destination)
    os.system(command)
    return destination
1350819
def from_url(cls, path):
        
        if os.path.isfile(path):
            with open(path) as fd:
                data = fd.read()
        else:
            try:
                response = urllib.urlopen(path)
                if response.code >= 300:
                    raise RuntimeError('Unable to load repo from %s' % path)

                data = response.read()
                response.close()
            except IOError:
                raise RuntimeError(
                    'Unable to load repo from %s (IO error)' % path
                )

        return cls(json.loads(data), path)
572537
function guessUserName(repo) {
  // extract the host
  const host = repo.match(/:\/\/([^/]+)/)[1];
  const hostClean = host.replace(/\./g, '_').toUpperCase();
  // e.g. GITHUB_COM_CREDENTIALS
  const envVar = process.env[`${hostClean}_CREDENTIALS`];
  if (envVar) {
    return envVar;
  }
  return process.env.PHOVEA_GITHUB_CREDENTIALS;
}
1301488
def fetch(self):
        """"""
        os.makedirs(os.path.dirname(self.cached_repo), exist_ok=True)
        if not os.path.exists(self.cached_repo):
            self._log.warning("Index not found, caching %s in %s", self.repo, self.cached_repo)
            git.clone(self.remote_url, self.cached_repo, checkout=True)
        else:
            self._log.debug("Index is cached")
            if self._are_local_and_remote_heads_different():
                self._log.info("Cached index is not up to date, pulling %s", self. repo)
                git.pull(self.cached_repo, self.remote_url)
        with open(os.path.join(self.cached_repo, self.INDEX_FILE), encoding="utf-8") as _in:
            self.contents = json.load(_in)
1114074
function packageVersion(repo) {
    var location = repo ? path.join(repo, 'package.json') : './package.json';
    var pack = require(location);
    return pack['version'];
}
1261316
def get_config(repo):
    
    files = get_files(repo)
    config = DEFAULT_CONFIG
    if "config.json" in files:
        # get the config file, parse JSON and merge it with the default config
        config_file = repo.get_file_contents('/config.json', ref="gh-pages")
        try:
            repo_config = json.loads(config_file.decoded_content.decode("utf-8"))
            config.update(repo_config)
        except ValueError:
            click.secho("WARNING: Unable to parse config file. Using defaults.", fg="yellow")
    return config
900385
def parse_readme(cls, readme_path: str = 'README.rst', encoding: str = 'utf-8') -> str:
        
        with HERE.joinpath(readme_path).open(encoding=encoding) as readme_file:
            long_description = readme_file.read()  # type: str

        if readme_path.endswith('.rst') and cls.download_url.startswith('https://github.com/'):
            base_url = '{}/blob/v{}/'.format(cls.download_url, cls.version)
            long_description = resolve_relative_rst_links(long_description, base_url)

        return long_description
36486
function downloadRepo(config, tmpFolder, callback) {

  console.log('Downloading repo...'.magenta);

  // Keep track if the request fails to prevent the continuation of the install
  var requestFailed = false;

  var repoUrl = 'http://server.webhook.com/';

  if(config.server) {
    if(config.server.indexOf('http://') !== 0) {
      config.server = config.server += 'http://';
    }

    if(config.server.indexOf(config.server.length - 1) !== '/') {
      config.server += '/';
    }

    repoUrl = config.server;
  }

  var repoRequest = request(repoUrl + 'download/?site=' + config.siteName + '&token=' + config.siteToken);

  repoRequest
    .on('response', function (response) {
      // If we fail, set it as failing and remove zip file
      if (response.statusCode !== 200) {
        requestFailed = true;
        fs.unlinkSync('repo.zip');
        callback(true);
      }
    })
    .pipe(fs.createWriteStream('repo.zip'))
    .on('close', function () {
      if (requestFailed) return;

      console.log('Extracting Files...'.magenta);
      // Unzip into temporary file
      var zip = new Zip('repo.zip');
      zip.extractAllTo(tmpFolder);
      fs.unlinkSync('repo.zip');
      callback(null, tmpFolder + '/' + fs.readdirSync(tmpFolder)[0]);
    });
}
266980
def repository(namespace, name, branch='master'):
    ''''''
    with TemporaryDirectory() as download_path:
        old_directory = str(pwd()).strip()
        try:
            git.clone('https://github.com/{0}/{1}.git'.format(namespace, name), download_path)
            cd(download_path)
            git.fetch('origin', branch)
            git.checkout(branch)
            yield (download_path, git('rev-parse', 'HEAD'), redis.Dict(key="{0}.{1}".format(namespace, name)))
        except ErrorReturnCode_128:
            mkdir(download_path)
            yield (None, None, None)
        cd(old_directory)
577154
function( path, cb ) {
        // Set the content path
        octofish.setContentPath( path );

        // Use the content path to retrieve content
        octofish.github.repos.getContent( octofish.config.contentOpts, function ( err, res ) {

            var data = null;

            // Handle any error
            if (err) {
                // Log the error - not a very useful log at the moment
                console.log( 'An error occured whilst getting content from github - this should be dealt with properly' );
                console.log( 'It is most likely a URL error with the path' );

                // Call the callback with a null value to denote an error
                cb( data );
                return;
            }

            // Decode the data before sending on to the callback
            // Check for decoding an image
            if ( octofish.config.contentOpts.path.match(/img/) ) {
                data = octofish.decodeGithubImageData( res.content );
            } else {
                data = octofish.decodeGithubData( res.content );
            }

            // If the content was collected successfully then call the callback and remember to pass in the data
            cb( data );
        });
    }
312474
def fetch():
    
    mir, r, slackpkg_last_date = mirror(), "", ""
    count, upgraded = 0, []
    if mir:
        tar = urlopen(mir)
        try:
            r = tar.read()
        except AttributeError:
            print("sun: error: can't read mirror")
    if os.path.isfile(var_lib_slackpkg + changelog_txt):
        slackpkg_last_date = read_file("{0}{1}".format(
            var_lib_slackpkg, changelog_txt)).split("\n", 1)[0].strip()
    else:
        return [count, upgraded]
    for line in r.splitlines():
        if slackpkg_last_date == line.strip():
            break
        if (line.endswith("z:  Upgraded.") or line.endswith("z:  Rebuilt.") or
                line.endswith("z:  Added.") or line.endswith("z:  Removed.")):
            upgraded.append(line.split("/")[-1])
            count += 1
        if (line.endswith("*:  Upgraded.") or line.endswith("*:  Rebuilt.") or
                line.endswith("*:  Added.") or line.endswith("*:  Removed.")):
            upgraded.append(line)
            count += 1
    return [count, upgraded]
867109
public function get_remote_api_readme( $git, $request ) {
		if ( ! $this->local_file_exists( 'readme.txt' ) ) {
			return false;
		}

		$response = isset( $this->response['readme'] ) ? $this->response['readme'] : false;

		// Set $response from local file if no update available.
		if ( ! $response && ! $this->can_update_repo( $this->type ) ) {
			$response = $this->get_local_info( $this->type, 'readme.txt' );
		}

		if ( ! $response ) {
			self::$method = 'readme';
			$response     = $this->api( $request );
			$response     = $this->decode_response( $git, $response );
		}

		if ( ! $response && ! is_wp_error( $response ) ) {
			$response          = new \stdClass();
			$response->message = 'No readme found';
		}

		if ( $this->validate_response( $response ) ) {
			return false;
		}

		if ( $response && ! isset( $this->response['readme'] ) ) {
			$parser   = new Readme_Parser( $response );
			$response = $parser->parse_data();
			$this->set_repo_cache( 'readme', $response );
		}

		$this->set_readme_info( $response );

		return true;
	}
1129503
function fetch(name, spec, options) {
  if (typeof spec === 'object' && options === undefined) {
    options = spec
    spec = undefined
  }
  spec = spec || '*'

  var p = url.parse(spec) || {}

  switch (p.protocol) {
    case 'http:':
    case 'https:':
      return exports.tarball(name, spec, options)
    case "git:":
    case "git+http:":
    case "git+https:":
    case "git+rsync:":
    case "git+ftp:":
    case "git+ssh:":
      return exports.git(name, spec, options)
    default:
      var result = new PassThrough()
      fs.stat(spec, function (err, stat) {
        if (err === null && stat.isDirectory()) {
          exports.local.dir(name, spec, options)
            .on('end', result.end.bind(result))
            .syphon(result)
        } else if (err === null && stat.isFile()) {
          exports.local.file(name, spec, options)
            .on('end', result.end.bind(result))
            .syphon(result)
        } else if (/^([^\/]+)\/([^\/#]+)(?:#(.+))?$/.test(spec)) {
          exports.github(name, spec, options)
            .on('end', result.end.bind(result))
            .syphon(result)
        } else {
          exports.npm(name, spec, options)
            .on('end', result.end.bind(result))
            .syphon(result)
        }
      })
      return result
  }
}
652377
function(repo, version, hash, meta, outDir) {

    var url, tempRepoDir, packageJSONData, self = this;

    if (meta.vPrefix) {
      version = 'v' + version;
    }

    // Automatically track and cleanup files at exit
    temp.track();

    url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.auth);

    return createTempDir().then(function(tempDir) {
      tempRepoDir = tempDir;
      return exportGitRepo(tempRepoDir, version, url, self.execOpt, self.options.shallowclone);
    }).then(function() {
      return readPackageJSON(tempRepoDir);
    }).then(function(data) {
      packageJSONData = data;
      return moveRepoToOutDir(tempRepoDir, outDir);
    }).then(function() {
      return packageJSONData;
    });
  }