summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-10-22 10:50:41 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-10-22 10:50:41 +0100
commit7f52ffc37e1a366f78ba3709f15b09ca22ca98c9 (patch)
treebd5320a7d5493a294fea27972111d54a3a024de8 /share
parent5ce95579e42171913b0fabbb51b2beca66854ae4 (diff)
downloadsubplot-7f52ffc37e1a366f78ba3709f15b09ca22ca98c9.tar.gz
(steplibrary): Update files and runcmd to use new path type
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'share')
-rw-r--r--share/common/lib/files.yaml68
-rw-r--r--share/common/lib/runcmd.yaml12
2 files changed, 68 insertions, 12 deletions
diff --git a/share/common/lib/files.yaml b/share/common/lib/files.yaml
index e4d9b6b..cb39b96 100644
--- a/share/common/lib/files.yaml
+++ b/share/common/lib/files.yaml
@@ -18,15 +18,18 @@
python:
function: files_create_from_embedded_with_other_name
types:
+ filename_on_disk: path
embedded_file: file
-- when: I write "(?P<text>.*)" to file (?P<filename>\S+)
- regex: true
+- when: I write "{text}" to file {filename}
impl:
rust:
function: subplotlib::steplibrary::files::create_from_text
python:
function: files_create_from_text
+ types:
+ filename: path
+ text: text
# Manage directories (distinct from files).
@@ -36,6 +39,8 @@
function: subplotlib::steplibrary::files::make_directory
python:
function: files_make_directory
+ types:
+ path: path
- when: I create directory {path}
impl:
@@ -43,6 +48,8 @@
function: subplotlib::steplibrary::files::make_directory
python:
function: files_make_directory
+ types:
+ path: path
- when: I remove directory {path}
impl:
@@ -50,6 +57,8 @@
function: subplotlib::steplibrary::files::remove_directory
python:
function: files_remove_directory
+ types:
+ path: path
- then: directory {path} exists
impl:
@@ -57,6 +66,8 @@
function: subplotlib::steplibrary::files::path_exists
python:
function: files_directory_exists
+ types:
+ path: path
- then: directory {path} does not exist
impl:
@@ -64,6 +75,8 @@
function: subplotlib::steplibrary::files::path_does_not_exist
python:
function: files_directory_does_not_exist
+ types:
+ path: path
- then: directory {path} is empty
impl:
@@ -71,6 +84,8 @@
function: subplotlib::steplibrary::files::path_is_empty
python:
function: files_directory_is_empty
+ types:
+ path: path
- then: directory {path} is not empty
impl:
@@ -78,6 +93,8 @@
function: subplotlib::steplibrary::files::path_is_not_empty
python:
function: files_directory_is_not_empty
+ types:
+ path: path
# File metadata management and testing.
@@ -89,6 +106,7 @@
python:
function: files_touch_with_timestamp
types:
+ filename: path
mtime: text
- when: I remember metadata for file {filename}
@@ -97,6 +115,8 @@
function: subplotlib::steplibrary::files::remember_metadata
python:
function: files_remember_metadata
+ types:
+ filename: path
- when: I touch file {filename}
impl:
@@ -104,6 +124,8 @@
function: subplotlib::steplibrary::files::touch
python:
function: files_touch
+ types:
+ filename: path
- then: file {filename} has same metadata as before
impl:
@@ -111,6 +133,8 @@
function: subplotlib::steplibrary::files::has_remembered_metadata
python:
function: files_has_remembered_metadata
+ types:
+ filename: path
- then: file {filename} has different metadata from before
impl:
@@ -118,6 +142,8 @@
function: subplotlib::steplibrary::files::has_different_metadata
python:
function: files_has_different_metadata
+ types:
+ filename: path
- then: file {filename} has changed from before
impl:
@@ -125,6 +151,8 @@
function: subplotlib::steplibrary::files::has_different_metadata
python:
function: files_has_different_metadata
+ types:
+ filename: path
- then: file {filename} has a very recent modification time
impl:
@@ -132,6 +160,8 @@
function: subplotlib::steplibrary::files::mtime_is_recent
python:
function: files_mtime_is_recent
+ types:
+ filename: path
- then: file {filename} has a very old modification time
impl:
@@ -139,6 +169,8 @@
function: subplotlib::steplibrary::files::mtime_is_ancient
python:
function: files_mtime_is_ancient
+ types:
+ filename: path
# Testing file existence.
@@ -148,6 +180,8 @@
function: subplotlib::steplibrary::files::file_exists
python:
function: files_file_exists
+ types:
+ filename: path
- then: file {filename} does not exist
impl:
@@ -155,6 +189,8 @@
function: subplotlib::steplibrary::files::file_does_not_exist
python:
function: files_file_does_not_exist
+ types:
+ filename: path
- then: only files (?P<filenames>.+) exist
impl:
@@ -166,37 +202,45 @@
# Tests on file content.
-- then: file (?P<filename>\S+) contains "(?P<data>.*)"
- regex: true
+- then: file {filename} contains "{data}"
impl:
rust:
function: subplotlib::steplibrary::files::file_contains
python:
function: files_file_contains
+ types:
+ filename: path
+ data: text
-- then: file (?P<filename>\S+) doesn't contain "(?P<data>.*)"
- regex: true
+- then: file {filename} doesn't contain "{data}"
impl:
rust:
function: subplotlib::steplibrary::files::file_doesnt_contain
python:
function: files_file_doesnt_contain
+ types:
+ filename: path
+ data: text
-- then: file (?P<filename>\S+) matches regex /(?P<regex>.*)/
- regex: true
+- then: file {filename} matches regex /{regex}/
impl:
rust:
function: subplotlib::steplibrary::files::file_matches_regex
python:
function: files_file_matches_regex
+ types:
+ filename: path
+ regex: text
-- then: file (?P<filename>\S+) matches regex "(?P<regex>.*)"
- regex: true
+- then: file {filename} matches regex "{regex}"
impl:
rust:
function: subplotlib::steplibrary::files::file_matches_regex
python:
function: files_file_matches_regex
+ types:
+ filename: path
+ regex: text
- then: files {filename1} and {filename2} match
impl:
@@ -204,3 +248,7 @@
function: subplotlib::steplibrary::files::file_match
python:
function: files_match
+ types:
+ filename1: path
+ filename2: path
+
diff --git a/share/common/lib/runcmd.yaml b/share/common/lib/runcmd.yaml
index 5847613..7be2c05 100644
--- a/share/common/lib/runcmd.yaml
+++ b/share/common/lib/runcmd.yaml
@@ -23,12 +23,16 @@
rust:
function: subplotlib::steplibrary::runcmd::run
-- when: I run, in {dirname}, {argv0}{args:text}
+- when: I run, in {dirname}, {argv0}{args}
impl:
python:
function: runcmd_step_in
rust:
function: subplotlib::steplibrary::runcmd::run_in
+ types:
+ dirname: path
+ argv0: word
+ args: text
- when: I try to run {argv0}{args:text}
impl:
@@ -37,12 +41,16 @@
rust:
function: subplotlib::steplibrary::runcmd::try_to_run
-- when: I try to run, in {dirname}, {argv0}{args:text}
+- when: I try to run, in {dirname}, {argv0}{args}
impl:
python:
function: runcmd_try_to_run_in
rust:
function: subplotlib::steplibrary::runcmd::try_to_run_in
+ types:
+ dirname: path
+ argv0: word
+ args: text
# Steps to examine exit code of latest command.