From 3783b6ace86957c95e5137c7645af319dd2462e9 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 28 Mar 2021 17:13:27 +0300 Subject: feat: set version in Cargo.toml for Rust projects --- subplot/bumper.py | 16 ++++++++++++++++ subplot/bumper.yaml | 6 ++++++ subplot/vendored/files.py | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'subplot') 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) -- cgit v1.2.1