From da7f01571203f74881608800f7d8e0cbf702f088 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Fri, 29 Sep 2023 07:05:30 -0500 Subject: [PATCH 01/14] save work --- .github/workflows/windows-spec.yml | 6 ++-- Changes | 1 + dev/mi6-new-Foo-Bar/0-README | 8 +++++ .../.github/workflows/{test.yml => linux.yml} | 14 ++++---- .../Foo-Bar/.github/workflows/macos.yml | 30 +++++++++++++++++ .../Foo-Bar/.github/workflows/windows.yml | 33 +++++++++++++++++++ lib/Mi6/Helper.rakumod | 18 +++++++--- 7 files changed, 95 insertions(+), 15 deletions(-) rename dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/{test.yml => linux.yml} (60%) create mode 100644 dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/macos.yml create mode 100644 dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/windows.yml diff --git a/.github/workflows/windows-spec.yml b/.github/workflows/windows-spec.yml index 9732c06..d7a56a2 100644 --- a/.github/workflows/windows-spec.yml +++ b/.github/workflows/windows-spec.yml @@ -26,6 +26,8 @@ jobs: with: raku-version: ${{ matrix.raku-version }} - name: Install Dependencies - run: zef --exclude="z" install --debug --/test --test-depends --deps-only . + run: | + choco install rakudostar + zef --exclude="z" install --debug --/test --test-depends --deps-only . - name: Run Tests - run: raku -I. t/01-load.t + run: zef --debug --/prove --/tap-harness test . diff --git a/Changes b/Changes index 4fd3678..4a098d4 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for Mi6-Helper {{$NEXT}} + - Use @ugexe's solution to replace prove6 - Get Windows testing to be more reliable by using Github workflows test lines like 'zef --exclude="z" install ..." (for Windows only, not needed for Linux or MacOS). diff --git a/dev/mi6-new-Foo-Bar/0-README b/dev/mi6-new-Foo-Bar/0-README index 5d523c6..9649d21 100644 --- a/dev/mi6-new-Foo-Bar/0-README +++ b/dev/mi6-new-Foo-Bar/0-README @@ -69,3 +69,11 @@ Foo-Bar/ This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. # is changed to better English:: This library is free software; you may redistribute it or modify it under the Artistic License 2.0. + +# 2023-09-29 + + .github/workflows + # 1. The single test.yml file has been split into separate OS files: + linux.yml + macos.yml + windows.yml diff --git a/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/test.yml b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/linux.yml similarity index 60% rename from dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/test.yml rename to dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/linux.yml index c8d3740..65b5b32 100644 --- a/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/test.yml +++ b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: test +name: Linux on: push: @@ -14,19 +14,17 @@ jobs: matrix: os: - ubuntu-latest - - macos-latest - - windows-latest raku-version: - 'latest' runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: Raku/setup-raku@v1 with: raku-version: ${{ matrix.raku-version }} - name: Install Dependencies - run: zef install --/test --test-depends --deps-only . - - name: Install App::Prove6 - run: zef install --/test App::Prove6 + run: | + zef install --/test --deps-only . + zef install --/test App::Prove6 - name: Run Tests - run: prove6 -I. t + run: prove6 -l t diff --git a/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/macos.yml b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/macos.yml new file mode 100644 index 0000000..91040a1 --- /dev/null +++ b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/macos.yml @@ -0,0 +1,30 @@ +name: MacOS + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + matrix: + os: + - macos-latest + raku-version: + - 'latest' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Install Dependencies + run: | + zef install --/test --deps-only . + zef install --/test App::Prove6 + - name: Run Tests + run: prove6 -l t diff --git a/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/windows.yml b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/windows.yml new file mode 100644 index 0000000..d7a56a2 --- /dev/null +++ b/dev/mi6-new-Foo-Bar/Foo-Bar/.github/workflows/windows.yml @@ -0,0 +1,33 @@ +name: Win64 + +env: + TEST_JOBS: 1 + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + matrix: + os: + - windows-latest + raku-version: + - '2022.07' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Install Dependencies + run: | + choco install rakudostar + zef --exclude="z" install --debug --/test --test-depends --deps-only . + - name: Run Tests + run: zef --debug --/prove --/tap-harness test . diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 894f270..f0b62d1 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -96,7 +96,7 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export } @omodfil.push: $line; } - # put ramaining content in the README.rakudoc file + # put remaining content in the README.rakudoc file @idocfil.push($_) for @imodfil; # treat the README file @@ -118,8 +118,8 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export } elsif $line ~~ /^ \h* Copyright/ { # use copyright symbol - # Copyright © 2021 Tom Browder - # Copyright E<0x00a9> 2021 Tom Browder + # Copyright © 2023 Tom Browder + # Copyright E<0x00a9> 2023 Tom Browder $line ~~ s/Copyright/©/; } elsif $line ~~ /^ \h* This \h+ library/ { @@ -148,18 +148,24 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export $fh.say($_) for @omodfil; $fh.close; - # mod the .github/workflows/test.yml files + # use the .github/workflows/*.yml files as I've updated them + + =begin comment my $testfil = "$modpdir/.github/workflows/test.yml"; my @itestfil = $testfil.IO.lines; + =end comment my $Lfil = "$modpdir/.github/workflows/linux.yml"; my $Wfil = "$modpdir/.github/workflows/windows.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; + =begin comment my $Lfh = open $Lfil, :w; my $Wfh = open $Wfil, :w; my $Mfh = open $Mfil, :w; + =end comment + =begin comment my ($L, $W, $M); while @itestfil.elems { my $line = @itestfil.shift; @@ -203,8 +209,10 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export $Wfh.close; $Mfh.close; unlink $testfil; # don't need the old one + =end comment + + # mod the dist.ini file. add ALL optional sections recognized by App::Mi6 - # mod the dist.ini file. add ALL optional sections recognized byApp::Mi6 my $distfil = "$modpdir/dist.ini"; my @idistfil = $distfil.IO.lines; my @odistfil; From 36df4cbaa7c1df89aee8285b498f1efb72e114dd Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Fri, 29 Sep 2023 14:57:10 -0500 Subject: [PATCH 02/14] try another way --- lib/Mi6/Helper.rakumod | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index f0b62d1..45fdced 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -148,7 +148,16 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export $fh.say($_) for @omodfil; $fh.close; - # use the .github/workflows/*.yml files as I've updated them + # use the Mi6-Helper/.github/workflows/*.yml files as I've updated them + # but they will be in DISTRIBUTION.contents + my ($Lstr, $Mstr, $Wstr) = get-workflows; # fil = "$parent-dir/.github/workflows/linux.yml"; + my $Lfil = "$modpdir/.github/workflows/linux.yml"; + my $Wfil = "$modpdir/.github/workflows/windows.yml"; + my $Mfil = "$modpdir/.github/workflows/macos.yml"; + + spurt $Lfil, $Lstr; + spurt $Mfil, $Mstr; + spurt $Wfil, $Wstr; =begin comment my $testfil = "$modpdir/.github/workflows/test.yml"; @@ -390,6 +399,13 @@ sub get-section($section --> Str) { } } +sub get-workflows(--> List) is export { + my $L = $?DISTRIBUTION.contents<.github/workflows/linux.yml>; + my $M = $?DISTRIBUTION.contents<.github/workflows/macos.yml>; + my $W = $?DISTRIBUTION.contents<.github/workflows/windows.yml>; + $L, $M, $L +} + sub get-version is export { $?DISTRIBUTION.meta } From 6f0478cf17b088dde0dde0eccce3708403bb25b8 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Fri, 29 Sep 2023 17:27:11 -0500 Subject: [PATCH 03/14] save work --- .../{windows-spec.yml => windows.yml} | 0 bin/mi6-helper | 18 ++++++++++++++++-- lib/Mi6/Helper.rakumod | 16 +++++++--------- xt-bad/02-helper-new.t | 12 ++++++++---- 4 files changed, 31 insertions(+), 15 deletions(-) rename .github/workflows/{windows-spec.yml => windows.yml} (100%) diff --git a/.github/workflows/windows-spec.yml b/.github/workflows/windows.yml similarity index 100% rename from .github/workflows/windows-spec.yml rename to .github/workflows/windows.yml diff --git a/bin/mi6-helper b/bin/mi6-helper index 9776e21..f1ba9c7 100755 --- a/bin/mi6-helper +++ b/bin/mi6-helper @@ -40,7 +40,7 @@ if not @*ARGS.elems { docs - Used with the 'old' mode: uses file 'docs/README.rakudoc' to produce 'README.md'. Note extra preparation is REQUIRED by the user before using it. - Debug - For developer use + debug - For developer use HERE @@ -79,7 +79,21 @@ for @*ARGS { $parent-dir = ~$0; } when / ^do[cs]? / { ++$docs } - when / ^de[bug]? / { ++$debug } + when / ^de[bug]? / { + ++$debug; + # check for this module's workflows file(s' + say "DEBUG checking for expected workflow(s):"; + for "linux", "macos", "windows" -> $OS { + my $path = ".github/workflows/$OS.yml"; + if $path { + say " found path '$path'"; + } + else { + say " did NOT find '$path'"; + } + } + exit; + } when /^v[ersion]? / { # check for this module's version my $ver = get-version; diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 45fdced..8f2fc38 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -15,7 +15,7 @@ submethod TWEAK { $!module-base ~~ s:g/'::'/-/; } -method mi6-new-cmd(:$parent-dir, :$module-name, :$debug) { +method mi6-new-cmd(:$parent-dir!, :$module-name!, :$debug) { chdir $parent-dir; run "mi6", 'new', '--zef', $module-name; } @@ -150,10 +150,10 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # use the Mi6-Helper/.github/workflows/*.yml files as I've updated them # but they will be in DISTRIBUTION.contents - my ($Lstr, $Mstr, $Wstr) = get-workflows; # fil = "$parent-dir/.github/workflows/linux.yml"; + my ($Lfh, $Mfh, $Wfh); # = get-workflows; # fil = "$parent-dir/.github/workflows/linux.yml"; my $Lfil = "$modpdir/.github/workflows/linux.yml"; - my $Wfil = "$modpdir/.github/workflows/windows.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; + my $Wfil = "$modpdir/.github/workflows/windows.yml"; spurt $Lfil, $Lstr; spurt $Mfil, $Mstr; @@ -162,11 +162,11 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export =begin comment my $testfil = "$modpdir/.github/workflows/test.yml"; my @itestfil = $testfil.IO.lines; - =end comment my $Lfil = "$modpdir/.github/workflows/linux.yml"; my $Wfil = "$modpdir/.github/workflows/windows.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; + =end comment =begin comment my $Lfh = open $Lfil, :w; @@ -399,11 +399,9 @@ sub get-section($section --> Str) { } } -sub get-workflows(--> List) is export { - my $L = $?DISTRIBUTION.contents<.github/workflows/linux.yml>; - my $M = $?DISTRIBUTION.contents<.github/workflows/macos.yml>; - my $W = $?DISTRIBUTION.contents<.github/workflows/windows.yml>; - $L, $M, $L +sub get-workflow($path --> IO::Handle) is export { + # returns three expected file handles (an opened file) + my $fh = $?DISTRIBUTION.content($path) // Nil; } sub get-version is export { diff --git a/xt-bad/02-helper-new.t b/xt-bad/02-helper-new.t index 21a9adf..8b90ae9 100644 --- a/xt-bad/02-helper-new.t +++ b/xt-bad/02-helper-new.t @@ -14,7 +14,7 @@ my $email = $oo.git-user-email; my $author = $oo.git-user-name; my $meta-author = "$author <$email>"; -my $debug = 0; +my $debug = 1; # provide a unique testing directory by test file name my $debug-base = "debug-test"; @@ -48,10 +48,14 @@ ok $tempdir.IO.d; chdir $tempdir; - run "touch", ".Foo-Bar"; - my $module-name = "Foo::Bar"; + run "touch", '.Foo-Bar'; + my $module-name = 'Foo::Bar'; my $parent-dir = $tempdir; - my $provides = "Provides a framistan"; + my $provides = "Provides a framistan"; + + note "DEBUG: module-name: $module-name"; + note "DEBUG: parent-dir: $parent-dir"; + mi6-helper-new(:$parent-dir, :$module-name, :$provides, :$debug); my $moddir = $module-name; $moddir ~~ s:g/'::'/-/; From 40bfe7040589b5bb1e529f4704a66c9020da5c42 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Fri, 29 Sep 2023 22:25:34 -0500 Subject: [PATCH 04/14] improve windows workflow --- .github/workflows/windows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d7a56a2..61e8ffc 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,10 +21,8 @@ jobs: - '2022.07' runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - uses: Raku/setup-raku@v1 - with: - raku-version: ${{ matrix.raku-version }} - name: Install Dependencies run: | choco install rakudostar From 2cc1702c10aec2af54f56eed3f78fd612012f129 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Sat, 30 Sep 2023 07:40:25 -0500 Subject: [PATCH 05/14] save work --- lib/Mi6/Helper.rakumod | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 8f2fc38..607d885 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -150,14 +150,17 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # use the Mi6-Helper/.github/workflows/*.yml files as I've updated them # but they will be in DISTRIBUTION.contents - my ($Lfh, $Mfh, $Wfh); # = get-workflows; # fil = "$parent-dir/.github/workflows/linux.yml"; + my $Lfh = DISTRIBUTION.content(".github/workflows/linux.yml"); + my $Mfh = DISTRIBUTION.content(".github/workflows/macos.yml"); + my $Wfh = DISTRIBUTION.content(".github/workflows/windows.yml"); + my $Lfil = "$modpdir/.github/workflows/linux.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; my $Wfil = "$modpdir/.github/workflows/windows.yml"; - spurt $Lfil, $Lstr; - spurt $Mfil, $Mstr; - spurt $Wfil, $Wstr; + spurt $Lfil, $Lfh.slurp; + spurt $Mfil, $Mfh.slurp; + spurt $Wfil, $Wfh.slurp; =begin comment my $testfil = "$modpdir/.github/workflows/test.yml"; From 51e64b4025e68c7d33453db5418900c30eb76a28 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Sat, 30 Sep 2023 11:26:40 -0500 Subject: [PATCH 06/14] save work --- META6.json | 1 + lib/Mi6/Helper.rakumod | 18 ++++++++++++------ xt/01-check-git-repo.t | 1 + xt/{01-mi6-create.t => 02-mi6-create.t} | 1 + xt-bad/02-helper-new.t => xt/03-helper-new.t | 3 ++- 5 files changed, 17 insertions(+), 7 deletions(-) rename xt/{01-mi6-create.t => 02-mi6-create.t} (99%) rename xt-bad/02-helper-new.t => xt/03-helper-new.t (98%) diff --git a/META6.json b/META6.json index 78e370d..2ce6d80 100644 --- a/META6.json +++ b/META6.json @@ -10,6 +10,7 @@ "JSON::Fast", "App::Mi6:ver<3.0.2+>", "Text::Utils", + "Proc::Easier", "Ask:ver<0.0.3+>" ], "description": "An aid for converting Raku modules to use App::Mi6", diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 607d885..843da27 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -2,6 +2,7 @@ unit class Mi6::Helper; use App::Mi6; use JSON::Fast; +use Proc::Easier; has $.parent-dir = '.'; has $.module-name; #= e.g., 'Foo::Bar' @@ -150,17 +151,22 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # use the Mi6-Helper/.github/workflows/*.yml files as I've updated them # but they will be in DISTRIBUTION.contents - my $Lfh = DISTRIBUTION.content(".github/workflows/linux.yml"); - my $Mfh = DISTRIBUTION.content(".github/workflows/macos.yml"); - my $Wfh = DISTRIBUTION.content(".github/workflows/windows.yml"); + # note the file handles are CLOSED!! + my $Lfh = $?DISTRIBUTION.content(".github/workflows/linux.yml").open; + my $Mfh = $?DISTRIBUTION.content(".github/workflows/macos.yml").open; + my $Wfh = $?DISTRIBUTION.content(".github/workflows/windows.yml").open; + + my $Lstr = $Lfh.slurp; # lines.flat; + my $Mstr = $Mfh.slurp; # lines.flat; + my $Wstr = $Wfh.slurp; # lines.flat; my $Lfil = "$modpdir/.github/workflows/linux.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; my $Wfil = "$modpdir/.github/workflows/windows.yml"; - spurt $Lfil, $Lfh.slurp; - spurt $Mfil, $Mfh.slurp; - spurt $Wfil, $Wfh.slurp; + spurt $Lfil, $Lstr; + spurt $Mfil, $Mstr; + spurt $Wfil, $Wstr; =begin comment my $testfil = "$modpdir/.github/workflows/test.yml"; diff --git a/xt/01-check-git-repo.t b/xt/01-check-git-repo.t index 56ec071..dd6c062 100644 --- a/xt/01-check-git-repo.t +++ b/xt/01-check-git-repo.t @@ -2,6 +2,7 @@ use Test; use Mi6::Helper; use App::Mi6; use Temp::Path; +use Proc::Easier; # Create some test repos: # 1. An Mi6 dir with three types of files in addition to a diff --git a/xt/01-mi6-create.t b/xt/02-mi6-create.t similarity index 99% rename from xt/01-mi6-create.t rename to xt/02-mi6-create.t index b6ebbde..ce0686b 100644 --- a/xt/01-mi6-create.t +++ b/xt/02-mi6-create.t @@ -4,6 +4,7 @@ use Mi6::Helper; use File::Temp; use App::Mi6; use File::Directory::Tree; +use Proc::Easier; # check the system for known values used for fez and mi6 my $oo = Mi6::Helper.new; diff --git a/xt-bad/02-helper-new.t b/xt/03-helper-new.t similarity index 98% rename from xt-bad/02-helper-new.t rename to xt/03-helper-new.t index 8b90ae9..ec19ab8 100644 --- a/xt-bad/02-helper-new.t +++ b/xt/03-helper-new.t @@ -5,6 +5,7 @@ use Mi6::Helper; use File::Temp; use App::Mi6; use File::Directory::Tree; +use Proc::Easier; # check the system for known values used for fez and mi6 my $oo = Mi6::Helper.new: :module-name("null"); @@ -14,7 +15,7 @@ my $email = $oo.git-user-email; my $author = $oo.git-user-name; my $meta-author = "$author <$email>"; -my $debug = 1; +my $debug = 0; # provide a unique testing directory by test file name my $debug-base = "debug-test"; From 62ebad42bf0976aa88479144dbd0a2e09b9cd0fd Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 06:34:37 -0500 Subject: [PATCH 07/14] excellent, now clean up --- dev/li.raku | 0 lib/Mi6/Helper.rakumod | 12 +++++++++--- xt/03-helper-new.t | 14 +++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) mode change 100644 => 100755 dev/li.raku diff --git a/dev/li.raku b/dev/li.raku old mode 100644 new mode 100755 diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 843da27..24c1d0f 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -344,10 +344,16 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # need to change dirs note "$modpdir IS a git repo" if $debug; temp $*CWD = $modpdir.IO; + =begin comment run "git", "add", ".github/workflows/linux.yml"; run "git", "add", ".github/workflows/windows.yml"; run "git", "add", ".github/workflows/macos.yml"; run "git", "add", "docs/README.rakudoc"; + =end comment + cmd "git add '.github/workflows/linux.yml'"; + cmd "git add '.github/workflows/windows.yml'"; + cmd "git add '.github/workflows/macos.yml'"; + cmd "git add docs/README.rakudoc"; # finish the repo to be ready for pushing run "mi6", "build"; @@ -408,9 +414,9 @@ sub get-section($section --> Str) { } } -sub get-workflow($path --> IO::Handle) is export { - # returns three expected file handles (an opened file) - my $fh = $?DISTRIBUTION.content($path) // Nil; +sub show-workflow($path) is export { + # returns contents of $path + say $?DISTRIBUTION.content($path); } sub get-version is export { diff --git a/xt/03-helper-new.t b/xt/03-helper-new.t index ec19ab8..663b12b 100644 --- a/xt/03-helper-new.t +++ b/xt/03-helper-new.t @@ -49,13 +49,17 @@ ok $tempdir.IO.d; chdir $tempdir; - run "touch", '.Foo-Bar'; + #run "touch", '.Foo-Bar'; + cmd "touch '.Foo-Bar'"; + my $module-name = 'Foo::Bar'; my $parent-dir = $tempdir; my $provides = "Provides a framistan"; - note "DEBUG: module-name: $module-name"; - note "DEBUG: parent-dir: $parent-dir"; + if $debug { + note "DEBUG: module-name: $module-name"; + note "DEBUG: parent-dir: $parent-dir"; + } mi6-helper-new(:$parent-dir, :$module-name, :$provides, :$debug); my $moddir = $module-name; @@ -64,8 +68,8 @@ ok $tempdir.IO.d; # check the meta file for known values my %meta = App::Mi6::JSON.decode(slurp "$moddir/META6.json"); - is %meta, $auth; - is @(%meta)[0], $author; + is %meta, $auth, "is auth $auth?"; + is @(%meta)[0], $author, "is author 1 $author?"; } done-testing; From ed3d29aee3dc7fb5d8b7110f24509d1cd6011ca9 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 09:59:01 -0500 Subject: [PATCH 08/14] all tests passing --- lib/Mi6/Helper.rakumod | 89 ++++--------------- ...01-check-git-repo.t => 1-check-git-repo.t} | 0 xt/{02-mi6-create.t => 2-mi6-create.t} | 0 xt/{03-helper-new.t => 3-helper-new.t} | 2 +- 4 files changed, 18 insertions(+), 73 deletions(-) rename xt/{01-check-git-repo.t => 1-check-git-repo.t} (100%) rename xt/{02-mi6-create.t => 2-mi6-create.t} (100%) rename xt/{03-helper-new.t => 3-helper-new.t} (97%) diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 24c1d0f..4bcf294 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -18,20 +18,24 @@ submethod TWEAK { method mi6-new-cmd(:$parent-dir!, :$module-name!, :$debug) { chdir $parent-dir; - run "mi6", 'new', '--zef', $module-name; + #run "mi6", 'new', '--zef', $module-name; + cmd "mi6 new --zef $module-name"; } method git-status { # branch and working tree status - my $res = run("git", "status", "-b", "-s", :out).out.slurp.chomp + #my $res = run("git", "status", "-b", "-s", :out).out.slurp.chomp + cmd("git status -b -s").out.chomp } method git-user-email { - run("git", "config", "--get", "--global", "user.email", :out).out.slurp.chomp + #run("git", "config", "--get", "--global", "user.email", :out).out.slurp.chomp + cmd("git config --get --global user.email").out.chomp } method git-user-name { - run("git", "config", "--get", "--global", "user.name", :out).out.slurp.chomp + #run("git", "config", "--get", "--global", "user.name", :out).out.slurp.chomp + cmd("git config --get --global user.name").out.chomp } multi method is-git-repo($dir) { @@ -152,13 +156,9 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # use the Mi6-Helper/.github/workflows/*.yml files as I've updated them # but they will be in DISTRIBUTION.contents # note the file handles are CLOSED!! - my $Lfh = $?DISTRIBUTION.content(".github/workflows/linux.yml").open; - my $Mfh = $?DISTRIBUTION.content(".github/workflows/macos.yml").open; - my $Wfh = $?DISTRIBUTION.content(".github/workflows/windows.yml").open; - - my $Lstr = $Lfh.slurp; # lines.flat; - my $Mstr = $Mfh.slurp; # lines.flat; - my $Wstr = $Wfh.slurp; # lines.flat; + my $Lstr = $?DISTRIBUTION.content(".github/workflows/linux.yml").open.slurp; + my $Mstr = $?DISTRIBUTION.content(".github/workflows/macos.yml").open.slurp; + my $Wstr = $?DISTRIBUTION.content(".github/workflows/windows.yml").open.slurp; my $Lfil = "$modpdir/.github/workflows/linux.yml"; my $Mfil = "$modpdir/.github/workflows/macos.yml"; @@ -168,67 +168,6 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export spurt $Mfil, $Mstr; spurt $Wfil, $Wstr; - =begin comment - my $testfil = "$modpdir/.github/workflows/test.yml"; - my @itestfil = $testfil.IO.lines; - - my $Lfil = "$modpdir/.github/workflows/linux.yml"; - my $Wfil = "$modpdir/.github/workflows/windows.yml"; - my $Mfil = "$modpdir/.github/workflows/macos.yml"; - =end comment - - =begin comment - my $Lfh = open $Lfil, :w; - my $Wfh = open $Wfil, :w; - my $Mfh = open $Mfil, :w; - =end comment - - =begin comment - my ($L, $W, $M); - while @itestfil.elems { - my $line = @itestfil.shift; - if $line ~~ /'name:' \h+ test / { - $L = $line; - $W = $line; - $M = $line; - - $L ~~ s/test/Linux/; - $W ~~ s/test/Win64/; - $M ~~ s/test/MacOS/; - - $Lfh.say: $L; - $Wfh.say: $W; - $Mfh.say: $M; - next; - } - if $line ~~ /'-' \h+ [ubuntu|windows|macos] '-' latest / { - # need to replace three lines with one - @itestfil.shift; - @itestfil.shift; - - $L = $line; - $W = $line; - $M = $line; - - $L ~~ s/[ubuntu|windows|macos]/ubuntu/; - $W ~~ s/[ubuntu|windows|macos]/windows/; - $M ~~ s/[ubuntu|windows|macos]/macos/; - - $Lfh.say: $L; - $Wfh.say: $W; - $Mfh.say: $M; - next; - } - $Lfh.say: $line; - $Wfh.say: $line; - $Mfh.say: $line; - } - $Lfh.close; - $Wfh.close; - $Mfh.close; - unlink $testfil; # don't need the old one - =end comment - # mod the dist.ini file. add ALL optional sections recognized by App::Mi6 my $distfil = "$modpdir/dist.ini"; @@ -356,8 +295,12 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export cmd "git add docs/README.rakudoc"; # finish the repo to be ready for pushing + =begin comment run "mi6", "build"; run "git", "commit", "-a", "-m'initial commit'"; + =end comment + cmd "mi6 build"; + cmd "git commit -a -m'initial commit'"; } } # sub mi6-helper-new @@ -414,10 +357,12 @@ sub get-section($section --> Str) { } } +#=begin comment sub show-workflow($path) is export { # returns contents of $path say $?DISTRIBUTION.content($path); } +#=end comment sub get-version is export { $?DISTRIBUTION.meta diff --git a/xt/01-check-git-repo.t b/xt/1-check-git-repo.t similarity index 100% rename from xt/01-check-git-repo.t rename to xt/1-check-git-repo.t diff --git a/xt/02-mi6-create.t b/xt/2-mi6-create.t similarity index 100% rename from xt/02-mi6-create.t rename to xt/2-mi6-create.t diff --git a/xt/03-helper-new.t b/xt/3-helper-new.t similarity index 97% rename from xt/03-helper-new.t rename to xt/3-helper-new.t index 663b12b..72f7144 100644 --- a/xt/03-helper-new.t +++ b/xt/3-helper-new.t @@ -13,7 +13,7 @@ my %fez = App::Mi6::JSON.decode(slurp "$*HOME/.fez-config.json"); my $auth = "zef:{%fez}"; my $email = $oo.git-user-email; my $author = $oo.git-user-name; -my $meta-author = "$author <$email>"; +my $meta-author = "$author \<$email\>"; my $debug = 0; From 36ad1af887caa3289d4367de8abab97096e574bc Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 10:22:32 -0500 Subject: [PATCH 09/14] build, push before release --- Changes | 2 ++ README.md | 4 +++- docs/README.rakudoc | 3 ++- lib/Mi6/Helper.rakumod | 24 +----------------------- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/Changes b/Changes index 4a098d4..4caabf5 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Mi6-Helper {{$NEXT}} + - More extensive and useful testing in xt + - Clearer code using 'cmd' from module'Pro::Easier' instead of 'raku's 'run' - Use @ugexe's solution to replace prove6 - Get Windows testing to be more reliable by using Github workflows test lines like 'zef --exclude="z" install ..." (for Windows only, diff --git a/README.md b/README.md index 9bba99c..09d05bb 100644 --- a/README.md +++ b/README.md @@ -147,12 +147,14 @@ CREDITS The very useful Raku modules used herein: - * `App::Mi6` by **github:skaji** + * `App::Mi6` by **zef:skaji** * `File::Directory::Tree` by **github:labster** * `File::Temp` by **zef:rbt** + * `Proc::Easier` by **zef:sdondley** + COPYRIGHT AND LICENSE ===================== diff --git a/docs/README.rakudoc b/docs/README.rakudoc index c550fa4..9a3f8eb 100644 --- a/docs/README.rakudoc +++ b/docs/README.rakudoc @@ -166,9 +166,10 @@ Tom Browder The very useful Raku modules used herein: -=item C by B +=item C by B =item C by B =item C by B +=item C by B =head1 COPYRIGHT AND LICENSE diff --git a/lib/Mi6/Helper.rakumod b/lib/Mi6/Helper.rakumod index 4bcf294..1d76b9a 100644 --- a/lib/Mi6/Helper.rakumod +++ b/lib/Mi6/Helper.rakumod @@ -18,23 +18,19 @@ submethod TWEAK { method mi6-new-cmd(:$parent-dir!, :$module-name!, :$debug) { chdir $parent-dir; - #run "mi6", 'new', '--zef', $module-name; cmd "mi6 new --zef $module-name"; } method git-status { # branch and working tree status - #my $res = run("git", "status", "-b", "-s", :out).out.slurp.chomp cmd("git status -b -s").out.chomp } method git-user-email { - #run("git", "config", "--get", "--global", "user.email", :out).out.slurp.chomp cmd("git config --get --global user.email").out.chomp } method git-user-name { - #run("git", "config", "--get", "--global", "user.name", :out).out.slurp.chomp cmd("git config --get --global user.name").out.chomp } @@ -251,10 +247,9 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export @odistfil.push: $str; } - note "Found $nsections sections" if $debug; + note "DEBUG: Found $nsections sections" if $debug; $fh = open $distfil, :w; $fh.say($_) for @odistfil; - $fh.close; # mod the META6.json file @@ -283,22 +278,12 @@ sub mi6-helper-new(:$parent-dir!, :$module-name!, :$provides, :$debug) is export # need to change dirs note "$modpdir IS a git repo" if $debug; temp $*CWD = $modpdir.IO; - =begin comment - run "git", "add", ".github/workflows/linux.yml"; - run "git", "add", ".github/workflows/windows.yml"; - run "git", "add", ".github/workflows/macos.yml"; - run "git", "add", "docs/README.rakudoc"; - =end comment cmd "git add '.github/workflows/linux.yml'"; cmd "git add '.github/workflows/windows.yml'"; cmd "git add '.github/workflows/macos.yml'"; cmd "git add docs/README.rakudoc"; # finish the repo to be ready for pushing - =begin comment - run "mi6", "build"; - run "git", "commit", "-a", "-m'initial commit'"; - =end comment cmd "mi6 build"; cmd "git commit -a -m'initial commit'"; } @@ -357,13 +342,6 @@ sub get-section($section --> Str) { } } -#=begin comment -sub show-workflow($path) is export { - # returns contents of $path - say $?DISTRIBUTION.content($path); -} -#=end comment - sub get-version is export { $?DISTRIBUTION.meta } From 1b13536f415404a770adeb1de8043ebed8fc5f69 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 10:32:23 -0500 Subject: [PATCH 10/14] remove Ask --- META6.json | 3 +-- bin/mi6-helper | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/META6.json b/META6.json index 2ce6d80..2850d0a 100644 --- a/META6.json +++ b/META6.json @@ -10,8 +10,7 @@ "JSON::Fast", "App::Mi6:ver<3.0.2+>", "Text::Utils", - "Proc::Easier", - "Ask:ver<0.0.3+>" + "Proc::Easier" ], "description": "An aid for converting Raku modules to use App::Mi6", "license": "Artistic-2.0", diff --git a/bin/mi6-helper b/bin/mi6-helper index f1ba9c7..11f1ef7 100755 --- a/bin/mi6-helper +++ b/bin/mi6-helper @@ -6,7 +6,6 @@ use App::Mi6; use Text::Utils :normalize-string; use File::Find; use JSON::Fast; -use Ask; if not @*ARGS.elems { say qq:to/HERE/; @@ -141,7 +140,7 @@ if not $provides.defined { } else { say "FATAL: Unable to find the hidden file '$hidden'."; - my $res = ask "Do you want to continue without it (y/N): "; + my $res = prompt "Do you want to continue without it (y/N): "; if $res ~~ /:i ^ y/ { say "Okay, continuing without a 'provides' input..."; } @@ -179,7 +178,7 @@ if $dist-ini.IO.f { say "Danger, file '$dist-ini' exists."; say "Checking for the 'force' option..."; if $force { - my $ans = ask "Are you sure you want to continue (y/N): "; + my $ans = prompt "Are you sure you want to continue (y/N): "; if $ans ~~ /:i ^y/ { say "Continuing with mods...": } From a1cf4add7137f47b0b5446a38d1d78681f5f3e84 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 10:44:43 -0500 Subject: [PATCH 11/14] try latest raku --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 61e8ffc..acb9fe4 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,7 +18,7 @@ jobs: os: - windows-latest raku-version: - - '2022.07' + - 'latest' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 From c8047e90c9d837890718d9683df04bf7da08f588 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 10:55:53 -0500 Subject: [PATCH 12/14] use latest actions --- .github/workflows/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index acb9fe4..0d02eb7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,11 +21,11 @@ jobs: - 'latest' runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: Raku/setup-raku@v1 - name: Install Dependencies run: | choco install rakudostar zef --exclude="z" install --debug --/test --test-depends --deps-only . - name: Run Tests - run: zef --debug --/prove --/tap-harness test . + run: zef --debug test . From 32628f81bda182f08995610c5332225ba4d7d88d Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 11:13:07 -0500 Subject: [PATCH 13/14] another tweak --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0d02eb7..5ea9eec 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -28,4 +28,4 @@ jobs: choco install rakudostar zef --exclude="z" install --debug --/test --test-depends --deps-only . - name: Run Tests - run: zef --debug test . + run: zef install . --debug From e9a421f02e3a647cc4f7a86c81c362862fb4f126 Mon Sep 17 00:00:00 2001 From: Tom Browder Date: Tue, 3 Oct 2023 11:36:51 -0500 Subject: [PATCH 14/14] update the changes --- Changes | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Changes b/Changes index 4caabf5..8d18f2c 100644 --- a/Changes +++ b/Changes @@ -4,10 +4,18 @@ Revision history for Mi6-Helper - More extensive and useful testing in xt - Clearer code using 'cmd' from module'Pro::Easier' instead of 'raku's 'run' - Use @ugexe's solution to replace prove6 + +0.9.1 2023-09-09T15:48:27-05:00 - Get Windows testing to be more reliable by using Github workflows test lines like 'zef --exclude="z" install ..." (for Windows only, not needed for Linux or MacOS). +0.9.0 2023-07-08T18:20:35-05:00 + - Improved the documentation for use of the hidded file for + the 'provides' text. + - Recommend the 'hidden file' option for the 'provides' + text. + 0.8.1 2023-03-21T17:06:58-05:00 - Get the 'version' mode working for the installed module. Thanks @ugexe!