diff --git a/pom.xml b/pom.xml index ca3d6a7..1e9492e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ UTF-8 3.3.1.201403241930-r + 0.0.7 @@ -49,6 +50,26 @@ + + com.jcraft + jsch.agentproxy.jsch + ${jsch.agent.version} + + + com.jcraft + jsch.agentproxy.usocket-jna + ${jsch.agent.version} + + + com.jcraft + jsch.agentproxy.sshagent + ${jsch.agent.version} + + + org.apache.servicemix.bundles + org.apache.servicemix.bundles.jsch + 0.1.49_1 + diff --git a/src/main/java/io/dpwspoon/github/utils/DataReaper.java b/src/main/java/io/dpwspoon/github/utils/DataReaper.java index 483ecb8..cbe2133 100644 --- a/src/main/java/io/dpwspoon/github/utils/DataReaper.java +++ b/src/main/java/io/dpwspoon/github/utils/DataReaper.java @@ -1,11 +1,9 @@ package io.dpwspoon.github.utils; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.kohsuke.github.GHContent; import org.kohsuke.github.GHRepository; public class DataReaper { @@ -26,4 +24,21 @@ public static List getRepositoriesWithFile(String path, String nam }, r -> repositories.add(r)); return repositories; } + + public static List getRepositoriesWithOutFile(String path, String name) + throws IOException { + List repositories = new ArrayList(); + + RepoUtils.processRepositories("kaazing", + r -> { + try { + return !RepoUtils.hasFile(r, path, name); + } catch (IOException e) { + throw new RuntimeException( + "Could not determine if repo \"" + r.getName() + + "\" has a pom.xml", e); + } + }, r -> repositories.add(r)); + return repositories; + } } diff --git a/src/main/java/io/dpwspoon/github/utils/FileUtils.java b/src/main/java/io/dpwspoon/github/utils/FileUtils.java new file mode 100644 index 0000000..7fcf653 --- /dev/null +++ b/src/main/java/io/dpwspoon/github/utils/FileUtils.java @@ -0,0 +1,19 @@ +package io.dpwspoon.github.utils; + +import java.io.File; + +public final class FileUtils { + public static void deleteFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File f : files) { + if (f.isDirectory()) { + deleteFolder(f); + } else { + f.delete(); + } + } + } + folder.delete(); + } +} diff --git a/src/main/java/io/dpwspoon/github/utils/GithubUtils.java b/src/main/java/io/dpwspoon/github/utils/GithubUtils.java new file mode 100644 index 0000000..52efc2d --- /dev/null +++ b/src/main/java/io/dpwspoon/github/utils/GithubUtils.java @@ -0,0 +1,18 @@ +package io.dpwspoon.github.utils; + +import java.io.IOException; + +import org.kohsuke.github.GitHubBuilder; + +public final class GithubUtils { + + public static final String MY_GITHUB_USER_NAME; + + static { + try { + MY_GITHUB_USER_NAME = GitHubBuilder.fromCredentials().build().getMyself().getLogin(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/io/dpwspoon/github/utils/RepoUtils.java b/src/main/java/io/dpwspoon/github/utils/RepoUtils.java index 8222e17..6fcee69 100644 --- a/src/main/java/io/dpwspoon/github/utils/RepoUtils.java +++ b/src/main/java/io/dpwspoon/github/utils/RepoUtils.java @@ -34,21 +34,11 @@ public boolean test(GHRepository t) { } }; - public static final String MY_GITHUB_USER_NAME; - static { - try { - MY_GITHUB_USER_NAME = GitHubBuilder.fromCredentials().build() - .getMyself().getLogin(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - public static void processRepositories(String user, Predicate predicate, Consumer consumer) throws IOException { PagedIterable repositories; - if (MY_GITHUB_USER_NAME.equalsIgnoreCase(user)) { + if (GithubUtils.MY_GITHUB_USER_NAME.equalsIgnoreCase(user)) { repositories = GitHubBuilder.fromCredentials().build().getMyself() .listRepositories(); } else { diff --git a/src/main/java/io/dpwspoon/github/utils/TravisCIUtils.java b/src/main/java/io/dpwspoon/github/utils/TravisCIUtils.java index 95ba05f..cf21715 100644 --- a/src/main/java/io/dpwspoon/github/utils/TravisCIUtils.java +++ b/src/main/java/io/dpwspoon/github/utils/TravisCIUtils.java @@ -3,34 +3,218 @@ import io.dpwspoon.github.utils.egit.PropertyFileCredentialsProvider; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileWriter; import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; import java.util.List; +import java.util.Scanner; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.NoFilepatternException; import org.eclipse.jgit.api.errors.TransportException; -import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.CredentialsProvider; import org.kohsuke.github.GHRepository; public final class TravisCIUtils { - public static void addTravisCIBuildToAllJavaProjects(File workingDir) - throws IOException, InvalidRemoteException, TransportException, - GitAPIException { - List repos = DataReaper.getRepositoriesWithFile("/", - "pom.xml"); + public static void addTravisCIBuildToAllJavaProjects(File workingDir) throws IOException, InvalidRemoteException, + TransportException, GitAPIException { + + List alreadyCompletedButPullRequestNotMerged = new ArrayList(); + alreadyCompletedButPullRequestNotMerged.add("netx"); + alreadyCompletedButPullRequestNotMerged.add("qpid.jms.itest"); + alreadyCompletedButPullRequestNotMerged.add("code.quality"); + alreadyCompletedButPullRequestNotMerged.add("nuklei.amqp_1_0.jms"); + alreadyCompletedButPullRequestNotMerged.add("community"); + alreadyCompletedButPullRequestNotMerged.add("common"); + alreadyCompletedButPullRequestNotMerged.add("neoload.codec.jms"); + alreadyCompletedButPullRequestNotMerged.add("community.license"); + alreadyCompletedButPullRequestNotMerged.add("license-maven-plugin"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.amqp"); + alreadyCompletedButPullRequestNotMerged.add("gateway.bridge"); + alreadyCompletedButPullRequestNotMerged.add("gateway.client.java.bridge"); + alreadyCompletedButPullRequestNotMerged.add("gateway.client.java.common"); + alreadyCompletedButPullRequestNotMerged.add("gateway.client.java"); + alreadyCompletedButPullRequestNotMerged.add("gateway.client.java.transport"); + alreadyCompletedButPullRequestNotMerged.add("gateway.distribution"); + alreadyCompletedButPullRequestNotMerged.add("gateway.management"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.http"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.httpx"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.httpxdraft"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.httpxe"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.pipe"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.rtmp"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.sse"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.ssl"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.tcp"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.udp"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.ws"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wsdraft"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wse"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wsn"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wsr"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wsx"); + alreadyCompletedButPullRequestNotMerged.add("gateway.resource.address.wsxdraft"); + alreadyCompletedButPullRequestNotMerged.add("gateway.security"); + alreadyCompletedButPullRequestNotMerged.add("gateway.server"); + alreadyCompletedButPullRequestNotMerged.add("gateway.server.api"); + alreadyCompletedButPullRequestNotMerged.add("gateway.server.demo"); + alreadyCompletedButPullRequestNotMerged.add("gateway.server.spi"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.broadcast"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.echo"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.http.balancer"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.http.directory"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.proxy"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.update.check"); + alreadyCompletedButPullRequestNotMerged.add("gateway.service.update.check.management"); + alreadyCompletedButPullRequestNotMerged.add("gateway.test.ca"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.bio"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.http"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.nio"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.pipe"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.sse"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.ssl"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.ws"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.wseb"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.wsn"); + alreadyCompletedButPullRequestNotMerged.add("gateway.transport.wsr"); + alreadyCompletedButPullRequestNotMerged.add("gateway.truststore"); + alreadyCompletedButPullRequestNotMerged.add("gateway.util"); + alreadyCompletedButPullRequestNotMerged.add("mina.core"); + alreadyCompletedButPullRequestNotMerged.add("mina.netty"); + alreadyCompletedButPullRequestNotMerged.add("test.util"); + alreadyCompletedButPullRequestNotMerged.add("tools.wscat"); + alreadyCompletedButPullRequestNotMerged.add("version-properties-maven-plugin"); + alreadyCompletedButPullRequestNotMerged.add("gateway.client.java.demo"); + alreadyCompletedButPullRequestNotMerged.add("amqp.client.java"); + alreadyCompletedButPullRequestNotMerged.add("amqp.client.java.demo"); + alreadyCompletedButPullRequestNotMerged.add("truststore-maven-plugin"); + alreadyCompletedButPullRequestNotMerged.add("sigar.dist"); + alreadyCompletedButPullRequestNotMerged.add("unpack-bower-dependency-maven-plugin"); + alreadyCompletedButPullRequestNotMerged.add("snmp4j"); + alreadyCompletedButPullRequestNotMerged.add("snmp4j.agent"); + + + + List repos = DataReaper.getRepositoriesWithFile("/", "pom.xml"); for (GHRepository repo : repos) { - if (!RepoUtils.hasFile(repo, "/", ".travis.yml")) { - GHRepository forkedRepo = repo.fork(); - String url = forkedRepo.getUrl(); - File directory = new File("workingDir", forkedRepo.getName()); - CredentialsProvider credentialsProvider = new PropertyFileCredentialsProvider(); - Repository localRepo = Git.cloneRepository().setCredentialsProvider(credentialsProvider).setDirectory(directory) - .setURI(url).call().getRepository(); + String mainRepoName = repo.getName(); + if (!mainRepoName.contains("ios")) { + if (!alreadyCompletedButPullRequestNotMerged.contains(mainRepoName) && !RepoUtils.hasFile(repo, "/", ".travis.yml")) { + GHRepository forkedRepo = repo.fork(); + String branchName = "feature-travisci"; + String repoName = forkedRepo.getName(); + addTravisFileToRepo(forkedRepo.getUrl(), branchName, repo.getOwner().getLogin(), repoName, + workingDir); + System.out.println("Added Repo: " + mainRepoName); + repo.createPullRequest("Added .travis.yml and badge to README.md", GithubUtils.MY_GITHUB_USER_NAME + + ":" + branchName, repo.getMasterBranch(), ""); + } + } else { + System.out.println("ignoring ios repo: " + mainRepoName); + } + } + } + + private static final CredentialsProvider credentialsProvider = new PropertyFileCredentialsProvider(); + + public static void addTravisFileToRepo(final String uri, final String branchName, final String orgName, + final String repoName, File workingDir) throws IOException, InvalidRemoteException, TransportException, + GitAPIException { + File directory = new File(workingDir, repoName); + Git localRepo = null; + for (int trys = 0; true; trys++) { + try { + localRepo = Git.cloneRepository().setCredentialsProvider(credentialsProvider).setDirectory(directory) + .setURI(uri).call(); + break; + } catch (TransportException e) { + // sporadic failure + FileUtils.deleteFolder(directory); + if (trys > 3) { + throw e; + } + } + } + localRepo.checkout().setCreateBranch(true).setName(branchName).call(); + addTravisFileTo(localRepo, directory, orgName, repoName); + localRepo.commit().setAll(true).setMessage("Added .travis.yml and badge to README.md").call(); + localRepo.push().setCredentialsProvider(credentialsProvider).call(); + } + + public static void addTravisFileTo(Git localRepo, File dir, String orgName, String repoName) throws IOException, + NoFilepatternException, GitAPIException { + String travisFileName = ".travis.yml"; + try (FileWriter travisWriter = new FileWriter(new File(dir, travisFileName))) { + travisWriter.write("language: Java\n" + "jdk:\n" + " - oraclejdk7\n" + " - openjdk7\n" + + "script: mvn verify\n"); + } + localRepo.add().addFilepattern(travisFileName).call(); + + String readmeFileName = "README.md"; + File readme = new File(dir, readmeFileName); + if (readme.exists()) { + + String TEXT_TO_ADD = "[![Build Status][build-status-image]][build-status]\n\n" + + String.format("[build-status-image]: https://travis-ci.org/%s/%s.svg?branch=develop\n", orgName, + repoName) + + String.format("[build-status]: https://travis-ci.org/%s/%s\n", orgName, repoName); + + List fileLines = new ArrayList(); + Scanner scanner = null; + try { + scanner = new Scanner(readme); + boolean linesAdded = false; + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + fileLines.add(line); + if (fileLines.size() == 2) { + linesAdded = true; + fileLines.add(TEXT_TO_ADD); + } + } + if (!linesAdded) { + fileLines.add(TEXT_TO_ADD); + } + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + if (scanner != null) { + scanner.close(); + } + } + + PrintWriter pw = null; + try { + pw = new PrintWriter(readme); + for (String line : fileLines) { + pw.println(line); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + if (pw != null) { + pw.close(); + } + } + } else { + try (FileWriter readmeWriter = new FileWriter(readme)) { + readmeWriter.write("#" + repoName + "\n" + "[![Build Status][build-status-image]][build-status]\n\n"); + readmeWriter.write(String.format( + "[build-status-image]: https://travis-ci.org/%s/%s.svg?branch=develop\n", orgName, repoName)); + readmeWriter.write(String.format("[build-status]: https://travis-ci.org/%s/%s", orgName, repoName)); + readmeWriter.write("\n"); } + localRepo.add().addFilepattern(readmeFileName).call(); } } } diff --git a/src/main/java/io/dpwspoon/github/utils/egit/PropertyFileCredentialsProvider.java b/src/main/java/io/dpwspoon/github/utils/egit/PropertyFileCredentialsProvider.java index 032fec4..72499b6 100644 --- a/src/main/java/io/dpwspoon/github/utils/egit/PropertyFileCredentialsProvider.java +++ b/src/main/java/io/dpwspoon/github/utils/egit/PropertyFileCredentialsProvider.java @@ -37,7 +37,6 @@ public class PropertyFileCredentialsProvider extends } public PropertyFileCredentialsProvider() { - super(USERNAME, PASSWORD); } diff --git a/src/test/java/io/dpwspoon/github/utils/DataReaperTest.java b/src/test/java/io/dpwspoon/github/utils/DataReaperTest.java index ab7da74..67c2726 100644 --- a/src/test/java/io/dpwspoon/github/utils/DataReaperTest.java +++ b/src/test/java/io/dpwspoon/github/utils/DataReaperTest.java @@ -3,16 +3,27 @@ import java.io.IOException; import java.util.List; +import org.junit.Ignore; import org.junit.Test; import org.kohsuke.github.GHRepository; public class DataReaperTest { @Test - public void printReposWithPomOnMainBranchViaGeneric() throws IOException{ + @Ignore + public void printReposWithPomOnMainBranch() throws IOException{ List repos = DataReaper.getRepositoriesWithFile("/", "pom.xml"); for(GHRepository repo: repos){ System.out.println(repo.getName()); } } + + @Test + public void printReposWithoutREADMEOnMainBranch() throws IOException{ + List repos = DataReaper.getRepositoriesWithOutFile("/", "README.md"); + for(GHRepository repo: repos){ + System.out.println(repo.getName()); + } + } + } diff --git a/src/test/java/io/dpwspoon/github/utils/RepoUtilsTest.java b/src/test/java/io/dpwspoon/github/utils/RepoUtilsTest.java index c5b7376..54f5063 100644 --- a/src/test/java/io/dpwspoon/github/utils/RepoUtilsTest.java +++ b/src/test/java/io/dpwspoon/github/utils/RepoUtilsTest.java @@ -3,14 +3,112 @@ import static io.dpwspoon.github.utils.RepoUtils.PUBLIC; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.Ignore; import org.junit.Test; public class RepoUtilsTest { + List listOfRepos = new ArrayList(); + + public RepoUtilsTest() { + listOfRepos.add("netx"); + listOfRepos.add("qpid.jms.itest"); + listOfRepos.add("code.quality"); + listOfRepos.add("nuklei.amqp_1_0.jms"); + listOfRepos.add("community"); + listOfRepos.add("common"); + listOfRepos.add("neoload.codec.jms"); + listOfRepos.add("community.license"); + listOfRepos.add("license-maven-plugin"); + listOfRepos.add("gateway.service.amqp"); + listOfRepos.add("gateway.bridge"); + listOfRepos.add("gateway.client.java.bridge"); + listOfRepos.add("gateway.client.java.common"); + listOfRepos.add("gateway.client.java"); + listOfRepos.add("gateway.client.java.transport"); + listOfRepos.add("gateway.distribution"); + listOfRepos.add("gateway.management"); + listOfRepos.add("gateway.resource.address"); + listOfRepos.add("gateway.resource.address.http"); + listOfRepos.add("gateway.resource.address.httpx"); + listOfRepos.add("gateway.resource.address.httpxdraft"); + listOfRepos.add("gateway.resource.address.httpxe"); + listOfRepos.add("gateway.resource.address.pipe"); + listOfRepos.add("gateway.resource.address.rtmp"); + listOfRepos.add("gateway.resource.address.sse"); + listOfRepos.add("gateway.resource.address.ssl"); + listOfRepos.add("gateway.resource.address.tcp"); + listOfRepos.add("gateway.resource.address.udp"); + listOfRepos.add("gateway.resource.address.ws"); + listOfRepos.add("gateway.resource.address.wsdraft"); + listOfRepos.add("gateway.resource.address.wse"); + listOfRepos.add("gateway.resource.address.wsn"); + listOfRepos.add("gateway.resource.address.wsr"); + listOfRepos.add("gateway.resource.address.wsx"); + listOfRepos.add("gateway.resource.address.wsxdraft"); + listOfRepos.add("gateway.security"); + listOfRepos.add("gateway.server"); + listOfRepos.add("gateway.server.api"); + listOfRepos.add("gateway.server.demo"); + listOfRepos.add("gateway.server.spi"); + listOfRepos.add("gateway.service"); + listOfRepos.add("gateway.service.broadcast"); + listOfRepos.add("gateway.service.echo"); + listOfRepos.add("gateway.service.http.balancer"); + listOfRepos.add("gateway.service.http.directory"); + listOfRepos.add("gateway.service.proxy"); + listOfRepos.add("gateway.service.update.check"); + listOfRepos.add("gateway.service.update.check.management"); + listOfRepos.add("gateway.test.ca"); + listOfRepos.add("gateway.transport"); + listOfRepos.add("gateway.transport.bio"); + listOfRepos.add("gateway.transport.http"); + listOfRepos.add("gateway.transport.nio"); + listOfRepos.add("gateway.transport.pipe"); + listOfRepos.add("gateway.transport.sse"); + listOfRepos.add("gateway.transport.ssl"); + listOfRepos.add("gateway.transport.ws"); + listOfRepos.add("gateway.transport.wseb"); + listOfRepos.add("gateway.transport.wsn"); + listOfRepos.add("gateway.transport.wsr"); + listOfRepos.add("gateway.truststore"); + listOfRepos.add("gateway.util"); + listOfRepos.add("mina.core"); + listOfRepos.add("mina.netty"); + listOfRepos.add("test.util"); + listOfRepos.add("tools.wscat"); + listOfRepos.add("version-properties-maven-plugin"); + listOfRepos.add("gateway.client.java.demo"); + listOfRepos.add("amqp.client.java"); + listOfRepos.add("amqp.client.java.demo"); + listOfRepos.add("truststore-maven-plugin"); + listOfRepos.add("sigar.dist"); + listOfRepos.add("unpack-bower-dependency-maven-plugin"); + listOfRepos.add("snmp4j"); + listOfRepos.add("snmp4j.agent"); + } + @Test + @Ignore public void shouldPrintMyRepos() throws IOException { RepoUtils.printListOfRepos("dpwspoon", PUBLIC); } + @Test + @Ignore + public void printListOfReposNotInListAndIsPublic() throws IOException { + RepoUtils.printListOfRepos("kaazing", + r -> !listOfRepos.contains(r.getName().replace("kaazing/", "")) && !r.isPrivate()); + } + + @Test + @Ignore + public void printListOfReposInListAndPrivate() throws IOException { + RepoUtils.printListOfRepos("kaazing", + r -> listOfRepos.contains(r.getName().replace("kaazing/", "")) && r.isPrivate()); + } + } diff --git a/src/test/java/io/dpwspoon/github/utils/TestTravicCIUtils.java b/src/test/java/io/dpwspoon/github/utils/TestTravicCIUtils.java new file mode 100644 index 0000000..2bbce23 --- /dev/null +++ b/src/test/java/io/dpwspoon/github/utils/TestTravicCIUtils.java @@ -0,0 +1,63 @@ +package io.dpwspoon.github.utils; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.TransportException; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +public class TestTravicCIUtils { + + public File workingDir; + + @Before + public void before() { + workingDir = new File("target/workingdir"); + if (workingDir.exists()) { + deleteFolder(workingDir); + } + workingDir.mkdirs(); + } + + @Test + @Ignore + public void testTravisCIUtilsAddTravisFileToRepoWithOutREADME() throws InvalidRemoteException, TransportException, + IOException, GitAPIException { + TravisCIUtils.addTravisFileToRepo("https://github.com/dpwspoon/github.utils", "feature-travisci", "dpwspoon", + "github.utils", workingDir); + // workingDir.mkdirs(); + // TravisCIUtils.addTravisCIBuildToAllJavaProjects(workingDir); + } + + @Test + @Ignore + public void testTravisCIUtilsAddTravisFileToRepoWithREADME() throws InvalidRemoteException, TransportException, + IOException, GitAPIException { + TravisCIUtils.addTravisFileToRepo("https://github.com/kaazing/gateway.distribution", "feature-travisci", + "kaazing", "gateway.distribution", workingDir); + } + + @Test + public void testAddTravisCIToProjs() throws InvalidRemoteException, TransportException, IOException, + GitAPIException { + TravisCIUtils.addTravisCIBuildToAllJavaProjects(workingDir); + } + + public static void deleteFolder(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + for (File f : files) { + if (f.isDirectory()) { + deleteFolder(f); + } else { + f.delete(); + } + } + } + folder.delete(); + } +}