Skip to content

Commit

Permalink
Partially commenting methods and removing hard-coded date string. Rel…
Browse files Browse the repository at this point in the history
…ated to #6 and #20.
  • Loading branch information
Rodrigo Alves Vieira committed May 4, 2013
1 parent f2015ce commit 3c4e798
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/java/main/br/ufpe/cin/groundhog/main/CmdMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
Expand Down Expand Up @@ -57,6 +58,12 @@
public class CmdMain {
private static Logger logger = LoggerFactory.getLogger(CrawlGoogleCode.class);

/**
* Defines the code forge where the search will be performed.
* Valid options are GITHUB, SOURCEFORGE and GOOGLECODE, as listed in the {@link SupportedForge} enumerator.
* @param f the forge name
* @return the search object of the chosen forge
*/
public static ForgeSearch defineForgeSearch(SupportedForge f) {
Injector injector = Guice.createInjector(new SearchModule());
ForgeSearch search = null;
Expand All @@ -74,6 +81,13 @@ public static ForgeSearch defineForgeSearch(SupportedForge f) {
return search;
}


/**
* Defines the forge crawler - that is - how the search will actually be performed on the chosen forge
* @param f the supported forge. Valid options are GITHUB, SOURCEFORGE and GOOGLECODE
* @param destinationFolder the destination directory
* @return the {@link ForgeCrawler} object for the chosen forge
*/
public static ForgeCrawler defineForgeCrawler(SupportedForge f, File destinationFolder) {
ForgeCrawler crawler = null;
Injector injector = Guice.createInjector(new HttpModule(), new ScmModule());
Expand Down Expand Up @@ -176,6 +190,7 @@ public static void freeResources(ForgeCrawler crawler, OutputStream errorStream)
} catch (IOException e) {
logger.warn("Could not delete temp folders (but they will be eventually deleted)");
}

try {
if (errorStream != null) {
errorStream.close();
Expand All @@ -187,15 +202,9 @@ public static void freeResources(ForgeCrawler crawler, OutputStream errorStream)

public static void main(String[] args) {
Options opt = new Options();
/*CmdLineParser cmd = new CmdLineParser(opt);
try {
cmd.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
cmd.printUsage(System.err);
return;
}*/
opt.setDatetime("2012-07-01_12_00");
String date = new SimpleDateFormat("yyyy-MM-dd_HH_mm").format(new Date()); // Current datetime String

opt.setDatetime(date);
//opt.setDestinationFolder(new File("download"));
opt.setForge(SupportedForge.GITHUB);
opt.setMetricsFolder(new File("metrics"));
Expand Down

0 comments on commit 3c4e798

Please sign in to comment.