From d13ba66c9582ddd1822379f75213fe64e84eb894 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Wed, 15 Jun 2022 18:20:23 -0700 Subject: [PATCH 1/3] Continue on fail when running tar on MacOS. The subsequent assertions make `run` over `try` moot. --- features/dist-archive.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/dist-archive.feature b/features/dist-archive.feature index e5a5132..d574f9f 100644 --- a/features/dist-archive.feature +++ b/features/dist-archive.feature @@ -46,7 +46,7 @@ Feature: Generate a distribution archive of a project When I run `wp plugin delete hello-world` Then the wp-content/plugins/hello-world directory should not exist - When I run `cd wp-content/plugins/ && tar -zxvf hello-world.0.1.0.tar.gz` + When I try `cd wp-content/plugins/ && tar -zxvf hello-world.0.1.0.tar.gz` Then the wp-content/plugins/hello-world directory should exist And the wp-content/plugins/hello-world/hello-world.php file should exist And the wp-content/plugins/hello-world/.travis.yml file should not exist @@ -138,7 +138,7 @@ Feature: Generate a distribution archive of a project When I run `rm -rf foo` Then the foo directory should not exist - When I run ` foo.` + When I try ` foo.` Then the foo directory should exist And the foo/test.php file should exist And the foo/test-dir/test.php file should exist From b904d3bdc64a20cb9a159d3d5b6fe9067fe1283d Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Wed, 15 Jun 2022 18:20:48 -0700 Subject: [PATCH 2/3] Conditionally use MacOS/Linux sed syntax --- features/dist-archive.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/dist-archive.feature b/features/dist-archive.feature index d574f9f..f148d18 100644 --- a/features/dist-archive.feature +++ b/features/dist-archive.feature @@ -205,7 +205,7 @@ Feature: Generate a distribution archive of a project And the wp-content/plugins/hello-world/.travis.yml file should exist And the wp-content/plugins/hello-world/bin directory should exist - When I run `sed -i wp-content/plugins/hello-world/hello-world.php -e "s/* Version/Version/" -e "s/0.1.0/0.2.0/"` + When I run `[[ $OSTYPE == 'darwin'* ]] && sed -i '' -e "s/* Version/Version/" -e "s/0.1.0/0.2.0/" wp-content/plugins/hello-world/hello-world.php || sed -i wp-content/plugins/hello-world/hello-world.php -e "s/* Version/Version/" -e "s/0.1.0/0.2.0/"` Then STDERR should be empty When I run `wp dist-archive wp-content/plugins/hello-world` From 727351208b1b377071de33e82349434f5e6741e5 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Fri, 17 Jun 2022 16:29:26 -0700 Subject: [PATCH 3/3] Use awk instead of sed --- features/dist-archive.feature | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/features/dist-archive.feature b/features/dist-archive.feature index f148d18..bf2f340 100644 --- a/features/dist-archive.feature +++ b/features/dist-archive.feature @@ -205,7 +205,9 @@ Feature: Generate a distribution archive of a project And the wp-content/plugins/hello-world/.travis.yml file should exist And the wp-content/plugins/hello-world/bin directory should exist - When I run `[[ $OSTYPE == 'darwin'* ]] && sed -i '' -e "s/* Version/Version/" -e "s/0.1.0/0.2.0/" wp-content/plugins/hello-world/hello-world.php || sed -i wp-content/plugins/hello-world/hello-world.php -e "s/* Version/Version/" -e "s/0.1.0/0.2.0/"` + When I run `awk '{sub("\\* Version","Version",$0); print}' {RUN_DIR}/wp-content/plugins/hello-world/hello-world.php > hello-world.tmp && mv hello-world.tmp {RUN_DIR}/wp-content/plugins/hello-world/hello-world.php` + Then STDERR should be empty + When I run `awk '{sub("0.1.0","0.2.0",$0); print}' {RUN_DIR}/wp-content/plugins/hello-world/hello-world.php > hello-world.tmp && mv hello-world.tmp {RUN_DIR}/wp-content/plugins/hello-world/hello-world.php` Then STDERR should be empty When I run `wp dist-archive wp-content/plugins/hello-world`