From 544bf22f0f19d358ccb64bdc5b86b200c38b111e Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 13:12:30 +0200 Subject: [PATCH 1/8] add checks --- src/main/java/nf_core/nf/test/utils/Methods.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/nf_core/nf/test/utils/Methods.java b/src/main/java/nf_core/nf/test/utils/Methods.java index 80f6c99..04ff700 100644 --- a/src/main/java/nf_core/nf/test/utils/Methods.java +++ b/src/main/java/nf_core/nf/test/utils/Methods.java @@ -45,17 +45,26 @@ public static Map> removeNextflowVersion(CharSequenc return yamlData; } - //wrapper functions for getAllFilesFromDir with default options + // wrapper functions for getAllFilesFromDir with default options public static List getAllFilesFromDir(String path) throws IOException { return getAllFilesFromDir(new LinkedHashMap(), path); } - //wrapper functions for getAllFilesFromDir with named options + // wrapper functions for getAllFilesFromDir with named options public static List getAllFilesFromDir(LinkedHashMap options, String path) throws IOException { if (path == null || path.isEmpty()) { throw new IllegalArgumentException("The 'path' parameter is required."); } - //TODO: check if path exists + // Check if path exists + Path dirPath = Paths.get(path); + if (!Files.exists(dirPath)) { + throw new IllegalArgumentException("The specified path does not exist: " + path); + } + + // Check if it's a directory + if (!Files.isDirectory(dirPath)) { + throw new IllegalArgumentException("The specified path is not a directory: " + path); + } // Extract optional parameters from the map (use defaults if not provided) Boolean includeDir = (Boolean) options.getOrDefault("includeDir", true); From 9a3dec8a6d5d98879ce2d709397019595a675478 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 15:45:10 +0200 Subject: [PATCH 2/8] rename to less generic: path -> outdir --- .../java/nf_core/nf/test/utils/Methods.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/nf_core/nf/test/utils/Methods.java b/src/main/java/nf_core/nf/test/utils/Methods.java index 04ff700..d4b0219 100644 --- a/src/main/java/nf_core/nf/test/utils/Methods.java +++ b/src/main/java/nf_core/nf/test/utils/Methods.java @@ -51,19 +51,19 @@ public static List getAllFilesFromDir(String path) throws IOException { } // wrapper functions for getAllFilesFromDir with named options - public static List getAllFilesFromDir(LinkedHashMap options, String path) throws IOException { - if (path == null || path.isEmpty()) { - throw new IllegalArgumentException("The 'path' parameter is required."); + public static List getAllFilesFromDir(LinkedHashMap options, String outdir) throws IOException { + if (outdir == null || outdir.isEmpty()) { + throw new IllegalArgumentException("The 'outdir' parameter is required."); } // Check if path exists - Path dirPath = Paths.get(path); + Path dirPath = Paths.get(outdir); if (!Files.exists(dirPath)) { - throw new IllegalArgumentException("The specified path does not exist: " + path); + throw new IllegalArgumentException("The specified path does not exist: " + outdir); } // Check if it's a directory if (!Files.isDirectory(dirPath)) { - throw new IllegalArgumentException("The specified path is not a directory: " + path); + throw new IllegalArgumentException("The specified path is not a directory: " + outdir); } // Extract optional parameters from the map (use defaults if not provided) @@ -71,11 +71,12 @@ public static List getAllFilesFromDir(LinkedHashMap options, Str List ignoreGlobs = (List) options.getOrDefault("ignore", new ArrayList()); String ignoreFilePath = (String) options.get("ignoreFile"); Boolean relative = (Boolean) options.getOrDefault("relative", false); + List includeGlobs = (List) options.getOrDefault("include", new ArrayList()); - List files = getAllFilesFromDir(path, includeDir, ignoreGlobs, ignoreFilePath); + List files = getAllFilesFromDir(outdir, includeDir, ignoreGlobs, ignoreFilePath); if (relative) { - return getRelativePath(files, path); + return getRelativePath(files, outdir); } else { return files; } From b3422cdc994dcdf3cd1911c652fe2dea9379ebc3 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 15:45:22 +0200 Subject: [PATCH 3/8] code polish --- tests/getAllFilesFromDir/main.nf.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/getAllFilesFromDir/main.nf.test b/tests/getAllFilesFromDir/main.nf.test index 5712e76..7a2d782 100644 --- a/tests/getAllFilesFromDir/main.nf.test +++ b/tests/getAllFilesFromDir/main.nf.test @@ -13,9 +13,9 @@ nextflow_pipeline { then { // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null ) + def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null) // Use getAllFilesFromDir() to get a list of all files from the output directory, minus the non-stable files - def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore' ) + def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore') assert snapshot( // Only snapshot name stable_name*.name, From b69f20dc9359602c00491e74b52692366a3fc8db Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 16:11:07 +0200 Subject: [PATCH 4/8] add new parameter + update tests --- .../java/nf_core/nf/test/utils/Methods.java | 6 ++--- tests/getAllFilesFromDir/main.nf.test | 11 +++++---- tests/getRelativePath/main.nf.test | 24 +++++++++++++++---- tests/getRelativePath/main.nf.test.snap | 21 +++++++++++----- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/main/java/nf_core/nf/test/utils/Methods.java b/src/main/java/nf_core/nf/test/utils/Methods.java index d4b0219..a0172ea 100644 --- a/src/main/java/nf_core/nf/test/utils/Methods.java +++ b/src/main/java/nf_core/nf/test/utils/Methods.java @@ -67,13 +67,13 @@ public static List getAllFilesFromDir(LinkedHashMap options, Str } // Extract optional parameters from the map (use defaults if not provided) - Boolean includeDir = (Boolean) options.getOrDefault("includeDir", true); + Boolean includeDir = (Boolean) options.getOrDefault("includeDir", false); List ignoreGlobs = (List) options.getOrDefault("ignore", new ArrayList()); String ignoreFilePath = (String) options.get("ignoreFile"); Boolean relative = (Boolean) options.getOrDefault("relative", false); List includeGlobs = (List) options.getOrDefault("include", new ArrayList()); - List files = getAllFilesFromDir(outdir, includeDir, ignoreGlobs, ignoreFilePath); + List files = getAllFilesFromDir(outdir, includeDir, ignoreGlobs, ignoreFilePath, includeGlobs); if (relative) { return getRelativePath(files, outdir); @@ -85,7 +85,7 @@ public static List getAllFilesFromDir(LinkedHashMap options, Str // Return all files in a directory and its sub-directories // matching or not matching supplied glob public static List getAllFilesFromDir(String outdir, boolean includeDir, List ignoreGlobs, - String ignoreFilePath) + String ignoreFilePath, List includeGlobs) throws IOException { List output = new ArrayList<>(); Path directory = Paths.get(outdir); diff --git a/tests/getAllFilesFromDir/main.nf.test b/tests/getAllFilesFromDir/main.nf.test index 7a2d782..422c2d0 100644 --- a/tests/getAllFilesFromDir/main.nf.test +++ b/tests/getAllFilesFromDir/main.nf.test @@ -13,9 +13,9 @@ nextflow_pipeline { then { // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null) + def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['']) // Use getAllFilesFromDir() to get a list of all files from the output directory, minus the non-stable files - def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore') + def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', ['']) assert snapshot( // Only snapshot name stable_name*.name, @@ -33,13 +33,14 @@ nextflow_pipeline { } then { - //with default params and relative + //with default params println(getAllFilesFromDir(params.outdir)) + //with default params and relative println(getAllFilesFromDir(params.outdir, relative: true)) // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}']) + def stable_name = getAllFilesFromDir(params.outdir, includeDir: true, ignore: ['pipeline_info/execution_*.{html,txt}']) // works also with spaces. - def stable_content = getAllFilesFromDir params.outdir, includeDir: false, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore' + def stable_content = getAllFilesFromDir params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore' assert snapshot( // Only snapshot name stable_name*.name, diff --git a/tests/getRelativePath/main.nf.test b/tests/getRelativePath/main.nf.test index 9ee7771..857024c 100644 --- a/tests/getRelativePath/main.nf.test +++ b/tests/getRelativePath/main.nf.test @@ -13,13 +13,29 @@ nextflow_pipeline { then { // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null ) - def stable_file = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], null ) + def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['']) assert snapshot( // Use getRelativePath to get the relative path starting from outputDir - getRelativePath(stable_name, outputDir), - getRelativePath(stable_file, outputDir) + getRelativePath(stable_name, outputDir) ).match() } } + + test("getRelativePath - Used from named parameters from getAllFilesFromDir") { + when { + params { + outdir = "$outputDir" + } + } + + then { + // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files, with relative path + def stable_name = getAllFilesFromDir(params.outdir, relative: true, ignore: ['pipeline_info/execution_*.{html,txt}']) + assert snapshot( + stable_name + ).match() + } + } + } + diff --git a/tests/getRelativePath/main.nf.test.snap b/tests/getRelativePath/main.nf.test.snap index 60938ab..0944bca 100644 --- a/tests/getRelativePath/main.nf.test.snap +++ b/tests/getRelativePath/main.nf.test.snap @@ -1,21 +1,30 @@ { - "getRelativePath": { + "getRelativePath - Used from named parameters from getAllFilesFromDir": { "content": [ [ - "pipeline_info", - "stable", "stable/stable_content.txt", "stable/stable_name.txt" - ], + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.09.0" + }, + "timestamp": "2024-10-07T16:06:44.9653" + }, + "getRelativePath": { + "content": [ [ + "pipeline_info", + "stable", "stable/stable_content.txt", "stable/stable_name.txt" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nextflow": "24.09.0" }, - "timestamp": "2024-10-01T18:20:38.379963" + "timestamp": "2024-10-07T16:03:43.069945" } } From 1136621313eeaec291936e8d40d06da53f1e2c25 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 16:54:53 +0200 Subject: [PATCH 5/8] Make function works with new parameter --- .../java/nf_core/nf/test/utils/Methods.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/nf_core/nf/test/utils/Methods.java b/src/main/java/nf_core/nf/test/utils/Methods.java index a0172ea..481c1fc 100644 --- a/src/main/java/nf_core/nf/test/utils/Methods.java +++ b/src/main/java/nf_core/nf/test/utils/Methods.java @@ -71,7 +71,7 @@ public static List getAllFilesFromDir(LinkedHashMap options, Str List ignoreGlobs = (List) options.getOrDefault("ignore", new ArrayList()); String ignoreFilePath = (String) options.get("ignoreFile"); Boolean relative = (Boolean) options.getOrDefault("relative", false); - List includeGlobs = (List) options.getOrDefault("include", new ArrayList()); + List includeGlobs = (List) options.getOrDefault("include", Arrays.asList("*", "**/*")); List files = getAllFilesFromDir(outdir, includeDir, ignoreGlobs, ignoreFilePath, includeGlobs); @@ -103,10 +103,20 @@ public static List getAllFilesFromDir(String outdir, boolean includeDir, L excludeMatchers.add(FileSystems.getDefault().getPathMatcher("glob:" + glob)); } + List allIncludeGlobs = new ArrayList<>(); + if (includeGlobs != null) { + allIncludeGlobs.addAll(includeGlobs); + } + + List includeMatchers = new ArrayList<>(); + for (String glob : allIncludeGlobs) { + includeMatchers.add(FileSystems.getDefault().getPathMatcher("glob:" + glob)); + } + Files.walkFileTree(directory, new SimpleFileVisitor() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { - if (!isExcluded(file)) { + if (isIncluded(file) && !isExcluded(file)) { output.add(file.toFile()); } return FileVisitResult.CONTINUE; @@ -115,7 +125,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { // Exclude output which is the root output folder from nf-test - if (includeDir && (!isExcluded(dir) && !dir.getFileName().toString().equals("output"))) { + if (includeDir && (isIncluded(dir) && !isExcluded(dir) && !dir.getFileName().toString().equals("output"))) { output.add(dir.toFile()); } return FileVisitResult.CONTINUE; @@ -124,6 +134,10 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { private boolean isExcluded(Path path) { return excludeMatchers.stream().anyMatch(matcher -> matcher.matches(directory.relativize(path))); } + + private boolean isIncluded(Path path) { + return includeMatchers.stream().anyMatch(matcher -> matcher.matches(directory.relativize(path))); + } }); return output.stream() From 26a3798fb867ee9426ce3b19255bca589a2e0543 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 16:55:09 +0200 Subject: [PATCH 6/8] update tests --- tests/getAllFilesFromDir/main.nf.test | 19 ++++++++++++++----- tests/getAllFilesFromDir/main.nf.test.snap | 18 +++++++++++++----- tests/getRelativePath/main.nf.test | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/tests/getAllFilesFromDir/main.nf.test b/tests/getAllFilesFromDir/main.nf.test index 422c2d0..813bf7f 100644 --- a/tests/getAllFilesFromDir/main.nf.test +++ b/tests/getAllFilesFromDir/main.nf.test @@ -13,14 +13,19 @@ nextflow_pipeline { then { // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['']) + def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['**']) + // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files + def stable_name_again = getAllFilesFromDir(params.outdir, true, [''], null, ['stable/*']) // Use getAllFilesFromDir() to get a list of all files from the output directory, minus the non-stable files - def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', ['']) + def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', ['**']) assert snapshot( // Only snapshot name stable_name*.name, + // Only snapshot name again + stable_name_again*.name, // Snapshot content - stable_content + stable_content, + // Capture file with includeGlobs ).match() } } @@ -38,12 +43,16 @@ nextflow_pipeline { //with default params and relative println(getAllFilesFromDir(params.outdir, relative: true)) // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, includeDir: true, ignore: ['pipeline_info/execution_*.{html,txt}']) + def stable_name = getAllFilesFromDir(params.outdir, includeDir: true, ignore: ['pipeline_info/execution_*.{html,txt}']) + // Use getAllFilesFromDir() to get a list of all files and folders from the stable folder within the output dir + def stable_name_again = getAllFilesFromDir(params.outdir, includeDir: true, include: ['stable/*']) // works also with spaces. - def stable_content = getAllFilesFromDir params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore' + def stable_content = getAllFilesFromDir params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore' assert snapshot( // Only snapshot name stable_name*.name, + // Only snapshot name again + stable_name_again*.name, // Snapshot content stable_content ).match() diff --git a/tests/getAllFilesFromDir/main.nf.test.snap b/tests/getAllFilesFromDir/main.nf.test.snap index d5b0414..3c2ba66 100644 --- a/tests/getAllFilesFromDir/main.nf.test.snap +++ b/tests/getAllFilesFromDir/main.nf.test.snap @@ -7,15 +7,19 @@ "stable_content.txt", "stable_name.txt" ], + [ + "stable_content.txt", + "stable_name.txt" + ], [ "stable_content.txt:md5,f6d73f703cda1c725ea78369a6c3a48d" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.07.0" + "nextflow": "24.09.0" }, - "timestamp": "2024-10-02T10:15:47.491035" + "timestamp": "2024-10-07T16:53:04.994417" }, "getAllFilesFromDir": { "content": [ @@ -25,14 +29,18 @@ "stable_content.txt", "stable_name.txt" ], + [ + "stable_content.txt", + "stable_name.txt" + ], [ "stable_content.txt:md5,f6d73f703cda1c725ea78369a6c3a48d" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nextflow": "24.09.0" }, - "timestamp": "2024-09-30T13:09:08.845794" + "timestamp": "2024-10-07T16:53:01.146706" } -} +} \ No newline at end of file diff --git a/tests/getRelativePath/main.nf.test b/tests/getRelativePath/main.nf.test index 857024c..545375f 100644 --- a/tests/getRelativePath/main.nf.test +++ b/tests/getRelativePath/main.nf.test @@ -13,7 +13,7 @@ nextflow_pipeline { then { // Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files - def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['']) + def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['**']) assert snapshot( // Use getRelativePath to get the relative path starting from outputDir getRelativePath(stable_name, outputDir) From e108c37f187f6914d385b8c7cb2091ec71b28eb9 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 17:40:42 +0200 Subject: [PATCH 7/8] update snapshots --- tests/getRelativePath/main.nf.test | 2 +- tests/getRelativePath/main.nf.test.snap | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/getRelativePath/main.nf.test b/tests/getRelativePath/main.nf.test index ac05906..65cbde2 100644 --- a/tests/getRelativePath/main.nf.test +++ b/tests/getRelativePath/main.nf.test @@ -21,7 +21,7 @@ nextflow_pipeline { } } - test("getAllFilesFromDir & getRelativePath combined") { + test("getRelativePath - Used from getAllFilesFromDir with the named parameter relative") { when { params { outdir = "$outputDir" diff --git a/tests/getRelativePath/main.nf.test.snap b/tests/getRelativePath/main.nf.test.snap index 0944bca..5942a84 100644 --- a/tests/getRelativePath/main.nf.test.snap +++ b/tests/getRelativePath/main.nf.test.snap @@ -1,5 +1,5 @@ { - "getRelativePath - Used from named parameters from getAllFilesFromDir": { + "getRelativePath - Used from getAllFilesFromDir with the named parameter relative": { "content": [ [ "stable/stable_content.txt", @@ -10,7 +10,7 @@ "nf-test": "0.9.0", "nextflow": "24.09.0" }, - "timestamp": "2024-10-07T16:06:44.9653" + "timestamp": "2024-10-07T17:40:15.046091" }, "getRelativePath": { "content": [ @@ -27,4 +27,4 @@ }, "timestamp": "2024-10-07T16:03:43.069945" } -} +} \ No newline at end of file From cac1fd4db1f30022bb43092a984686e3c7129d20 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Mon, 7 Oct 2024 17:43:55 +0200 Subject: [PATCH 8/8] update docs --- docs/usage.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index cd2d50e..0eca949 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -61,8 +61,8 @@ By using `stable_name*.name`, we extract the name of every file in `stable_name` `stable_content` can be used in the snapshot directly to include the hash of the file contents. ```groovy -def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null ) -def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore' ) +def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['*', '**/*']) +def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', ['*', '**/*']) assert snapshot( stable_name*.name, stable_content @@ -73,12 +73,14 @@ assert snapshot( • The second argument is a boolean indicating whether to include folders. • The third argument is a list of glob patterns to ignore. • The fourth argument is a file containing additional glob patterns to ignore. +• The fifth argument is a list of glob patterns to include. `getAllFilesFromDir()` also supports named parameters: ```groovy -def stable_name = getAllFilesFromDir(params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}']) -def stable_content = getAllFilesFromDir(params.outdir, includeDir: false, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore') +def stable_name = getAllFilesFromDir(params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}']) +def stable_name_again = getAllFilesFromDir(params.outdir, include: ['stable/*']) +def stable_content = getAllFilesFromDir(params.outdir, includeDir: false, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore') ``` ## `getRelativePath()` @@ -150,6 +152,6 @@ Without using `getRelativePath()` and by using `*.name` to capture the file name `getAllFilesFromDir()` named parameters `relative` can also be used to combine the two functions: ```groovy -def stable_name = getAllFilesFromDir(params.outdir, relative: true, ignore: ['pipeline_info/execution_*.{html,txt}'] ) -def stable_file = getAllFilesFromDir(params.outdir, relative: true, includeDir: false, ignore: ['pipeline_info/execution_*.{html,txt}'] ) +def stable_name = getAllFilesFromDir(params.outdir, relative: true, ignore: ['pipeline_info/execution_*.{html,txt}'] ) +def stable_name_again = getAllFilesFromDir(params.outdir, relative: true, include: ['stable/*'] ) ```