summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-03-28 17:13:27 +0300
committerLars Wirzenius <liw@liw.fi>2021-03-29 10:38:23 +0300
commit3783b6ace86957c95e5137c7645af319dd2462e9 (patch)
treef4649980e94680e9c277611e4c7b7988d0591f96 /subplot
parent53db547b3a4dc45aaa33b24f5b85da1e3397a38d (diff)
downloadbumper-rs-3783b6ace86957c95e5137c7645af319dd2462e9.tar.gz
feat: set version in Cargo.toml for Rust projects
Diffstat (limited to 'subplot')
-rw-r--r--subplot/bumper.py16
-rw-r--r--subplot/bumper.yaml6
-rw-r--r--subplot/vendored/files.py2
3 files changed, 23 insertions, 1 deletions
diff --git a/subplot/bumper.py b/subplot/bumper.py
index 0e6a0ef..3198e13 100644
--- a/subplot/bumper.py
+++ b/subplot/bumper.py
@@ -34,6 +34,22 @@ def run_command_in_directory(ctx, dirname=None, argv0=None, args=None):
runcmd_exit_code_is_zero(ctx)
+def try_to_run_command_in_directory(ctx, dirname=None, argv0=None, args=None):
+ runcmd_run = globals()["runcmd_run"]
+
+ argv = [shlex.quote(argv0)] + shlex.split(args)
+ runcmd_run(ctx, argv, cwd=dirname)
+
+
+def only_these_files_exist_in(ctx, filenames=None, dirname=None):
+ assert_eq = globals()["assert_eq"]
+ expect = list(sorted(x for x in filenames.replace(",", "").split() if x != "and"))
+ actual = list(sorted(os.listdir(dirname)))
+ logging.debug(f"expect files; {expect}")
+ logging.debug(f"actual files; {actual}")
+ assert_eq(expect, actual)
+
+
def git_tag_points_at(ctx, dirname=None, tag=None, varname=None):
runcmd_run = globals()["runcmd_run"]
runcmd_get_stdout = globals()["runcmd_get_stdout"]
diff --git a/subplot/bumper.yaml b/subplot/bumper.yaml
index 7b95dac..d1ee4f0 100644
--- a/subplot/bumper.yaml
+++ b/subplot/bumper.yaml
@@ -9,6 +9,12 @@
- when: "I run, in {dirname}, {argv0}{args:text}"
function: run_command_in_directory
+
+- when: "I try to run, in {dirname}, {argv0}{args:text}"
+ function: try_to_run_command_in_directory
+
+- then: "only files {filenames:text} exist in {dirname}"
+ function: only_these_files_exist_in
- then: "in {dirname}, git tag {tag} is a signed tag pointing at <{varname}>"
function: git_tag_points_at
diff --git a/subplot/vendored/files.py b/subplot/vendored/files.py
index dd5b9f8..d3b96fc 100644
--- a/subplot/vendored/files.py
+++ b/subplot/vendored/files.py
@@ -92,7 +92,7 @@ def files_file_matches_regex(ctx, filename=None, regex=None):
logging.debug(f"files_file_matches_regex: no match")
logging.debug(f" filenamed: {filename}")
logging.debug(f" regex: {regex}")
- logging.debug(f" content: {regex}")
+ logging.debug(f" content: {content}")
logging.debug(f" match: {m}")
assert_eq(bool(m), True)