From 4ccb4240e01a4014e0e6c4ccf330e3269d7f1a11 Mon Sep 17 00:00:00 2001 From: CI Date: Tue, 3 Mar 2026 15:18:58 +0000 Subject: [PATCH] Build branch craftbox/v0.3 with version v0.3.2 to craftbox on branch v0.3 (7d520dc) Build pipeline: viash-hub.craftbox.v0.3.2-tpktm Source commit: https://github.com/viash-hub/craftbox/commit/7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9 Source message: Bump version to v0.3.2 --- CHANGELOG.md | 10 + README.md | 12 +- README.qmd | 2 +- _viash.yaml | 4 +- nextflow.config | 2 +- src/move_files_to_directory/config.vsh.yaml | 61 +++--- src/move_files_to_directory/script.sh | 37 ++-- src/move_files_to_directory/test.sh | 18 +- .../check_disk_space/.config.vsh.yaml | 14 +- .../check_disk_space/check_disk_space | 16 +- .../executable/concat_text/.config.vsh.yaml | 14 +- target/executable/concat_text/concat_text | 16 +- target/executable/csv2fasta/.config.vsh.yaml | 14 +- target/executable/csv2fasta/csv2fasta | 16 +- .../move_files_to_directory/.config.vsh.yaml | 41 ++-- .../move_files_to_directory | 83 ++++---- .../sync_resources/.config.vsh.yaml | 14 +- .../executable/sync_resources/sync_resources | 16 +- target/executable/untar/.config.vsh.yaml | 14 +- target/executable/untar/untar | 16 +- .../check_disk_space/.config.vsh.yaml | 14 +- target/nextflow/check_disk_space/main.nf | 112 ++++++----- .../nextflow/check_disk_space/nextflow.config | 2 +- target/nextflow/concat_text/.config.vsh.yaml | 14 +- target/nextflow/concat_text/main.nf | 112 ++++++----- target/nextflow/concat_text/nextflow.config | 2 +- target/nextflow/csv2fasta/.config.vsh.yaml | 14 +- target/nextflow/csv2fasta/main.nf | 112 ++++++----- target/nextflow/csv2fasta/nextflow.config | 2 +- .../move_files_to_directory/.config.vsh.yaml | 41 ++-- .../nextflow/move_files_to_directory/main.nf | 181 ++++++++++-------- .../move_files_to_directory/nextflow.config | 4 +- .../nextflow_schema.json | 38 +++- .../nextflow/sync_resources/.config.vsh.yaml | 14 +- target/nextflow/sync_resources/main.nf | 112 ++++++----- .../nextflow/sync_resources/nextflow.config | 2 +- target/nextflow/untar/.config.vsh.yaml | 14 +- target/nextflow/untar/main.nf | 112 ++++++----- target/nextflow/untar/nextflow.config | 2 +- 39 files changed, 743 insertions(+), 581 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7447ca1..8fc73ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# craftbox 0.3.2 + +## NEW FEATURES + +* `move_files_to_directory`: add support for moving directories (PR #17). + +## MINOR CHANGES + +* Bump viash to 0.9.7 (PR #18). + # craftbox 0.3.1 ## MINOR CHANGES diff --git a/README.md b/README.md index c64bd48..726e87e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Viash components in craftbox can be run in various ways: ``` mermaid lang="mermaid flowchart TD - A[craftbox v0.3.1] --> B(Viash Hub Launch) + A[craftbox v0.3.2] --> B(Viash Hub Launch) A --> C(Viash CLI) A --> D(Nextflow CLI) A --> E(Seqera Cloud) @@ -53,7 +53,7 @@ flowchart TD ### 1. Via the Viash Hub Launch interface You can run this component directly from the Viash Hub [Launch -interface](https://www.viash-hub.com/launch?package=craftbox&version=v0.3.1&component=concat_rtext&runner=Executable). +interface](https://www.viash-hub.com/launch?package=craftbox&version=v0.3.2&component=concat_rtext&runner=Executable). ![](docs/viash-hub.png) @@ -63,9 +63,9 @@ You can run this component directly from the command line using the Viash CLI. ``` bash -viash run vsh://craftbox@v0.3.1/concat_rtext -- --help +viash run vsh://craftbox@v0.3.2/concat_rtext -- --help -viash run vsh://craftbox@v0.3.1/concat_rtext -- \ +viash run vsh://craftbox@v0.3.2/concat_rtext -- \ --input path/to/input.txt \ --input path/to/compressed.txt.gz \ --output path/to/output.txt @@ -80,7 +80,7 @@ You can run this component as a Nextflow pipeline. ``` bash nextflow run https://packages.viash-hub.com/vsh/craftbox \ - -revision v0.3.1 \ + -revision v0.3.2 \ -main-script target/nextflow/concat_rtext/main.nf \ -latest -resume \ -profile docker \ @@ -109,7 +109,7 @@ component as a dependency: ``` yaml dependencies: - name: concat_rtext - repository: vsh://craftbox@v0.3.1 + repository: vsh://craftbox@v0.3.2 ``` **Tip:** See the [Viash diff --git a/README.qmd b/README.qmd index d52704a..a2b4078 100644 --- a/README.qmd +++ b/README.qmd @@ -7,7 +7,7 @@ license <- paste0(package$links$repository, "/blob/main/LICENSE") contributing <- paste0(package$links$repository, "/blob/main/CONTRIBUTING.md") pkg <- package$name -ver <- if (!is.null(package$version)) package$version else "v0.3.1" +ver <- if (!is.null(package$version)) package$version else "v0.3.2" comp <- "concat_rtext" ``` # 🪡📦 `r pkg` diff --git a/_viash.yaml b/_viash.yaml index f3a7bbf..2b39a44 100644 --- a/_viash.yaml +++ b/_viash.yaml @@ -1,5 +1,5 @@ name: craftbox -version: v0.3.1 +version: v0.3.2 summary: | A collection of custom-tailored scripts and applied utilities built with Viash. description: | @@ -19,7 +19,7 @@ license: MIT links: issue_tracker: https://github.com/viash-hub/craftbox/issues repository: https://github.com/viash-hub/craftbox -viash_version: 0.9.4 +viash_version: 0.9.7 config_mods: | .requirements.commands := ['ps'] organization: vsh diff --git a/nextflow.config b/nextflow.config index a33c730..7d0c9d3 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,6 +1,6 @@ manifest { name = "craftbox" - version = "v0.3.1" + version = "v0.3.2" defaultBranch = "main" nextflowVersion = "!>=20.12.1-edge" } diff --git a/src/move_files_to_directory/config.vsh.yaml b/src/move_files_to_directory/config.vsh.yaml index 30c9996..0ac5ebf 100644 --- a/src/move_files_to_directory/config.vsh.yaml +++ b/src/move_files_to_directory/config.vsh.yaml @@ -1,39 +1,52 @@ name: move_files_to_directory -summary: Publish one or multiple files to the same directory -description: This component copies one or multiple files to the same destination directory, creating the output directory if it doesn't exist. +summary: Publish one or multiple files or directories to the same output directory. +description: | + This component copies one or multiple files or directories + to the same destination directory, creating the output directory if it doesn't + exist. authors: - __merge__: /src/_authors/dorien_roosen.yaml roles: [ maintainer ] -arguments: - - name: "--input" - type: file - direction: input - required: true - multiple: true - description: Paths of the files that will be copied into the output directory. - - name: "--output" - type: file - direction: output - required: true - description: Path to output directory - - name: "--keep_symbolic_links" - alternatives: [-d] - type: boolean_true - description: Preserve symbolic links. + +argument_groups: + - name: Inputs + arguments: + - name: "--input" + type: file + direction: input + required: true + multiple: true + description: Paths of the files or directories that will be copied into the output directory. + - name: Outputs + arguments: + - name: "--output" + type: file + direction: output + required: true + description: Path to output directory. + - name: Options + arguments: + - name: "--keep_symbolic_links" + type: boolean_true + description: When set, symbolic links are preserved as symbolic links in the output directory. By default, symbolic links are dereferenced and the target file is copied. + resources: - type: bash_script path: script.sh + test_resources: - type: bash_script path: test.sh engines: -- type: docker - image: debian:latest - setup: + - type: docker + image: debian:latest + setup: - type: apt - packages: [procps] + packages: + - procps + - type: native runners: -- type: executable -- type: nextflow + - type: executable + - type: nextflow diff --git a/src/move_files_to_directory/script.sh b/src/move_files_to_directory/script.sh index 3c5b890..472f1d1 100644 --- a/src/move_files_to_directory/script.sh +++ b/src/move_files_to_directory/script.sh @@ -3,30 +3,37 @@ set -eo pipefail ## VIASH START -par_input="input.txt;input_2.txt" +par_input="input.txt;input_dir.zarr" par_output="output" +par_keep_symbolic_links="false" ## VIASH END - if [[ ! -d "$par_output" ]]; then mkdir -p "$par_output" fi -extra_params=( ) - -if [ "$par_keep_symbolic_links" == "true" ]; then - extra_params+=( "-d" ) +# Set copy flags based on options +if [[ "$par_keep_symbolic_links" == "true" ]]; then + # -a implies -dR --preserve=all + # with -d: same as --no-dereference (and --preserve=links) + # and --no-dereference: never follow symbolic links in SOURCE + # and -R, -r, --recursive: copy directories recursively + # --keep-directory-symlink: if the destination already exists and is a + # symbolic link to a directory, follow the symlink and copy into the directory + # it points to, instead of removing the symlink and creating a real directory in its place. + cp_flags="-a --keep-directory-symlink" +else + # -L: always follow symbolic links in SOURCE + cp_flags="-Lr --preserve=all --no-preserve=link --keep-directory-symlink" fi -# Process multiple input files -IFS=";" read -ra input_files <<< "$par_input" -for file in "${input_files[@]}"; do - # Check if the file exists before copying - if [[ -f "$file" ]]; then - - cp ${extra_params[@]} "$file" "$par_output/" - echo "Copied $file to $par_output/" +# Process multiple input paths (files or directories) +IFS=";" read -ra input_paths <<< "$par_input" +for path in "${input_paths[@]}"; do + if [[ -e "$path" ]] || [[ -L "$path" ]]; then + cp $cp_flags "$path" "$par_output/" + echo "Copied $path to $par_output/" else - echo "Warning: Input file $file does not exist, skipping" + echo "Warning: Input path $path does not exist, skipping" fi done diff --git a/src/move_files_to_directory/test.sh b/src/move_files_to_directory/test.sh index a64ec52..c899ae5 100644 --- a/src/move_files_to_directory/test.sh +++ b/src/move_files_to_directory/test.sh @@ -11,7 +11,7 @@ trap clean_up EXIT touch "$TMPDIR/test_file.txt" touch "$TMPDIR/another_file.txt" -./move_files_to_directory \ +$meta_executable \ --input "$TMPDIR/test_file.txt" \ --input "$TMPDIR/another_file.txt" \ --output "$TMPDIR/test_output" @@ -19,9 +19,23 @@ touch "$TMPDIR/another_file.txt" [[ ! -d "$TMPDIR/test_output" ]] && echo "It seems no output directory is generated" && exit 1 [[ ! -f "$TMPDIR/test_output/test_file.txt" ]] && [[ ! -f test_output/another_file.txt ]] && echo "Output files were not copied to the output directory" && exit 1 +# Test copying a directory +mkdir -p "$TMPDIR/test_dir" +touch "$TMPDIR/test_dir/file_in_dir.txt" +touch "$TMPDIR/test_dir/another_file_in_dir.txt" + +$meta_executable \ + --input "$TMPDIR/test_dir" \ + --output "$TMPDIR/test_output_dir" + +[[ ! -d "$TMPDIR/test_output_dir" ]] && echo "It seems no output directory (test_output_dir) is generated" && exit 1 +[[ ! -d "$TMPDIR/test_output_dir/test_dir" ]] && echo "Input directory was not copied to the output directory" && exit 1 +[[ ! -f "$TMPDIR/test_output_dir/test_dir/file_in_dir.txt" ]] && echo "Files inside the copied directory are missing" && exit 1 +[[ ! -f "$TMPDIR/test_output_dir/test_dir/another_file_in_dir.txt" ]] && echo "Files inside the copied directory are missing" && exit 1 + ln -s "$TMPDIR/test_file.txt" "$TMPDIR/symlink.txt" -./move_files_to_directory \ +$meta_executable \ --input "$TMPDIR/symlink.txt" \ --output "$TMPDIR/test_output_symlink" \ --keep_symbolic_links diff --git a/target/executable/check_disk_space/.config.vsh.yaml b/target/executable/check_disk_space/.config.vsh.yaml index 85a2fc8..fad6f91 100644 --- a/target/executable/check_disk_space/.config.vsh.yaml +++ b/target/executable/check_disk_space/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "check_disk_space" -version: "v0.3.1" +version: "v0.3.2" argument_groups: - name: "Inputs" arguments: @@ -144,7 +144,7 @@ engines: id: "docker" image: "bash:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" entrypoint: [] cmd: null @@ -156,12 +156,12 @@ build_info: engine: "docker|native" output: "target/executable/check_disk_space" executable: "target/executable/check_disk_space/check_disk_space" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -177,14 +177,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/check_disk_space/check_disk_space b/target/executable/check_disk_space/check_disk_space index 2c2627e..9e67725 100755 --- a/target/executable/check_disk_space/check_disk_space +++ b/target/executable/check_disk_space/check_disk_space @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# check_disk_space v0.3.1 +# check_disk_space v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -446,10 +446,10 @@ function ViashDockerfile { FROM bash:latest ENTRYPOINT [] LABEL org.opencontainers.image.description="Companion container for running component check_disk_space" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:57Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -566,7 +566,7 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "check_disk_space v0.3.1" + echo "check_disk_space v0.3.2" echo "" echo "Check for available disk space on the system." echo "" @@ -648,7 +648,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "check_disk_space v0.3.1" + echo "check_disk_space v0.3.2" exit ;; --tmp_space_required) @@ -783,7 +783,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/check_disk_space:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/check_disk_space:v0.3.2' fi # print dockerfile diff --git a/target/executable/concat_text/.config.vsh.yaml b/target/executable/concat_text/.config.vsh.yaml index e27c781..c0a4a69 100644 --- a/target/executable/concat_text/.config.vsh.yaml +++ b/target/executable/concat_text/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "concat_text" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Toni Verbeiren" roles: @@ -171,7 +171,7 @@ engines: id: "docker" image: "alpine:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apk" @@ -189,12 +189,12 @@ build_info: engine: "docker|native" output: "target/executable/concat_text" executable: "target/executable/concat_text/concat_text" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -210,14 +210,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/concat_text/concat_text b/target/executable/concat_text/concat_text index 7017482..1dc1ae6 100755 --- a/target/executable/concat_text/concat_text +++ b/target/executable/concat_text/concat_text @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# concat_text v0.3.1 +# concat_text v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,10 +454,10 @@ RUN apk add --no-cache bash procps file LABEL org.opencontainers.image.authors="Toni Verbeiren, Dries Schaumont, Robrecht Cannoodt" LABEL org.opencontainers.image.description="Companion container for running component concat_text" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -574,7 +574,7 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "concat_text v0.3.1" + echo "concat_text v0.3.2" echo "" echo "Concatenate a number of text files, handle gzipped text files gracefully and" echo "optionally gzip the output text file." @@ -645,7 +645,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "concat_text v0.3.1" + echo "concat_text v0.3.2" exit ;; --input) @@ -769,7 +769,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/concat_text:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/concat_text:v0.3.2' fi # print dockerfile diff --git a/target/executable/csv2fasta/.config.vsh.yaml b/target/executable/csv2fasta/.config.vsh.yaml index 8ede358..3707990 100644 --- a/target/executable/csv2fasta/.config.vsh.yaml +++ b/target/executable/csv2fasta/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "csv2fasta" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dries Schaumont" roles: @@ -227,7 +227,7 @@ engines: id: "docker" image: "python:slim" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -256,12 +256,12 @@ build_info: engine: "docker|native" output: "target/executable/csv2fasta" executable: "target/executable/csv2fasta/csv2fasta" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -277,14 +277,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/csv2fasta/csv2fasta b/target/executable/csv2fasta/csv2fasta index dfa8505..c17713b 100755 --- a/target/executable/csv2fasta/csv2fasta +++ b/target/executable/csv2fasta/csv2fasta @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# csv2fasta v0.3.1 +# csv2fasta v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -458,10 +458,10 @@ RUN pip install --upgrade pip && \ LABEL org.opencontainers.image.authors="Dries Schaumont, Robrecht Cannoodt" LABEL org.opencontainers.image.description="Companion container for running component csv2fasta" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -578,7 +578,7 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "csv2fasta v0.3.1" + echo "csv2fasta v0.3.2" echo "" echo "Convert two columns from a CSV file to FASTA entries. The CSV file can" echo "contain an optional header and each row (other than the header) becomes" @@ -695,7 +695,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "csv2fasta v0.3.1" + echo "csv2fasta v0.3.2" exit ;; --input) @@ -879,7 +879,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/csv2fasta:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/csv2fasta:v0.3.2' fi # print dockerfile diff --git a/target/executable/move_files_to_directory/.config.vsh.yaml b/target/executable/move_files_to_directory/.config.vsh.yaml index df0b7f8..e5a209c 100644 --- a/target/executable/move_files_to_directory/.config.vsh.yaml +++ b/target/executable/move_files_to_directory/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "move_files_to_directory" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dorien Roosen" roles: @@ -14,11 +14,12 @@ authors: href: "https://www.data-intuitive.com" role: "Data Scientist" argument_groups: -- name: "Arguments" +- name: "Inputs" arguments: - type: "file" name: "--input" - description: "Paths of the files that will be copied into the output directory." + description: "Paths of the files or directories that will be copied into the output\ + \ directory." info: null must_exist: true create_parent: true @@ -26,9 +27,11 @@ argument_groups: direction: "input" multiple: true multiple_sep: ";" +- name: "Outputs" + arguments: - type: "file" name: "--output" - description: "Path to output directory" + description: "Path to output directory." info: null must_exist: true create_parent: true @@ -36,20 +39,22 @@ argument_groups: direction: "output" multiple: false multiple_sep: ";" +- name: "Options" + arguments: - type: "boolean_true" name: "--keep_symbolic_links" - alternatives: - - "-d" - description: "Preserve symbolic links." + description: "When set, symbolic links are preserved as symbolic links in the\ + \ output directory. By default, symbolic links are dereferenced and the target\ + \ file is copied." info: null direction: "input" resources: - type: "bash_script" path: "script.sh" is_executable: true -summary: "Publish one or multiple files to the same directory" -description: "This component copies one or multiple files to the same destination\ - \ directory, creating the output directory if it doesn't exist." +summary: "Publish one or multiple files or directories to the same output directory." +description: "This component copies one or multiple files or directories\nto the same\ + \ destination directory, creating the output directory if it doesn't\nexist.\n" test_resources: - type: "bash_script" path: "test.sh" @@ -135,7 +140,7 @@ engines: id: "docker" image: "debian:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -146,18 +151,20 @@ engines: cmd: null - type: "native" id: "native" +- type: "native" + id: "native" build_info: config: "src/move_files_to_directory/config.vsh.yaml" runner: "executable" - engine: "docker|native" + engine: "docker|native|native" output: "target/executable/move_files_to_directory" executable: "target/executable/move_files_to_directory/move_files_to_directory" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -173,14 +180,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/move_files_to_directory/move_files_to_directory b/target/executable/move_files_to_directory/move_files_to_directory index 552c5dc..2c60247 100755 --- a/target/executable/move_files_to_directory/move_files_to_directory +++ b/target/executable/move_files_to_directory/move_files_to_directory @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# move_files_to_directory v0.3.1 +# move_files_to_directory v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,10 +454,10 @@ RUN apt-get update && \ LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component move_files_to_directory" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -574,23 +574,29 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "move_files_to_directory v0.3.1" + echo "move_files_to_directory v0.3.2" echo "" - echo "This component copies one or multiple files to the same destination directory," - echo "creating the output directory if it doesn't exist." + echo "This component copies one or multiple files or directories" + echo "to the same destination directory, creating the output directory if it doesn't" + echo "exist." echo "" - echo "Arguments:" + echo "Inputs:" echo " --input" echo " type: file, required parameter, multiple values allowed, file must exist" - echo " Paths of the files that will be copied into the output directory." + echo " Paths of the files or directories that will be copied into the output" + echo " directory." echo "" + echo "Outputs:" echo " --output" echo " type: file, required parameter, output, file must exist" - echo " Path to output directory" + echo " Path to output directory." echo "" - echo " -d, --keep_symbolic_links" + echo "Options:" + echo " --keep_symbolic_links" echo " type: boolean_true" - echo " Preserve symbolic links." + echo " When set, symbolic links are preserved as symbolic links in the output" + echo " directory. By default, symbolic links are dereferenced and the target" + echo " file is copied." echo "" echo "Viash built in Computational Requirements:" echo " ---cpus=INT" @@ -613,7 +619,7 @@ function ViashHelp { echo "" echo "Viash built in Engines:" echo " ---engine=ENGINE_ID" - echo " Specify the engine to use. Options are: docker, native." + echo " Specify the engine to use. Options are: docker, native, native." echo " Default: docker" } @@ -639,7 +645,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "move_files_to_directory v0.3.1" + echo "move_files_to_directory v0.3.2" exit ;; --input) @@ -675,11 +681,6 @@ while [[ $# -gt 0 ]]; do VIASH_PAR_KEEP_SYMBOLIC_LINKS=true shift 1 ;; - -d) - [ -n "$VIASH_PAR_KEEP_SYMBOLIC_LINKS" ] && ViashError Bad arguments for option \'-d\': \'$VIASH_PAR_KEEP_SYMBOLIC_LINKS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1 - VIASH_PAR_KEEP_SYMBOLIC_LINKS=true - shift 1 - ;; ---engine) VIASH_ENGINE_ID="$2" shift 2 @@ -753,12 +754,12 @@ done eval set -- $VIASH_POSITIONAL_ARGS -if [ "$VIASH_ENGINE_ID" == "native" ] ; then +if [ "$VIASH_ENGINE_ID" == "native" ] || [ "$VIASH_ENGINE_ID" == "native" ] ; then VIASH_ENGINE_TYPE='native' elif [ "$VIASH_ENGINE_ID" == "docker" ] ; then VIASH_ENGINE_TYPE='docker' else - ViashError "Engine '$VIASH_ENGINE_ID' is not recognized. Options are: docker, native." + ViashError "Engine '$VIASH_ENGINE_ID' is not recognized. Options are: docker, native, native." exit 1 fi @@ -768,7 +769,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/move_files_to_directory:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/move_files_to_directory:v0.3.2' fi # print dockerfile @@ -989,7 +990,7 @@ if [ ! -z "$VIASH_PAR_OUTPUT" ] && [ ! -d "$(dirname "$VIASH_PAR_OUTPUT")" ]; th mkdir -p "$(dirname "$VIASH_PAR_OUTPUT")" fi -if [ "$VIASH_ENGINE_ID" == "native" ] ; then +if [ "$VIASH_ENGINE_ID" == "native" ] || [ "$VIASH_ENGINE_ID" == "native" ] ; then if [ "$VIASH_MODE" == "run" ]; then VIASH_CMD="bash" else @@ -1114,27 +1115,33 @@ $( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "${VIASH_META_MEMORY_PIB}" ## VIASH END - if [[ ! -d "\$par_output" ]]; then mkdir -p "\$par_output" fi -extra_params=( ) - -if [ "\$par_keep_symbolic_links" == "true" ]; then - extra_params+=( "-d" ) +# Set copy flags based on options +if [[ "\$par_keep_symbolic_links" == "true" ]]; then + # -a implies -dR --preserve=all + # with -d: same as --no-dereference (and --preserve=links) + # and --no-dereference: never follow symbolic links in SOURCE + # and -R, -r, --recursive: copy directories recursively + # --keep-directory-symlink: if the destination already exists and is a + # symbolic link to a directory, follow the symlink and copy into the directory + # it points to, instead of removing the symlink and creating a real directory in its place. + cp_flags="-a --keep-directory-symlink" +else + # -L: always follow symbolic links in SOURCE + cp_flags="-Lr --preserve=all --no-preserve=link --keep-directory-symlink" fi -# Process multiple input files -IFS=";" read -ra input_files <<< "\$par_input" -for file in "\${input_files[@]}"; do - # Check if the file exists before copying - if [[ -f "\$file" ]]; then - - cp \${extra_params[@]} "\$file" "\$par_output/" - echo "Copied \$file to \$par_output/" +# Process multiple input paths (files or directories) +IFS=";" read -ra input_paths <<< "\$par_input" +for path in "\${input_paths[@]}"; do + if [[ -e "\$path" ]] || [[ -L "\$path" ]]; then + cp \$cp_flags "\$path" "\$par_output/" + echo "Copied \$path to \$par_output/" else - echo "Warning: Input file \$file does not exist, skipping" + echo "Warning: Input path \$path does not exist, skipping" fi done VIASHMAIN diff --git a/target/executable/sync_resources/.config.vsh.yaml b/target/executable/sync_resources/.config.vsh.yaml index a1ec241..c8c1f90 100644 --- a/target/executable/sync_resources/.config.vsh.yaml +++ b/target/executable/sync_resources/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "sync_resources" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Robrecht Cannoodt" roles: @@ -174,7 +174,7 @@ engines: id: "docker" image: "alpine:3" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apk" @@ -196,12 +196,12 @@ build_info: engine: "docker|native" output: "target/executable/sync_resources" executable: "target/executable/sync_resources/sync_resources" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -217,14 +217,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/sync_resources/sync_resources b/target/executable/sync_resources/sync_resources index 4135fe2..6c2c63a 100755 --- a/target/executable/sync_resources/sync_resources +++ b/target/executable/sync_resources/sync_resources @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# sync_resources v0.3.1 +# sync_resources v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -455,10 +455,10 @@ RUN rclone config create s3 s3 anonymous=true RUN rclone config create gs gcs anonymous=true LABEL org.opencontainers.image.authors="Robrecht Cannoodt, Dries Schaumont" LABEL org.opencontainers.image.description="Companion container for running component sync_resources" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -575,7 +575,7 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "sync_resources v0.3.1" + echo "sync_resources v0.3.2" echo "" echo "Sync a Viash package's test resources to the local filesystem based on the" echo "the \`.info.test_resources\` field in the \`_viash.yaml\` file. This is useful for" @@ -654,7 +654,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "sync_resources v0.3.1" + echo "sync_resources v0.3.2" exit ;; --input) @@ -801,7 +801,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/sync_resources:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/sync_resources:v0.3.2' fi # print dockerfile diff --git a/target/executable/untar/.config.vsh.yaml b/target/executable/untar/.config.vsh.yaml index b82c706..f76e9d0 100644 --- a/target/executable/untar/.config.vsh.yaml +++ b/target/executable/untar/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "untar" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dries Schaumont" roles: @@ -164,7 +164,7 @@ engines: id: "docker" image: "debian:stable-slim" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -181,12 +181,12 @@ build_info: engine: "docker|native" output: "target/executable/untar" executable: "target/executable/untar/untar" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -202,14 +202,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/executable/untar/untar b/target/executable/untar/untar index 292f155..e80d9d3 100755 --- a/target/executable/untar/untar +++ b/target/executable/untar/untar @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# untar v0.3.1 +# untar v0.3.2 # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -455,10 +455,10 @@ RUN apt-get update && \ LABEL org.opencontainers.image.authors="Dries Schaumont, Robrecht Cannoodt" LABEL org.opencontainers.image.description="Companion container for running component untar" -LABEL org.opencontainers.image.created="2025-11-20T15:16:24Z" +LABEL org.opencontainers.image.created="2026-03-03T15:11:57Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/craftbox" -LABEL org.opencontainers.image.revision="4acf73e0255554766186f4016986782c0d25c309" -LABEL org.opencontainers.image.version="v0.3.1" +LABEL org.opencontainers.image.revision="7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" +LABEL org.opencontainers.image.version="v0.3.2" VIASHDOCKER fi @@ -575,7 +575,7 @@ VIASH_DOCKER_RUN_ARGS=(-i --rm) # ViashHelp: Display helpful explanation about this executable function ViashHelp { - echo "untar v0.3.1" + echo "untar v0.3.2" echo "" echo "Unpack a .tar file. When the contents of the .tar file is just a single" echo "directory," @@ -646,7 +646,7 @@ while [[ $# -gt 0 ]]; do shift 1 ;; --version) - echo "untar v0.3.1" + echo "untar v0.3.2" exit ;; --input) @@ -776,7 +776,7 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then # determine docker image id if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then - VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/untar:v0.3.1' + VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/craftbox/untar:v0.3.2' fi # print dockerfile diff --git a/target/nextflow/check_disk_space/.config.vsh.yaml b/target/nextflow/check_disk_space/.config.vsh.yaml index f211430..5cb8a16 100644 --- a/target/nextflow/check_disk_space/.config.vsh.yaml +++ b/target/nextflow/check_disk_space/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "check_disk_space" -version: "v0.3.1" +version: "v0.3.2" argument_groups: - name: "Inputs" arguments: @@ -144,7 +144,7 @@ engines: id: "docker" image: "bash:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" entrypoint: [] cmd: null @@ -156,12 +156,12 @@ build_info: engine: "docker|native" output: "target/nextflow/check_disk_space" executable: "target/nextflow/check_disk_space/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -177,14 +177,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/check_disk_space/main.nf b/target/nextflow/check_disk_space/main.nf index 7b1585d..4aac38f 100644 --- a/target/nextflow/check_disk_space/main.nf +++ b/target/nextflow/check_disk_space/main.nf @@ -1,6 +1,6 @@ -// check_disk_space v0.3.1 +// check_disk_space v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1350,47 +1350,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1706,10 +1701,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3031,7 +3041,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "check_disk_space", - "version" : "v0.3.1", + "version" : "v0.3.2", "argument_groups" : [ { "name" : "Inputs", @@ -3202,7 +3212,7 @@ meta = [ "id" : "docker", "image" : "bash:latest", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/" }, { @@ -3215,23 +3225,23 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/check_disk_space", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3685,7 +3695,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/check_disk_space", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/check_disk_space/nextflow.config b/target/nextflow/check_disk_space/nextflow.config index 0e25549..cae93fc 100644 --- a/target/nextflow/check_disk_space/nextflow.config +++ b/target/nextflow/check_disk_space/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'check_disk_space' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' + version = 'v0.3.2' description = 'Check for available disk space on the system.\n\nThis component is only useful when working with persistent storage environments\nwhere all workflow steps execute on the same instance or share the same\nstorage volume. That is, running thus component on e.g. AWS Batch or\nother cloud-based systems will not work as expected, since each step\ncan run on a different instance and resources will not be shared.\n\nFor distributed environments, consider integrating resource checks directly\ninto the components that will actually consume the storage, rather than\nusing this standalone check.\n' } diff --git a/target/nextflow/concat_text/.config.vsh.yaml b/target/nextflow/concat_text/.config.vsh.yaml index 387448f..1a41915 100644 --- a/target/nextflow/concat_text/.config.vsh.yaml +++ b/target/nextflow/concat_text/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "concat_text" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Toni Verbeiren" roles: @@ -171,7 +171,7 @@ engines: id: "docker" image: "alpine:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apk" @@ -189,12 +189,12 @@ build_info: engine: "docker|native" output: "target/nextflow/concat_text" executable: "target/nextflow/concat_text/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -210,14 +210,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/concat_text/main.nf b/target/nextflow/concat_text/main.nf index 8a0778b..0830d33 100644 --- a/target/nextflow/concat_text/main.nf +++ b/target/nextflow/concat_text/main.nf @@ -1,6 +1,6 @@ -// concat_text v0.3.1 +// concat_text v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "concat_text", - "version" : "v0.3.1", + "version" : "v0.3.2", "authors" : [ { "name" : "Toni Verbeiren", @@ -3265,7 +3275,7 @@ meta = [ "id" : "docker", "image" : "alpine:latest", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/", "setup" : [ { @@ -3288,23 +3298,23 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/concat_text", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3798,7 +3808,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/concat_text", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/concat_text/nextflow.config b/target/nextflow/concat_text/nextflow.config index 54be526..797f903 100644 --- a/target/nextflow/concat_text/nextflow.config +++ b/target/nextflow/concat_text/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'concat_text' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' + version = 'v0.3.2' description = 'Concatenate a number of text files, handle gzipped text files gracefully and\noptionally gzip the output text file.\n\nThis component is useful for concatening fastq files from different lanes, for instance.\n' author = 'Toni Verbeiren, Dries Schaumont, Robrecht Cannoodt' } diff --git a/target/nextflow/csv2fasta/.config.vsh.yaml b/target/nextflow/csv2fasta/.config.vsh.yaml index 02b8096..cd7170a 100644 --- a/target/nextflow/csv2fasta/.config.vsh.yaml +++ b/target/nextflow/csv2fasta/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "csv2fasta" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dries Schaumont" roles: @@ -227,7 +227,7 @@ engines: id: "docker" image: "python:slim" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -256,12 +256,12 @@ build_info: engine: "docker|native" output: "target/nextflow/csv2fasta" executable: "target/nextflow/csv2fasta/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -277,14 +277,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/csv2fasta/main.nf b/target/nextflow/csv2fasta/main.nf index 997ea01..33abe13 100644 --- a/target/nextflow/csv2fasta/main.nf +++ b/target/nextflow/csv2fasta/main.nf @@ -1,6 +1,6 @@ -// csv2fasta v0.3.1 +// csv2fasta v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "csv2fasta", - "version" : "v0.3.1", + "version" : "v0.3.2", "authors" : [ { "name" : "Dries Schaumont", @@ -3310,7 +3320,7 @@ meta = [ "id" : "docker", "image" : "python:slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/", "setup" : [ { @@ -3351,23 +3361,23 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/csv2fasta", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3911,7 +3921,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/csv2fasta", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/csv2fasta/nextflow.config b/target/nextflow/csv2fasta/nextflow.config index 02c5b14..fa781c0 100644 --- a/target/nextflow/csv2fasta/nextflow.config +++ b/target/nextflow/csv2fasta/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'csv2fasta' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' + version = 'v0.3.2' description = 'Convert two columns from a CSV file to FASTA entries. The CSV file can\ncontain an optional header and each row (other than the header) becomes\na single FASTA record. One of the two columns will be used as the names\nfor the FASTA entries, while the other become the sequences. The sequences\ncolumn must only contain characters that are valid IUPAC notation for \nnucleotides or a group thereof (wildcard characters).\n' author = 'Dries Schaumont, Robrecht Cannoodt' } diff --git a/target/nextflow/move_files_to_directory/.config.vsh.yaml b/target/nextflow/move_files_to_directory/.config.vsh.yaml index 1d71c07..3b7346d 100644 --- a/target/nextflow/move_files_to_directory/.config.vsh.yaml +++ b/target/nextflow/move_files_to_directory/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "move_files_to_directory" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dorien Roosen" roles: @@ -14,11 +14,12 @@ authors: href: "https://www.data-intuitive.com" role: "Data Scientist" argument_groups: -- name: "Arguments" +- name: "Inputs" arguments: - type: "file" name: "--input" - description: "Paths of the files that will be copied into the output directory." + description: "Paths of the files or directories that will be copied into the output\ + \ directory." info: null must_exist: true create_parent: true @@ -26,9 +27,11 @@ argument_groups: direction: "input" multiple: true multiple_sep: ";" +- name: "Outputs" + arguments: - type: "file" name: "--output" - description: "Path to output directory" + description: "Path to output directory." info: null must_exist: true create_parent: true @@ -36,20 +39,22 @@ argument_groups: direction: "output" multiple: false multiple_sep: ";" +- name: "Options" + arguments: - type: "boolean_true" name: "--keep_symbolic_links" - alternatives: - - "-d" - description: "Preserve symbolic links." + description: "When set, symbolic links are preserved as symbolic links in the\ + \ output directory. By default, symbolic links are dereferenced and the target\ + \ file is copied." info: null direction: "input" resources: - type: "bash_script" path: "script.sh" is_executable: true -summary: "Publish one or multiple files to the same directory" -description: "This component copies one or multiple files to the same destination\ - \ directory, creating the output directory if it doesn't exist." +summary: "Publish one or multiple files or directories to the same output directory." +description: "This component copies one or multiple files or directories\nto the same\ + \ destination directory, creating the output directory if it doesn't\nexist.\n" test_resources: - type: "bash_script" path: "test.sh" @@ -135,7 +140,7 @@ engines: id: "docker" image: "debian:latest" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -146,18 +151,20 @@ engines: cmd: null - type: "native" id: "native" +- type: "native" + id: "native" build_info: config: "src/move_files_to_directory/config.vsh.yaml" runner: "nextflow" - engine: "docker|native" + engine: "docker|native|native" output: "target/nextflow/move_files_to_directory" executable: "target/nextflow/move_files_to_directory/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -173,14 +180,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/move_files_to_directory/main.nf b/target/nextflow/move_files_to_directory/main.nf index ca53281..fd593d5 100644 --- a/target/nextflow/move_files_to_directory/main.nf +++ b/target/nextflow/move_files_to_directory/main.nf @@ -1,6 +1,6 @@ -// move_files_to_directory v0.3.1 +// move_files_to_directory v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3034,7 +3044,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "move_files_to_directory", - "version" : "v0.3.1", + "version" : "v0.3.2", "authors" : [ { "name" : "Dorien Roosen", @@ -3059,37 +3069,44 @@ meta = [ ], "argument_groups" : [ { - "name" : "Arguments", + "name" : "Inputs", "arguments" : [ { "type" : "file", "name" : "--input", - "description" : "Paths of the files that will be copied into the output directory.", + "description" : "Paths of the files or directories that will be copied into the output directory.", "must_exist" : true, "create_parent" : true, "required" : true, "direction" : "input", "multiple" : true, "multiple_sep" : ";" - }, + } + ] + }, + { + "name" : "Outputs", + "arguments" : [ { "type" : "file", "name" : "--output", - "description" : "Path to output directory", + "description" : "Path to output directory.", "must_exist" : true, "create_parent" : true, "required" : true, "direction" : "output", "multiple" : false, "multiple_sep" : ";" - }, + } + ] + }, + { + "name" : "Options", + "arguments" : [ { "type" : "boolean_true", "name" : "--keep_symbolic_links", - "alternatives" : [ - "-d" - ], - "description" : "Preserve symbolic links.", + "description" : "When set, symbolic links are preserved as symbolic links in the output directory. By default, symbolic links are dereferenced and the target file is copied.", "direction" : "input" } ] @@ -3102,8 +3119,8 @@ meta = [ "is_executable" : true } ], - "summary" : "Publish one or multiple files to the same directory", - "description" : "This component copies one or multiple files to the same destination directory, creating the output directory if it doesn't exist.", + "summary" : "Publish one or multiple files or directories to the same output directory.", + "description" : "This component copies one or multiple files or directories\nto the same destination directory, creating the output directory if it doesn't\nexist.\n", "test_resources" : [ { "type" : "bash_script", @@ -3205,7 +3222,7 @@ meta = [ "id" : "docker", "image" : "debian:latest", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/", "setup" : [ { @@ -3217,6 +3234,10 @@ meta = [ } ] }, + { + "type" : "native", + "id" : "native" + }, { "type" : "native", "id" : "native" @@ -3225,25 +3246,25 @@ meta = [ "build_info" : { "config" : "/workdir/root/repo/src/move_files_to_directory/config.vsh.yaml", "runner" : "nextflow", - "engine" : "docker|native", + "engine" : "docker|native|native", "output" : "target/nextflow/move_files_to_directory", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3300,27 +3321,33 @@ $( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "${VIASH_META_MEMORY_PIB}" ## VIASH END - if [[ ! -d "\\$par_output" ]]; then mkdir -p "\\$par_output" fi -extra_params=( ) - -if [ "\\$par_keep_symbolic_links" == "true" ]; then - extra_params+=( "-d" ) +# Set copy flags based on options +if [[ "\\$par_keep_symbolic_links" == "true" ]]; then + # -a implies -dR --preserve=all + # with -d: same as --no-dereference (and --preserve=links) + # and --no-dereference: never follow symbolic links in SOURCE + # and -R, -r, --recursive: copy directories recursively + # --keep-directory-symlink: if the destination already exists and is a + # symbolic link to a directory, follow the symlink and copy into the directory + # it points to, instead of removing the symlink and creating a real directory in its place. + cp_flags="-a --keep-directory-symlink" +else + # -L: always follow symbolic links in SOURCE + cp_flags="-Lr --preserve=all --no-preserve=link --keep-directory-symlink" fi -# Process multiple input files -IFS=";" read -ra input_files <<< "\\$par_input" -for file in "\\${input_files[@]}"; do - # Check if the file exists before copying - if [[ -f "\\$file" ]]; then - - cp \\${extra_params[@]} "\\$file" "\\$par_output/" - echo "Copied \\$file to \\$par_output/" +# Process multiple input paths (files or directories) +IFS=";" read -ra input_paths <<< "\\$par_input" +for path in "\\${input_paths[@]}"; do + if [[ -e "\\$path" ]] || [[ -L "\\$path" ]]; then + cp \\$cp_flags "\\$path" "\\$par_output/" + echo "Copied \\$path to \\$par_output/" else - echo "Warning: Input file \\$file does not exist, skipping" + echo "Warning: Input path \\$path does not exist, skipping" fi done VIASHMAIN @@ -3705,7 +3732,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/move_files_to_directory", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/move_files_to_directory/nextflow.config b/target/nextflow/move_files_to_directory/nextflow.config index 6aa9007..7bb82dc 100644 --- a/target/nextflow/move_files_to_directory/nextflow.config +++ b/target/nextflow/move_files_to_directory/nextflow.config @@ -2,8 +2,8 @@ manifest { name = 'move_files_to_directory' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' - description = 'This component copies one or multiple files to the same destination directory, creating the output directory if it doesn\'t exist.' + version = 'v0.3.2' + description = 'This component copies one or multiple files or directories\nto the same destination directory, creating the output directory if it doesn\'t\nexist.\n' author = 'Dorien Roosen' } diff --git a/target/nextflow/move_files_to_directory/nextflow_schema.json b/target/nextflow/move_files_to_directory/nextflow_schema.json index 7ea5f60..ec3370c 100644 --- a/target/nextflow/move_files_to_directory/nextflow_schema.json +++ b/target/nextflow/move_files_to_directory/nextflow_schema.json @@ -1,11 +1,11 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "move_files_to_directory", - "description": "This component copies one or multiple files to the same destination directory, creating the output directory if it doesn't exist.", + "description": "This component copies one or multiple files or directories\nto the same destination directory, creating the output directory if it doesn't\nexist.\n", "type": "object", "$defs": { - "arguments": { - "title": "Arguments", + "inputs": { + "title": "Inputs", "type": "object", "description": "No description", "properties": { @@ -16,19 +16,33 @@ }, "format": "path", "exists": true, - "description": "Paths of the files that will be copied into the output directory.", + "description": "Paths of the files or directories that will be copied into the output directory.", "help_text": "Type: `file`, multiple: `True`, required, direction: `input`. " - }, + } + } + }, + "outputs": { + "title": "Outputs", + "type": "object", + "description": "No description", + "properties": { "output": { "type": "string", "format": "path", - "description": "Path to output directory", + "description": "Path to output directory.", "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.output\"`, direction: `output`. ", "default": "$id.$key.output" - }, + } + } + }, + "options": { + "title": "Options", + "type": "object", + "description": "No description", + "properties": { "keep_symbolic_links": { "type": "boolean", - "description": "Preserve symbolic links.", + "description": "When set, symbolic links are preserved as symbolic links in the output directory", "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", "default": false } @@ -49,7 +63,13 @@ }, "allOf": [ { - "$ref": "#/$defs/arguments" + "$ref": "#/$defs/inputs" + }, + { + "$ref": "#/$defs/outputs" + }, + { + "$ref": "#/$defs/options" }, { "$ref": "#/$defs/nextflow input-output arguments" diff --git a/target/nextflow/sync_resources/.config.vsh.yaml b/target/nextflow/sync_resources/.config.vsh.yaml index 12b6e8d..520527b 100644 --- a/target/nextflow/sync_resources/.config.vsh.yaml +++ b/target/nextflow/sync_resources/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "sync_resources" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Robrecht Cannoodt" roles: @@ -174,7 +174,7 @@ engines: id: "docker" image: "alpine:3" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apk" @@ -196,12 +196,12 @@ build_info: engine: "docker|native" output: "target/nextflow/sync_resources" executable: "target/nextflow/sync_resources/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -217,14 +217,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/sync_resources/main.nf b/target/nextflow/sync_resources/main.nf index 2c7dbf6..7a9c06e 100644 --- a/target/nextflow/sync_resources/main.nf +++ b/target/nextflow/sync_resources/main.nf @@ -1,6 +1,6 @@ -// sync_resources v0.3.1 +// sync_resources v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "sync_resources", - "version" : "v0.3.1", + "version" : "v0.3.2", "authors" : [ { "name" : "Robrecht Cannoodt", @@ -3263,7 +3273,7 @@ meta = [ "id" : "docker", "image" : "alpine:3", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/", "setup" : [ { @@ -3293,23 +3303,23 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/sync_resources", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3772,7 +3782,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/sync_resources", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/sync_resources/nextflow.config b/target/nextflow/sync_resources/nextflow.config index 22a530c..6b97735 100644 --- a/target/nextflow/sync_resources/nextflow.config +++ b/target/nextflow/sync_resources/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'sync_resources' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' + version = 'v0.3.2' description = 'Sync a Viash package\'s test resources to the local filesystem based on the\nthe `.info.test_resources` field in the `_viash.yaml` file. This is useful for\ntesting and debugging purposes.\n' author = 'Robrecht Cannoodt, Dries Schaumont' } diff --git a/target/nextflow/untar/.config.vsh.yaml b/target/nextflow/untar/.config.vsh.yaml index 54eeffc..cc191b0 100644 --- a/target/nextflow/untar/.config.vsh.yaml +++ b/target/nextflow/untar/.config.vsh.yaml @@ -1,5 +1,5 @@ name: "untar" -version: "v0.3.1" +version: "v0.3.2" authors: - name: "Dries Schaumont" roles: @@ -164,7 +164,7 @@ engines: id: "docker" image: "debian:stable-slim" target_registry: "images.viash-hub.com" - target_tag: "v0.3.1" + target_tag: "v0.3.2" namespace_separator: "/" setup: - type: "apt" @@ -181,12 +181,12 @@ build_info: engine: "docker|native" output: "target/nextflow/untar" executable: "target/nextflow/untar/main.nf" - viash_version: "0.9.4" - git_commit: "4acf73e0255554766186f4016986782c0d25c309" + viash_version: "0.9.7" + git_commit: "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9" git_remote: "https://github.com/viash-hub/craftbox" package_config: name: "craftbox" - version: "v0.3.1" + version: "v0.3.2" summary: "A collection of custom-tailored scripts and applied utilities built with\ \ Viash.\n" description: "`craftbox` is a curated collection of custom scripts and utilities\ @@ -202,14 +202,14 @@ package_config: \ to ensure dependency management and a consistent, reproducible runtime environment.\n\ \ * Unit tested where applicable to ensure components function as expected.\n" info: null - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: - ".requirements.commands := ['ps']\n" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + - ".engines[.type == 'docker'].target_tag := 'v0.3.2'" keywords: - "scripts" - "custom" diff --git a/target/nextflow/untar/main.nf b/target/nextflow/untar/main.nf index 84094bf..ab87a42 100644 --- a/target/nextflow/untar/main.nf +++ b/target/nextflow/untar/main.nf @@ -1,6 +1,6 @@ -// untar v0.3.1 +// untar v0.3.2 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "resources_dir": moduleDir.toRealPath().normalize(), "config": processConfig(readJsonBlob('''{ "name" : "untar", - "version" : "v0.3.1", + "version" : "v0.3.2", "authors" : [ { "name" : "Dries Schaumont", @@ -3250,7 +3260,7 @@ meta = [ "id" : "docker", "image" : "debian:stable-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v0.3.1", + "target_tag" : "v0.3.2", "namespace_separator" : "/", "setup" : [ { @@ -3272,23 +3282,23 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/untar", - "viash_version" : "0.9.4", - "git_commit" : "4acf73e0255554766186f4016986782c0d25c309", + "viash_version" : "0.9.7", + "git_commit" : "7d520dc76cb6b3f1eaece9afcc9a3458ca82afe9", "git_remote" : "https://github.com/viash-hub/craftbox" }, "package_config" : { "name" : "craftbox", - "version" : "v0.3.1", + "version" : "v0.3.2", "summary" : "A collection of custom-tailored scripts and applied utilities built with Viash.\n", "description" : "`craftbox` is a curated collection of custom scripts and utilities designed to tackle context-specific tasks.\n\nEmphasizing the Viash principles, `craftbox` components aim for **reusability**, **reproducibility**, and adherence to **best practices**. Key features generally include:\n\n* **Standalone & Nextflow Ready:** Components are built to run directly via the command line or be smoothly integrated into Nextflow workflows.\n* **Custom Implementations:** Contains scripts and tools developed for particular tasks that may not be found in broader collections.\n* **High Quality Standards (promoted by Viash):**\n * Clear documentation for components and their parameters.\n * Full exposure of underlying script/tool arguments for fine-grained control.\n * Containerized (Docker) to ensure dependency management and a consistent, reproducible runtime environment.\n * Unit tested where applicable to ensure components function as expected.\n", - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "src", "target" : "target", "config_mods" : [ ".requirements.commands := ['ps']\n", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v0.3.1'" + ".engines[.type == 'docker'].target_tag := 'v0.3.2'" ], "keywords" : [ "scripts", @@ -3762,7 +3772,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/craftbox/untar", - "tag" : "v0.3.1" + "tag" : "v0.3.2" }, "tag" : "$id" }'''), diff --git a/target/nextflow/untar/nextflow.config b/target/nextflow/untar/nextflow.config index 52438a8..f09ebfc 100644 --- a/target/nextflow/untar/nextflow.config +++ b/target/nextflow/untar/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'untar' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v0.3.1' + version = 'v0.3.2' description = 'Unpack a .tar file. When the contents of the .tar file is just a single directory,\nput the contents of the directory into the output folder instead of that directory.\n' author = 'Dries Schaumont, Robrecht Cannoodt' }