User Manual - STIW3054-A191/Githubbers GitHub Wiki

Welcome to User Manual Of Githubbers!

Grabber

Classes involved:repoPlug.java & matchPlug.java

Here we grab the links to the project that we desired. We use link grabber to grab the elements from a specific link. It is in the repoPlug.java. This is the line of codes that we use to grab the elements from the link.

final Document document = Jsoup.connect("https://github.com/STIW3054-A191/Assignments/issues/1").get(); Elements elements = document.select("table").select("a");

matchPlug.java is same as regex method.

For further modification of this class, please bear in mind of the methods that we use and what kind of elements that we have grabbed.

Clone Repository

Classes involved: CloneRepo.java, RepoDetails.java, Directory.java & CheckDirectory.java

Here we clone the repositories that we grab from the project link above. we store in the target file target/output/. This is the line of code that we used under Directory.java:

        URL location = Directory.class.getProtectionDomain().getCodeSource().getLocation();
        return location.getFile().substring(1).split("target")[0]+"target/output/";
    } 

We are using org.eclipse.jgit.api.Git to execute all git commands. This is line of code that we used under CloneRepo.java:


        try {
            Git.cloneRepository()
                    .setURI(url + ".git")
                    .setDirectory(new File(Directory.getRepoFolderPath() + RepoDetails.getName(url)))
                    .call();
        } catch (GitAPIException e) {
            e.printStackTrace();
        }

        OutputResult.print(false, RepoDetails.getName(url), "Cloning Completed !", latch, repoTotal);
    } 

In this RepoDetails.java class, we have the methods to retrieve information from the repository such as matric number and etc. The method in this class will be: getName(String url) and getMatricNo(String url).

In this CheckDirectory.java class, we check if the specific directory is exist. In our case it will be target/output/repo. If it is not exist it will create a new list of folders including log, txt and output. If it exist, it will delete it. The method that we use will be: checkDir(),makeDir(File Directory) & deleteDir(File dir)

Compile Repository

Classes involved: MavenOrigin.java, PomDirectory.java & MavenCompile.java

In MavenOrigin.java we check if maven is installed or not in the machine. The methods that used are setHome() & getPath(). If the maven not found it will prompt to install maven before proceed with the system. If maven existed it will straight away proceed to next phase which is check the directory part.

In MavenCompile.java class, here all compiling phase is executed. All repositories that have been cloned are compile. If any error it will display Build Failure ! and a log is produced. If it is successful compile it will promptBuild Success !.

Run Repository

Classes involved: JarCallable.java, JarDirectory.java, JarReadOutput.java & JarRun.java

In this phase we run jar file that we build using maven in previous phase. The reason we use jar is to help us easily run project that have been build using different machine. We are using Callable feature to help us easily run multiple program. In JarDirectory.javaclass, we use to find jar file located in target folder. While in JarReadOutput.java, JarRun.java and JarCallable.java classes, we executed the jar file and store the output in desired folder.

CKJM Performance Analysis

Classes involved: ClassCkjmjava, TestRunCkjm.java & TestCkjm.java

In this phase we test all jar files using CKJM. CKJM to test all clone repository have class or not then calculates for each class following metrics and display the output. The following class name that test is
-WMC(Weighted method per class)
-DIT(Dept of inheritance tree)
-NOC(Number of children)
-CBO(Coupling between object classes)
-RFC(Response for a class)
-LCOM(Lack of cohesion in method)
All the following class need to test to know how many class name have in every repository.

ClassCkjm.java class function is to link or get the path repository folder.

TestRunCkjm.java function is to know every repository have class or not . If no class detected in repository it will display “No class file detected”. This class link with LogOutput.java and OutputResult.java to get the output.

TestCkjm.java function is to calculate and display how many in every class name WMC, DIT, NOC, CBO, RFC and LCOM.

Generate Excel and PDF

Classes involve: ExcelData.java,GetListStudents.java, ExcelOutput.java, createBarChart.java, CkjmToExcel.java & CreateExcel.java

In thisExcelData.java class helps to set the file, sheet name and header in the excel file. Then, GetListStudents.java class helps to create excel. Next, CkjmToExcel.javaclass gathers data from ExcelData.javaclass and transfer the information to ExcelOuput.javaclass. After that, ExcelOutput.javaclass gather data from ExcelData.javaclass to produce excel file. Then, createBarChart.javaclass will produce a bar chart from the data in the excel file. Finally, CreateExcel.javaclass will create excel file based on data from ExcelData.javaclass.