use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.
the class RuntimeEnvironment method validateExuberantCtags.
/**
* Validate that I have a Exuberant ctags program I may use
*
* @return true if success, false otherwise
*/
public boolean validateExuberantCtags() {
if (exCtagsFound == null) {
Executor executor = new Executor(new String[] { getCtags(), "--version" });
executor.exec(false);
String output = executor.getOutputString();
boolean isUnivCtags = output != null ? output.contains("Universal Ctags") : false;
if (output == null || (!output.contains("Exuberant Ctags") && !isUnivCtags)) {
LOGGER.log(Level.SEVERE, "Error: No Exuberant Ctags found in PATH !\n" + "(tried running " + "{0}" + ")\n" + "Please use option -c to specify path to a good " + "Exuberant Ctags program.\n" + "Or set it in java property " + "org.opensolaris.opengrok.analysis.Ctags", getCtags());
exCtagsFound = false;
} else {
if (isUnivCtags) {
isUniversalCtagsVal = true;
}
exCtagsFound = true;
}
}
return exCtagsFound;
}
use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.
the class RuntimeEnvironment method isUniversalCtags.
/**
* Are we using Universal ctags?
*
* @return true if we are using Universal ctags
*/
public boolean isUniversalCtags() {
if (isUniversalCtagsVal == null) {
isUniversalCtagsVal = false;
Executor executor = new Executor(new String[] { getCtags(), "--version" });
executor.exec(false);
String output = executor.getOutputString();
if (output.contains("Universal Ctags")) {
isUniversalCtagsVal = true;
}
}
return isUniversalCtagsVal;
}
use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.
the class MercurialRepository method determineCurrentVersion.
@Override
String determineCurrentVersion() throws IOException {
String line = null;
File directory = new File(directoryName);
List<String> cmd = new ArrayList<>();
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
cmd.add(RepoCommand);
cmd.add("log");
cmd.add("-l");
cmd.add("1");
cmd.add("--template");
cmd.add("{date|isodate}: {node|short} {author} {desc|strip}");
Executor executor = new Executor(cmd, directory);
if (executor.exec(false) != 0) {
throw new IOException(executor.getErrorString());
}
return executor.getOutputString().trim();
}
use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.
the class MercurialRepository method update.
@Override
public void update() throws IOException {
File directory = new File(directoryName);
List<String> cmd = new ArrayList<>();
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
cmd.add(RepoCommand);
cmd.add("showconfig");
Executor executor = new Executor(cmd, directory);
if (executor.exec() != 0) {
throw new IOException(executor.getErrorString());
}
if (executor.getOutputString().contains("paths.default=")) {
cmd.clear();
cmd.add(RepoCommand);
cmd.add("pull");
cmd.add("-u");
executor = new Executor(cmd, directory);
if (executor.exec() != 0) {
throw new IOException(executor.getErrorString());
}
}
}
use of org.opensolaris.opengrok.util.Executor in project OpenGrok by OpenGrok.
the class MonotoneHistoryParser method parse.
/**
* Parse the history for the specified file or directory. If a changeset is
* specified, only return the history from the changeset right after the
* specified one.
*
* @param file the file or directory to get history for
* @param changeset the changeset right before the first one to fetch, or
* {@code null} if all changesets should be fetched
* @return history for the specified file or directory
* @throws HistoryException if an error happens when parsing the history
*/
History parse(File file, String changeset) throws HistoryException {
try {
Executor executor = repository.getHistoryLogExecutor(file, changeset);
int status = executor.exec(true, this);
if (status != 0) {
throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status);
}
} catch (IOException e) {
throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e);
}
return new History(entries);
}
Aggregations