use of org.kohsuke.github.GHContent in project Gargoyle by callakrsos.
the class GitTest method getGargoyleRepository.
@Test
public void getGargoyleRepository() throws IOException {
GitHub github = GitHub.connect();
GHUser user = github.getUser("callakrsos");
Map<String, GHRepository> repositories = user.getRepositories();
//Repository를 모두 출력
Iterator<Entry<String, GHRepository>> iterator = repositories.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, GHRepository> next = iterator.next();
System.out.println(next.getKey() + " - " + next.getValue().getName());
}
//Gargoyle Repository 정보 출력
GHRepository repository = user.getRepository("Gargoyle");
System.out.println(repository);
List<GHContent> directoryContent = repository.getDirectoryContent("/");
//루트 디렉토리 정보 출력
directoryContent.forEach(con -> {
System.out.println(String.format("Path : %s\t\t\tsize : %d\t\t\t\tUrl:%s ", con.getPath(), con.getSize(), con.getUrl()));
});
}
use of org.kohsuke.github.GHContent in project github-version-statistics by centic9.
the class BaseSearch method processResults.
protected void processResults(GitHub github, Multimap<String, String> versions, Iterable<GHContent> list) throws IOException {
for (GHContent match : list) {
final String htmlUrl = match.getHtmlUrl();
String repo = getNonForkRepository(github, htmlUrl);
if (repo == null) {
continue;
}
String str = readFileContent(match, htmlUrl, repo);
if (str == null) {
continue;
}
parseVersion(versions, htmlUrl, repo, str);
}
}
use of org.kohsuke.github.GHContent in project Gargoyle by callakrsos.
the class GitTest method readContent.
@Test
public void readContent() throws IOException {
GitHub github = GitHub.connect();
GHUser user = github.getUser("callakrsos");
//Gargoyle Repository 정보 출력
GHRepository repository = user.getRepository("Gargoyle");
System.out.println(repository);
GHContent fileContent = repository.getFileContent(".project", "master");
String string = fileContent.toString();
System.out.println(string);
String downloadUrl = fileContent.getDownloadUrl();
System.out.println(downloadUrl);
String gitUrl = fileContent.getGitUrl();
System.out.println(gitUrl);
try (BufferedReader br = new BufferedReader(new InputStreamReader(fileContent.read()))) {
String readLine = null;
while ((readLine = br.readLine()) != null) {
System.out.println(readLine);
}
}
}
use of org.kohsuke.github.GHContent in project nextprot-api by calipho-sib.
the class GitHubServiceImpl method getPage.
@Override
@Cacheable(value = "github-pages")
public String getPage(String folder, String page) {
String finalPage = page;
if ("news".equalsIgnoreCase(folder)) {
finalPage = getCorrespondingPageForNews(page);
}
try {
GitHub github = getGitHubConnection();
GHRepository repo = github.getRepository("calipho-sib/nextprot-docs");
GHContent content = null;
String extension = ".md";
if (folder.contains("json")) {
// if folder contains json
extension = ".json";
}
content = repo.getFileContent(folder + "/" + finalPage + extension, githubDocBranch);
return content.getContent();
} catch (IOException e) {
e.printStackTrace();
throw new NextProtException("Documentation not available, sorry for the inconvenience");
}
}
Aggregations