diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-03-22 11:48:23 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-03-22 11:48:23 +0100 |
commit | 1d983e9f934bf6aeb9333c763fe1a603b8d8e5c4 (patch) | |
tree | ff96afaf569e8669a28ba35e85a1441621117d0b /lib/install-module.raku |
Initial commit
Diffstat (limited to 'lib/install-module.raku')
-rw-r--r-- | lib/install-module.raku | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/install-module.raku b/lib/install-module.raku new file mode 100644 index 0000000..8e70ab2 --- /dev/null +++ b/lib/install-module.raku @@ -0,0 +1,28 @@ +#!/usr/bin/env raku + +use v6.d; + +#| Install a Raku module. +sub MAIN ( + #| The path to the Raku module sources. + IO() $path is copy, + + #| The repository to install it in. Options are "site" (ment for + #| user-installed modules), "vendor" (ment for distributions that want + #| to include more modules) and "core" (ment for modules distributed + #| along with Raku itself). + Str:D :$repo = 'vendor', + + #| Force installation of the module. + Bool:D :$force = True, +) { + CATCH { + default { $_.say; exit 1; } + } + + my $repository = CompUnit::RepositoryRegistry.repository-for-name($repo); + my $meta-file = $path.add('META6.json'); + my $dist = Distribution::Path.new($path, :$meta-file); + + $repository.install($dist, :$force); +} |