aboutsummaryrefslogtreecommitdiff
path: root/lib/install-module.raku
blob: 8e70ab24a6f4ebe95e36559965527c13bc418430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
}