Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Commits.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import java.util.ArrayList;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* This class is responsible for keepign track of the commit data for a given repo.
* Used in the GithubScraper class primarily.
Expand Down Expand Up @@ -97,6 +100,26 @@ public int numCommits() {
return commits.size();
}

public void saveToFile(String repo) {
String[] r = repo.split("/");
repo = r[r.length-1];
String data = getGeneral();
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(repo + "-Commits.txt"));
writer.write(data);

System.out.println("Saved commits to Commits.txt");
} catch ( IOException e) {
} finally {
try {
if ( writer != null)
writer.close( );
} catch ( IOException e) {
}
}
}

// == private methods ==
private boolean isInList(ArrayList<String> list, String keyword) {

Expand Down
36 changes: 36 additions & 0 deletions GDET-Four-Musketeers-Commits.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Commits (20):
--------------
User: "patrickbeekman"
Number of Commits: 5
Messages:
>"added more tests to check for correct functionality in the GithubScraper class."
>"Merge branch 'master' into test-getting-objects"
>"rewrote tests with the testing class with the new stuff."
>"added comments as well as changed the function to return instead of print."
>"able to curl a request to the github api."
-------------------------------
User: "carnsds7"
Number of Commits: 6
Messages:
>"Made it possible to get general data from gitobjects"
>"Added commit functionality to get the general data"
>"Started extension and abstraction of classes"
>"Able to see commit data now"
>"Included the org.json.jar file and attempted to parse the json from curl request"
>"Merge pull request #13 from CompassSoftware/GithubScraper\n\nGitHub scraper"
-------------------------------
User: "mcgalliarder"
Number of Commits: 7
Messages:
>"Merge pull request #26 from CompassSoftware/menu_dev\n\nMenu dev"
>"Updated and added tests to GithubScraperTest"
>"Merge branch 'master' of https
>"Merge pull request #23 from CompassSoftware/general_data\n\nAdded getters for specific inner class objects"
>"Added some tests to the testing class and made changes to existing methods."
>"Merge pull request #22 from CompassSoftware/general_data\n\nMade it possible to get general data from gitobjects"
>"Merge pull request #16 from CompassSoftware/json_parse\n\nJson parse"
-------------------------------
User: "fenwickjb"
Number of Commits: 0
Messages:
-------------------------------
62 changes: 62 additions & 0 deletions GDET-Four-Musketeers-Issues.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Issues (12):
--------------

> Title: "Save to file"
Date: "2018-12-04
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/25"
---------------------------

> Title: "Save Issues to file"
Date: "2018-12-04
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/24"
---------------------------

> Title: "Build and manipulate JSON objects"
Date: "2018-11-19
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/14"
---------------------------

> Title: "Install the java Github API"
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/12"
---------------------------

> Title: "Get the file contents"
Date: "2018-11-12
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/10"
---------------------------

> Title: "Parse comments from pull requests"
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/9"
---------------------------

> Title: "Parse comments from commits"
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/8"
---------------------------

> Title: "Get the pull request data from master and other branches"
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/7"
---------------------------

> Title: "Get the issues data from master and other branches"
Date: "2018-11-13
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/6"
---------------------------

> Title: "Get the commit data from Master and other branches"
Date: "2018-11-12
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/4"
---------------------------

> Title: "issue"
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/3"
---------------------------

> Title: "Create project “Kanban” board."
Date: "2018-11-09
URL: "https//api.github.com/repos/CompassSoftware/GDET-Four-Musketeers/issues/2"
---------------------------
2 changes: 2 additions & 0 deletions GitObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ public void setData(String[] data) {
public abstract String getGeneral();

public abstract String getData(String keyWord);

public abstract void saveToFile(String repo);
}
23 changes: 16 additions & 7 deletions GithubDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

public class GithubDriver {

// == main menu options ==
private static final int ISSUES = 1;
private static final int COMMITS = 2;
private static final int QUIT = 3;
public static final int ISSUES = 1;
public static final int COMMITS = 2;
public static final int QUIT = 3;

// == secondary menu options ==
private static final int GENERAL = 1;
private static final int COMMENTS = 2;
private static final int SPECIFIC = 3;
private static final int LIST = 4;
private static final int RETURN = 5;
private static final int SAVE = 5;
private static final int RETURN = 6;

private static final String ISSUES_STR = "Issues";
private static final String COMMITS_STR = "Commits";
Expand Down Expand Up @@ -44,7 +44,8 @@ private static void startRoutine(Scanner s, GithubScraper scraper, int opt) {
+ "\n2) Comments"
+ "\n3) Info on specific commit."
+ "\n4) List the " + c
+ "\n5) Return to main menu\n");
+ "\n5) Save " + c + " to file."
+ "\n6) Return to main menu\n");
while (true) {
int choice = s.nextInt();
s.nextLine();
Expand All @@ -57,6 +58,7 @@ else if (opt == COMMITS)
break;
case COMMENTS:
//TODO
System.out.println("Coming soon to a terminal near you!");
break;
case SPECIFIC:
//TODO
Expand All @@ -83,6 +85,12 @@ else if (opt == COMMITS) {
else if (opt == COMMITS)
System.out.println(scraper.getCommits());
break;
case SAVE:
if (opt == ISSUES)
scraper.saveIssues();
else if (opt == COMMITS)
scraper.saveCommits();
break;
case RETURN:
return;
default:
Expand All @@ -93,7 +101,8 @@ else if (opt == COMMITS)
+ "\n2) Comments"
+ "\n3) Info on specific commit."
+ "\n4) List the " + c
+ "\n5) Return to main menu\n");
+ "\n5) Save " + c + " to file."
+ "\n6) Return to main menu\n");
}
}

Expand Down
8 changes: 8 additions & 0 deletions GithubScraper.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public Commits getCommits() {
return commits;
}

public void saveIssues() {
issues.saveToFile(baseURL);
}

public void saveCommits() {
commits.saveToFile(baseURL);
}

/*
* Sets the base url of the project
*/
Expand Down
23 changes: 23 additions & 0 deletions Issues.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import java.util.ArrayList;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
*
* Class responsible for parsing the issues string array.
Expand Down Expand Up @@ -80,6 +83,26 @@ public String toString() {
return ret;
}

public void saveToFile(String repo) {
String[] r = repo.split("/");
repo = r[r.length-1];
String data = getGeneral();
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(repo + "-Issues.txt"));
writer.write(data);

System.out.println("Saved issues to Issues.txt");
} catch ( IOException e) {
} finally {
try {
if ( writer != null)
writer.close( );
} catch ( IOException e) {
}
}
}

// == private methods ==
private boolean isInList(ArrayList<String> list, String keyword) {

Expand Down