當前位置: 首頁>>代碼示例>>Java>>正文


Java GHRepository.delete方法代碼示例

本文整理匯總了Java中org.kohsuke.github.GHRepository.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java GHRepository.delete方法的具體用法?Java GHRepository.delete怎麽用?Java GHRepository.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kohsuke.github.GHRepository的用法示例。


在下文中一共展示了GHRepository.delete方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteRepository

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void deleteRepository(final String repositoryName) throws IllegalArgumentException {
    if (repositoryName == null) {
        throw new IllegalArgumentException("repositoryName must be specified");
    }
    try {
        final GHRepository repo = delegate.getRepository(repositoryName);
        log.fine("Deleting repo at " + repo.gitHttpTransportUrl());
        repo.delete();
    } catch (final GHFileNotFoundException ghe) {
        log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ghe);
        throw new NoSuchRepositoryException("Could not remove repository "
                                                    + repositoryName + " because it could not be found.");
    } catch (final IOException ioe) {
        log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ioe);
        throw new RuntimeException("Could not remove " + repositoryName, ioe);
    }
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:22,代碼來源:KohsukeGitHubServiceImpl.java

示例2: deleteRepository

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void deleteRepository(final String repositoryName) throws IllegalArgumentException {
    if (repositoryName == null) {
        throw new IllegalArgumentException("repositoryName must be specified");
    }
    try {
        final GHRepository repo = delegate.getRepository(repositoryName);
        log.fine("Deleting repo at " + repo.gitHttpTransportUrl());
        repo.delete();
    } catch (final IOException ioe) {
        log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ioe);
        // Check for repo not found (this is how Kohsuke Java Client reports the error)
        if (isRepoNotFound(ioe)) {
            throw new NoSuchRepositoryException("Could not remove repository "
                                                        + repositoryName + " because it could not be found.");
        }
        throw new RuntimeException("Could not remove " + repositoryName, ioe);
    }
}
 
開發者ID:fabric8-launcher,項目名稱:launchpad-missioncontrol,代碼行數:23,代碼來源:KohsukeGitHubServiceImpl.java

示例3: deleteRepository

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
 * ɾ��ָ����repository
 * @param strRepoName Ҫɾ����github����
 * @return void
 */
public void deleteRepository(String strRepoName){
	GitHub github;
	GHRepository repo;
	try {
		System.out.println("Delete repo started!\t"+strRepoName);
		github = GitHub.connectToEnterprise(getApiUrl(), getUserId(), getPassword());
		
		repo = github.getRepository(strRepoName);
		repo.delete();

		System.out.println("Delete repo finished!");

	} catch (IOException e) {
		// TODO Auto-generated catch block
		errHandle(e.getMessage());
	}
	bFinished = true;
}
 
開發者ID:appbank2020,項目名稱:GitRobot,代碼行數:24,代碼來源:GitRobot.java

示例4: removeRepo

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
public synchronized static void removeRepo(String owner, String repoName) throws KaramelException {

    try {
      GitHub gitHub = GitHub.connectUsingPassword(GithubApi.getUser(), GithubApi.getPassword());
      if (!gitHub.isCredentialValid()) {
        throw new KaramelException("Invalid GitHub credentials");
      }
      GHRepository repo = null;
      if (owner.compareToIgnoreCase(GithubApi.getUser()) != 0) {
        GHOrganization org = gitHub.getOrganization(owner);
        repo = org.getRepository(repoName);
      } else {
        repo = gitHub.getRepository(owner + "/" + repoName);
      }
      repo.delete();

    } catch (IOException ex) {
      throw new KaramelException("Problem authenticating with gihub-api when trying to remove a repository");
    }
  }
 
開發者ID:karamelchef,項目名稱:karamel,代碼行數:21,代碼來源:GithubApi.java

示例5: deleteRepos

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void deleteRepos(List<String> lstReposToDelete) throws IOException {
	GitHub github = GitHub.connect();
	GHMyself me = github.getMyself();
	PagedIterable<GHRepository> lstRepos = me.listRepositories();
	int cntDeleted = 0;
	for (GHRepository repo : lstRepos) {
		String name = repo.getName();
		if (lstReposToDelete.contains(name)) {
			repo.delete();
			cntDeleted++;
			System.out.format("Deleted: %s\n", name);
		}
	}
	System.out.format("That's %d repositories deleted!\n",
			cntDeleted);
}
 
開發者ID:payne,項目名稱:github_cleaner,代碼行數:17,代碼來源:MainCleanup.java

示例6: checkAndDelete

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private static Exception checkAndDelete(GHRepository repo) {
    log.info("deleting {}", repo.getFullName());
    try {
        repo.delete();
    } catch (Exception e) {
        return e;
    }
    return null;
}
 
開發者ID:salesforce,項目名稱:dockerfile-image-update,代碼行數:10,代碼來源:TestCommon.java

示例7: run

import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void run() throws IOException {
	GitHub github = GitHub.connect();
	Map<String, GHOrganization> orgs = github.getMyOrganizations();
	System.out.println(orgs);
	GHMyself me = github.getMyself();
	PagedIterable<GHRepository> lstRepos = me.listRepositories();
	// TODO:mgp: Figure out what I am missing here.
	int counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable = 0;
	GHRepository repoToDelete = null;
	PrintWriter outCloneList = new PrintWriter("clone_these.sh");
	PrintWriter outRepoList = new PrintWriter("repo_list.txt");
	for (GHRepository repo : lstRepos) {
		String name = repo.getName();
		Date pushedAt = repo.getPushedAt();
		String readOnlyUrl = repo.getGitTransportUrl();
		outRepoList.format("%s\n", name);
		outCloneList.println(readOnlyUrl);
		counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable++;
		if (name.equals("c-style")) {
			repoToDelete = repo;
			System.out.println("Well?");
		}
	}
	outCloneList.close();
	outRepoList.close();
	System.out.format("That's %d repositories!\n",
			counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable);
	if (null != repoToDelete) {
		repoToDelete.delete();
	}
}
 
開發者ID:payne,項目名稱:github_cleaner,代碼行數:32,代碼來源:Main.java


注:本文中的org.kohsuke.github.GHRepository.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。