Commits

Diab Jerius committed b532b82

add requirement check for mercurial hg command, path to command for tests

Comments (0)

Files changed (2)

 use Module::Build;
 
+use File::Which;
+
+die( "Cannot find Mercurial executable (hg) in path\n" )
+    unless +which('hg');
+
 Module::Build->new(
 
     module_name => 'Hg::Lib',
     license     => 'perl',
 
+    configure_requires => {
+        'Module::Build' => 0,
+        'File::Which'   => 0,
+    },
+
     requires => {
         'Exporter'                 => 0,
         'FileHandle'               => 0,
       ) => {
         'Capture::Tiny'         => 0,
         'File::Spec::Functions' => 0,
+        'File::Which'           => 0,
         'Getopt::Long'          => 0,
         'IO::Handle'            => 0,
         'IO::Pipe'              => 0,
 
 use parent Exporter;
 
-our @EXPORT = ( qw[ fake_hg ] );
+our @EXPORT = ( qw[ fake_hg hg ] );
 
 use Probe::Perl;
+use File::Which;
 use File::Spec::Functions qw[ catfile ];
 
 my $perl;
 INIT {
 
     use constant fake_hg => [ $perl, catfile( 't', 'fake-hg' ) ];
+    use constant hg => scalar which('hg');
 }
 
 1;