Skip to content

Commit

Permalink
Add Build::Dependency to require coffee for highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Feb 12, 2018
1 parent b907114 commit f6586e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions htmlify.p6
Expand Up @@ -11,6 +11,8 @@ use URI::Escape;
use Perl6::Documentable::Registry;
use Perl6::TypeGraph;
use Perl6::TypeGraph::Viz;
use Build::Dependency;

use Pod::Convenience;
use Pod::Htmlify;
use OO::Monitors;
Expand Down Expand Up @@ -150,10 +152,9 @@ sub MAIN(
Int :$parallel = 1,
) {
if !$no-highlight {
if ! $coffee-exe.IO.f {
say "Could not find $coffee-exe, did you run `make init-highlights`?";
exit 1;
}
Build::Dependency::require(
'executable', $coffee-exe, :suggest(<make init-highlights>)
);
$proc = Proc::Async.new($coffee-exe, './highlights/highlight-filename-from-stdin.coffee', :r, :w);
$proc-supply = $proc.stdout.lines;
}
Expand Down
9 changes: 9 additions & 0 deletions lib/Build/Dependency.pm
@@ -0,0 +1,9 @@
unit package Build::Dependency;

our proto require(|c) {*} ;

multi sub require('executable', $exec-name, :$suggest) {
if ! $exec-name.IO.f {
die "Could not find $exec-name. Did you `$suggest`?";
}
}

0 comments on commit f6586e2

Please sign in to comment.