aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-07-12 10:35:32 +0200
committerPatrick Spek <p.spek@tyil.nl>2020-07-12 10:35:32 +0200
commitbf909d7cd1efd515c2d72eaa752fe5ebb7df263c (patch)
tree0c3667213d2baa3975cbb3f8654d7ec35d0f0fe2
parent38b54dd41b8e385df9a8da5bbe815b200fa8f1c1 (diff)
downloadDist::Maker-bf909d7cd1efd515c2d72eaa752fe5ebb7df263c.tar.gz
Dist::Maker-bf909d7cd1efd515c2d72eaa752fe5ebb7df263c.tar.bz2
Alter the way files are included in a dist
-rw-r--r--META6.json3
-rw-r--r--lib/App/Rakumod/Bin.rakumod31
2 files changed, 31 insertions, 3 deletions
diff --git a/META6.json b/META6.json
index 1460090..d40d69a 100644
--- a/META6.json
+++ b/META6.json
@@ -7,7 +7,8 @@
"Config:ver<3.0.0>",
"IO::Path::XDG",
"JSON::Fast",
- "Template::Mustache"
+ "Template::Mustache",
+ "IO::Glob"
],
"description": "Easily develop Raku modules",
"license": "AGPL-3.0-only",
diff --git a/lib/App/Rakumod/Bin.rakumod b/lib/App/Rakumod/Bin.rakumod
index a162c17..a1b3bf7 100644
--- a/lib/App/Rakumod/Bin.rakumod
+++ b/lib/App/Rakumod/Bin.rakumod
@@ -3,6 +3,7 @@
use v6.d;
use File::Which;
+use IO::Glob;
use IO::Path::XDG;
use JSON::Fast;
use Log;
@@ -200,14 +201,40 @@ multi sub MAIN (
my %meta = from-json($meta-file.slurp);
my $distname = %meta<name>.subst('::', '-', :g) ~ '-' ~ %meta<version>;
my $output = $App::Rakumod::config.get('dist.directory').add("$distname.tar.gz");
+
+ # Include the bare minimum
my @files = (
|%meta<provides>.values,
|%meta<resources>.map({ "resources/$_" }),
'META6.json',
- 'LICENSE.txt',
- 'README.rakudoc',
);
+ # Include tests, if they exist
+ if ($meta-file.parent.add('t').d) {
+ my @tests = $meta-file.parent.add('t');
+
+ while (@tests) {
+ @tests.pop.dir.map(sub ($path) {
+ if ($path.d) {
+ @tests.push($path);
+ return
+ }
+
+ @files.append($path.relative($meta-file.parent));
+ })
+ }
+ }
+
+ # Include some optional files
+ <
+ README.*
+ LICENSE.*
+ CHANGELOG.*
+ >.map({
+ @files.append($meta-file.parent.dir(test => glob($_)).map(*.relative($meta-file.parent)).Slip)
+ })
+ ;
+
# Ensure all files actually exist
for @files -> $file {
.notice("Including $file in $distname") with $Log::instance;