private boolean hasLocalJenkinsFile(UIContext context, Project project) { File jenkinsFile = CommandHelpers.getProjectContextFile(context, project, "Jenkinsfile"); boolean hasJenkinsFile = Files.isFile(jenkinsFile); LOG.debug("Has Jenkinsfile " + hasJenkinsFile + " with file: " + jenkinsFile); return hasJenkinsFile; }
protected static String loadFile(File file) { String output = null; if (Files.isFile(file)) { try { output = IOHelpers.readFully(file); } catch (IOException e) { LOG.error("Failed to load " + file + ". " + e, e); } } return output; }
protected static String loadFile(File file) { String output = null; if (Files.isFile(file)) { try { output = IOHelpers.readFully(file); } catch (IOException e) { LOG.error("Failed to load " + file + ". " + e, e); } } return output; }
protected boolean hasFile(EnableFabric8Context context, String name) { return Files.isFile(new File(context.getDir(), name)); }
protected boolean hasFile(EnableFabric8Context context, String name) { return Files.isFile(new File(context.getDir(), name)); }
protected JsonNode getJsonFile(CommandContext context, String fileName) { JsonNode tree = null; File file = context.file(fileName); if (Files.isFile(file)) { try { tree = MarkupHelper.loadJson(file); } catch (IOException e) { LOG.warn("Failed to parse JSON " + file + ". " + e, e); } } return tree; }
protected JsonNode getJsonFile(CommandContext context, String fileName) { JsonNode tree = null; File file = context.file(fileName); if (Files.isFile(file)) { try { tree = MarkupHelper.loadJson(file); } catch (IOException e) { LOG.warn("Failed to parse JSON " + file + ". " + e, e); } } return tree; }
private boolean doPushVersionChange(PushVersionChangesContext context, String name, String value) throws IOException { boolean answer = false; File dir = context.getDir(); if (Files.isDirectory(dir)) { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { String fileName = file.getName(); if (Files.isFile(file) && fileName.equals("Makefile") || fileName.startsWith("Makefile.")) { if (updateMakefile(context, file, name, value)) { answer = true; } } } } } return answer; }
private boolean doPushVersionChange(PushVersionChangesContext context, String name, String value) throws IOException { boolean answer = false; File dir = context.getDir(); if (Files.isDirectory(dir)) { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { String fileName = file.getName(); if (Files.isFile(file) && fileName.equals("Dockerfile") || fileName.startsWith("Dockerfile.")) { if (updateDockerfile(context, file, name, value)) { answer = true; } } } } } return answer; }
file = new File(sourceDir, configFile); if (!Files.isFile(file)) { URL url = null; try {
previousLinePattern = Pattern.compile(previousLinePatternText); if (Files.isFile(file)) { String text = IOHelpers.readFully(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)); String[] lines = text.split("\n");
file = new File(sourceDir, configFile); if (!Files.isFile(file)) { URL url = null; try {
public static void loadGitCredentials(Map<String,UserPassword> map, File file) { if (Files.isFile(file)) { List<String> lines; try {
@Override public boolean pushVersions(CommandContext context, List<DependencyVersionChange> changes) throws IOException { File file = context.file("pom.xml"); boolean answer = false; if (Files.isFile(file)) { if (PomHelper.updatePomVersionsInPoms(context.getDir(), changes)) { return true; } } return answer; }
@Override public boolean pushVersions(CommandContext context, List<DependencyVersionChange> changes) throws IOException { File file = context.file("pom.xml"); boolean answer = false; if (Files.isFile(file)) { if (PomHelper.updatePomVersionsInPoms(context.getDir(), changes)) { return true; } } return answer; }
@Override public boolean pushVersions(CommandContext context, List<DependencyVersionChange> changes) throws IOException { File file = context.file("pom.xml"); boolean answer = false; if (Files.isFile(file)) { if (PomHelper.updatePomVersionsInPoms(context.getDir(), changes)) { return true; } } return answer; }
@Override public boolean pushVersions(CommandContext context, List<DependencyVersionChange> changes) throws IOException { File file = context.file("pom.xml"); boolean answer = false; if (Files.isFile(file)) { if (PomHelper.updatePomVersionsInPoms(context.getDir(), changes)) { return true; } } return answer; }
/** * Returns a local repository from a directory. */ public static LocalRepository fromDirectory(Configuration configuration, File dir) throws IOException { LocalRepository localRepository = new LocalRepository(new GitRepository(dir.getName()), dir); File configFile = new File(dir, DEFAULT_CONFIG_FILE); if (Files.isFile(configFile)) { RepositoryConfig config = RepositoryConfigs.loadRepositoryConfig(configuration, DEFAULT_CONFIG_FILE, dir); if (config != null) { GitRepositoryConfig local = config.getLocal(); if (local != null) { localRepository.getRepo().setRepositoryDetails(local); } } } return localRepository; }
/** * Returns a local repository from a directory. */ public static LocalRepository fromDirectory(Configuration configuration, File dir) throws IOException { LocalRepository localRepository = new LocalRepository(new GitRepository(dir.getName()), dir); File configFile = new File(dir, DEFAULT_CONFIG_FILE); if (Files.isFile(configFile)) { RepositoryConfig config = RepositoryConfigs.loadRepositoryConfig(configuration, DEFAULT_CONFIG_FILE, dir); if (config != null) { GitRepositoryConfig local = config.getLocal(); if (local != null) { localRepository.getRepo().setRepositoryDetails(local); } } } return localRepository; }
@Override public void addVersionChangesFromSource(CommandContext context, Dependencies dependencyConfig, List<DependencyVersionChange> list) throws IOException { File file = context.file("pom.xml"); if (Files.isFile(file)) { "io.jenkins.updatebot:updatebot-maven-plugin:" + updateBotPluginVersion + ":export", "-DdestFile=" + versionsFile, "-DupdateBotYaml=" + configFile)) { if (!Files.isFile(versionsFile)) { LOG.warn("Should have generated the export versions file " + versionsFile); return;