Skip to content

Commit

Permalink
Added issue search, some tool modification to get whatever was needed…
Browse files Browse the repository at this point in the history
… done
  • Loading branch information
David Witherspoon committed Jan 22, 2015
1 parent 5d26585 commit 7423e4c
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 69 deletions.
13 changes: 7 additions & 6 deletions src/main/java/io/dpwspoon/github/utils/TravisCIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ public static void addTravisCIBuildToAllJavaProjects(File workingDir) throws IOE
alreadyCompletedButPullRequestNotMerged.add("unpack-bower-dependency-maven-plugin");
alreadyCompletedButPullRequestNotMerged.add("snmp4j");
alreadyCompletedButPullRequestNotMerged.add("snmp4j.agent");
alreadyCompletedButPullRequestNotMerged.add("kaazing-client-javascript");



List<GHRepository> repos = DataReaper.getRepositoriesWithFile("/", "pom.xml");
List<GHRepository> repos = DataReaper.getRepositoriesWithFile("/", "Gruntfile.js");
for (GHRepository repo : repos) {
String mainRepoName = repo.getName();
if (!mainRepoName.contains("ios")) {
if (mainRepoName.contains("kaazing-")) {
if (!alreadyCompletedButPullRequestNotMerged.contains(mainRepoName) && !RepoUtils.hasFile(repo, "/", ".travis.yml")) {
GHRepository forkedRepo = repo.fork();
String branchName = "feature-travisci";
Expand Down Expand Up @@ -153,8 +152,10 @@ public static void addTravisFileTo(Git localRepo, File dir, String orgName, Stri
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");
travisWriter.write("language: node_js\n" + "node_js:\n" + " - \"0.10\\n" + "before_install:\n"
+ " - npm install -g bower\n" + " - npm install -g grunt-cli\n" + "script: grunt\n");
// travisWriter.write("language: Java\n" + "jdk:\n" + " - oraclejdk7\n" + " - openjdk7\n"
// + "script: mvn verify\n");
}
localRepo.add().addFilepattern(travisFileName).call();

Expand Down
140 changes: 140 additions & 0 deletions src/test/java/io/dpwspoon/github/utils/RepoUtilsTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package io.dpwspoon.github.utils;

import static io.dpwspoon.github.utils.GithubUtils.MY_GITHUB_USER_NAME;
import static io.dpwspoon.github.utils.RepoUtils.PUBLIC;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Ignore;
import org.junit.Test;
import org.kohsuke.github.GHIssueState;
import org.kohsuke.github.GHPullRequest;
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.PagedIterable;
import org.kohsuke.github.PagedIterator;

public class RepoUtilsTest {

Expand Down Expand Up @@ -111,4 +120,135 @@ public void printListOfReposInListAndPrivate() throws IOException {
r -> listOfRepos.contains(r.getName().replace("kaazing/", "")) && r.isPrivate());
}

@Test
public void findIssuesBasedOnSearch() throws IOException {
Consumer<GHRepository> consumer = new Consumer<GHRepository>() {

@Override
public void accept(GHRepository r) {
PagedIterable<GHPullRequest> open = r.listPullRequests(GHIssueState.OPEN);
PagedIterable<GHPullRequest> closed = r.listPullRequests(GHIssueState.CLOSED);
Integer find = listRepos(open.iterator());
if (find == null) {
find = listRepos(closed.iterator());
}
if (find != null) {
System.out.println("kaazing/" + r.getName() + "#" + find);
}

}

private Integer listRepos(PagedIterator<GHPullRequest> pagedIterator) {
while (pagedIterator.hasNext()) {
GHPullRequest pullRequest = pagedIterator.next();
String title = pullRequest.getTitle();
if (title.contains("travis.yml")) {
return pullRequest.getNumber();
}
}
return null;
}
};
RepoUtils.processRepositories("kaazing", PUBLIC, consumer);
}

@Test
public void printWhatIWant() {
List<String> list = new ArrayList<String>();
list.add("kaazing/netx#13");
list.add("kaazing/kaazing-client-javascript-util#7");
list.add("kaazing/qpid.jms.itest#1");
list.add("kaazing/code.quality#2");
list.add("kaazing/community#3");
list.add("kaazing/common#13");
list.add("kaazing/community.license#3");
list.add("kaazing/license-maven-plugin#6");
list.add("kaazing/kaazing-amqp-0-9-1-client-javascript#13");
list.add("kaazing/gateway.service.amqp#2");
list.add("kaazing/gateway.bridge#3");
list.add("kaazing/gateway.client.ios#6");
list.add("kaazing/gateway.client.ios.common#3");
list.add("kaazing/gateway.client.java.bridge#1");
list.add("kaazing/gateway.client.java.common#2");
list.add("kaazing/gateway.client.java#6");
list.add("kaazing/kaazing-client-javascript#11");
list.add("kaazing/kaazing-client-javascript-bridge#6");
list.add("kaazing/gateway.client.java.transport#2");
list.add("kaazing/kaazing-command-center#7");
list.add("kaazing/gateway.distribution#26");
list.add("kaazing/gateway.management#4");
list.add("kaazing/gateway.resource.address#3");
list.add("kaazing/gateway.resource.address.http#2");
list.add("kaazing/gateway.resource.address.httpx#2");
list.add("kaazing/gateway.resource.address.httpxdraft#2");
list.add("kaazing/gateway.resource.address.httpxe#1");
list.add("kaazing/gateway.resource.address.pipe#1");
list.add("kaazing/gateway.resource.address.rtmp#1");
list.add("kaazing/gateway.resource.address.sse#1");
list.add("kaazing/gateway.resource.address.ssl#1");
list.add("kaazing/gateway.resource.address.tcp#1");
list.add("kaazing/gateway.resource.address.udp#1");
list.add("kaazing/gateway.resource.address.ws#1");
list.add("kaazing/gateway.resource.address.wsdraft#1");
list.add("kaazing/gateway.resource.address.wse#1");
list.add("kaazing/gateway.resource.address.wsn#1");
list.add("kaazing/gateway.resource.address.wsr#1");
list.add("kaazing/gateway.resource.address.wsx#1");
list.add("kaazing/gateway.resource.address.wsxdraft#1");
list.add("kaazing/gateway.security#1");
list.add("kaazing/gateway.server#3");
list.add("kaazing/gateway.server.api#3");
list.add("kaazing/gateway.server.demo#1");
list.add("kaazing/gateway.server.spi#2");
list.add("kaazing/gateway.service#1");
list.add("kaazing/gateway.service.broadcast#1");
list.add("kaazing/gateway.service.echo#1");
list.add("kaazing/gateway.service.http.balancer#1");
list.add("kaazing/gateway.service.http.directory#4");
list.add("kaazing/gateway.service.proxy#1");
list.add("kaazing/gateway.service.update.check#3");
list.add("kaazing/gateway.service.update.check.management#2");
list.add("kaazing/gateway.test.ca#4");
list.add("kaazing/gateway.transport#1");
list.add("kaazing/gateway.transport.bio#2");
list.add("kaazing/gateway.transport.http#5");
list.add("kaazing/gateway.transport.nio#3");
list.add("kaazing/gateway.transport.pipe#1");
list.add("kaazing/gateway.transport.sse#1");
list.add("kaazing/gateway.transport.ssl#5");
list.add("kaazing/gateway.transport.ws#1");
list.add("kaazing/gateway.transport.wseb#4");
list.add("kaazing/gateway.transport.wsn#3");
list.add("kaazing/gateway.transport.wsr#1");
list.add("kaazing/gateway.truststore#1");
list.add("kaazing/gateway.util#1");
list.add("kaazing/mina.core#3");
list.add("kaazing/mina.netty#1");
list.add("kaazing/test.util#1");
list.add("kaazing/tools.wscat#1");
list.add("kaazing/version-properties-maven-plugin#3");
list.add("kaazing/grunt-stripbanner#2");
list.add("kaazing/gateway.client.java.demo#5");
list.add("kaazing/gateway.client.ios.demo#5");
list.add("kaazing/amqp.client.java#5");
list.add("kaazing/amqp.client.java.demo#4");
list.add("kaazing/truststore-maven-plugin#3");
list.add("kaazing/kaazing-client-javascript-demo#3");
list.add("kaazing/sigar.dist#6");
list.add("kaazing/unpack-bower-dependency-maven-plugin#2");
list.add("kaazing/snmp4j#4");
list.add("kaazing/snmp4j.agent#2");
for (String string : list) {
Pattern pattern = Pattern.compile("kaazing/(?<name>.*)#\\d+");
Matcher matcher = pattern.matcher(string);
matcher.matches();
System.out.print(string + " ");
string = matcher.group("name");
System.out
.println(String
.format("[![Build Status](https://travis-ci.org/kaazing/%s.svg?branch=develop)]"
+ "(https://travis-ci.org/kaazing/%s)", string, string));
}
}

}
63 changes: 0 additions & 63 deletions src/test/java/io/dpwspoon/github/utils/TestTravicCIUtils.java

This file was deleted.

0 comments on commit 7423e4c

Please sign in to comment.