Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package prerna.util.git;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLHandshakeException;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import prerna.security.InstallCertNow;
import prerna.util.Constants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// main class for all things fetch
// need a way to install the cert here too
public class GitFetchUtils {
protected static final Logger classLogger = LogManager.getLogger(GitFetchUtils.class);
public static void fetchGeneric(String fullRemoteAppName, String localFolder, String host)
{
Logger logger = LogManager.getLogger(GitFetchUtils.class);
if(host == null)
host = "github.com";
// need to get the database folder
try {
// circumventing for the purposes of netskope
prerna.security.InstallCertNow.please(host, null, null);
} catch (Exception e) {
// TODO Auto-generated catch block
classLogger.error(Constants.STACKTRACE, e);
}
File db = new File(localFolder);
if(!db.exists()) {
// make the folder
db.mkdirs();
// throw new IllegalArgumentException("You already have a folder named " + yourName4App + " in your directory."
// + " Please delete it or choose a different name for the app");
}
String[] appNameSplit = fullRemoteAppName.split("/");
String appUserName = appNameSplit[0];
String repoName = appNameSplit[1];
// initialize the version folder
logger.info("Start creating local git folder");
//GitRepoUtils.makeLocalAppGitVersionFolder(yourName4App);
logger.info("Done creating local git folder");
String versionFolder = localFolder;
// write a random file so we can add/commit
logger.info("Init local git...");
//GitUtils.semossInit(versionFolder);
// add/commit all the files
logger.info("Add local git...");
GitPushUtils.addAllFiles(versionFolder, false);
logger.info("Commit local git...");
GitPushUtils.commitAddedFiles(versionFolder);
logger.info("Done...");
List