aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-02-05 10:20:27 +0100
committerPatrick Spek <p.spek@tyil.nl>2020-02-05 10:20:27 +0100
commit1e46252c81d4944b99fa44f517b6cfd25df27af0 (patch)
tree1176b0b553e809ca8a29e4bb7fed2f25177c7ee4
parent8737fed602222ac9ab376e76318bbe306396e2e4 (diff)
downloadDist::Maker-1e46252c81d4944b99fa44f517b6cfd25df27af0.tar.gz
Dist::Maker-1e46252c81d4944b99fa44f517b6cfd25df27af0.tar.bz2
Make sanity checks skippable
These checks are done in the MAIN() subs already, and can be left out of the dist-maker-* subs.
-rw-r--r--lib/Dist/Maker/Bin.rakumod3
-rw-r--r--lib/Dist/Maker/Commands/Depend.rakumod10
-rw-r--r--lib/Dist/Maker/Commands/New.rakumod10
3 files changed, 18 insertions, 5 deletions
diff --git a/lib/Dist/Maker/Bin.rakumod b/lib/Dist/Maker/Bin.rakumod
index 61175cd..30c2211 100644
--- a/lib/Dist/Maker/Bin.rakumod
+++ b/lib/Dist/Maker/Bin.rakumod
@@ -15,6 +15,7 @@ use X::Dist::Maker::NoDistribution;
unit module Dist::Maker::Bin;
+#| Add a dependency.
multi sub MAIN (
'depend',
@@ -51,6 +52,7 @@ multi sub MAIN (
dist-maker-depend(
$module,
$meta-file,
+ :!sanity-checks,
);
if (!dm-config('main.quiet')) {
@@ -100,6 +102,7 @@ multi sub MAIN (
$description,
$license,
$path.IO,
+ :!sanity-checks,
);
if (!dm-config('main.quiet')) {
diff --git a/lib/Dist/Maker/Commands/Depend.rakumod b/lib/Dist/Maker/Commands/Depend.rakumod
index 78bb5eb..bfd511d 100644
--- a/lib/Dist/Maker/Commands/Depend.rakumod
+++ b/lib/Dist/Maker/Commands/Depend.rakumod
@@ -8,13 +8,21 @@ use X::Dist::Maker::DuplicateDependency;
unit module Dist::Maker::Commands::Depend;
+#| Add an additional dependency to a module.
sub dist-maker-depend (
+ #| The module name to depend on.
Str:D $module,
+
+ #| The path to the META6.json of this project.
IO::Path:D $meta-json,
+
+ #| Whether or not to enable sanity checks. You should only turn this
+ #| off if you know what you're doing!
+ Bool:D :$sanity-checks = True;
) is export {
my %meta = $meta-json.slurp.&from-json;
- if (%meta<depends> (cont) $module) {
+ if ($sanity-checks && %meta<depends> ∋ $module) {
X::Dist::Maker::DuplicateDependency.new(
:$module
).throw
diff --git a/lib/Dist/Maker/Commands/New.rakumod b/lib/Dist/Maker/Commands/New.rakumod
index 478b76a..a208d36 100644
--- a/lib/Dist/Maker/Commands/New.rakumod
+++ b/lib/Dist/Maker/Commands/New.rakumod
@@ -8,8 +8,6 @@ use Template::Mustache;
use X::Dist::Maker::Clobber;
-constant ClobberException = X::Dist::Maker::Clobber;
-
unit module Dist::Maker::Commands::New;
#| Create a new Raku module distribution skeleton.
@@ -26,12 +24,16 @@ sub dist-maker-new (
#| The path to the directory in which the module skeleton will be
#| created.
IO::Path:D $path,
+
+ #| Whether or not to enable sanity checks. You should only turn this
+ #| off if you know what you're doing!
+ Bool:D :$sanity-checks = True,
) is export {
my $location = $path.add($name);
# Die early if the destination already exists
- if ($location.e) {
- ClobberException.new(
+ if ($sanity-checks && $location.e) {
+ X::Dist::Maker::Clobber.new(
path => $location.absolute,
).throw;
}