use of com.thoughtworks.gauge.settings.GaugeSettingsModel in project Intellij-Plugin by getgauge.
the class GaugeInspectionHelper method getErrors.
@NotNull
static List<GaugeError> getErrors(File directory) {
try {
GaugeSettingsModel settings = getGaugeSettings();
ProcessBuilder processBuilder = new ProcessBuilder(settings.getGaugePath(), Constants.VALIDATE);
GaugeUtil.setGaugeEnvironmentsTo(processBuilder, settings);
processBuilder.directory(directory);
Process process = processBuilder.start();
process.waitFor();
String[] errors = GaugeUtil.getOutput(process.getInputStream(), "\n").split("\n");
return Arrays.stream(errors).map(GaugeError::getInstance).filter(Objects::nonNull).collect(Collectors.toList());
} catch (IOException | InterruptedException | GaugeNotFoundException e) {
e.printStackTrace();
}
return new ArrayList<>();
}
use of com.thoughtworks.gauge.settings.GaugeSettingsModel in project Intellij-Plugin by getgauge.
the class GaugeWebBrowserPreview method getUrl.
@Nullable
@Override
protected Url getUrl(OpenInBrowserRequest request, VirtualFile virtualFile) throws BrowserException {
try {
if (!request.isAppendAccessToken())
return null;
GaugeSettingsModel settings = getGaugeSettings();
Spectacle spectacle = new Spectacle(request.getProject(), settings);
if (spectacle.isInstalled())
return previewUrl(request, virtualFile, settings);
spectacle.notifyToInstall();
} catch (Exception e) {
Messages.showWarningDialog(String.format("Unable to create html file for %s", virtualFile.getName()), "Error");
}
return null;
}
use of com.thoughtworks.gauge.settings.GaugeSettingsModel in project Intellij-Plugin by getgauge.
the class GaugeUtil method getSettingsFromPATH.
private static GaugeSettingsModel getSettingsFromPATH(GaugeSettingsModel model) throws GaugeNotFoundException {
String path = EnvironmentUtil.getValue("PATH");
LOG.info("PATH => " + path);
if (!StringUtils.isEmpty(path)) {
for (String entry : path.split(File.pathSeparator)) {
File file = new File(entry, gaugeExecutable());
if (isValidGaugeExec(file)) {
LOG.info("executable path from `PATH`: " + file.getAbsolutePath());
return new GaugeSettingsModel(file.getAbsolutePath(), model.getHomePath(), model.useIntelliJTestRunner());
}
}
}
String msg = "Could not find executable in `PATH`. Please make sure Gauge is installed." + "\nIf Gauge is installed then set the Gauge executable path in settings -> tools -> gauge.";
throw new GaugeNotFoundException(msg);
}
Aggregations