Skip to content

Commit

Permalink
Make Makefile.PL be interactive as a last resort
Browse files Browse the repository at this point in the history
Following feedback from Yitzchak Scott-Thoennes on London.pm,
stop and ask a question if the engine isn't running rather than
panicing and giving up.

Use ExtUtils::MakeMaker::prompt so interactive scripts dtrt
  • Loading branch information
2shortplanks committed Dec 6, 2012
1 parent cad3f26 commit 2e28695
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Makefile.PL
@@ -1,3 +1,15 @@
#
# Attention automated build system engineers:
#
# If you're looking for a way to force the Makefile.PL to be
# created even if Keyboard Maestro Engine isn't running in an automated
# way which doesn't require you to answer "y" to the interactive prompt
# then set the PERL_KM_FORCE enviroment variable to a true value
# -- Mark
#

use ExtUtils::MakeMaker;

BEGIN {

# indicate for CPAN testers that we only support OS X
Expand All @@ -6,7 +18,7 @@ BEGIN {
}

# check that Keyboard Maestro is running and cowardly refuse to
# install if it's not
# install if it's not.
unless (`ps x` =~ /Keyboard Maestro Engine/ || $ENV{PERL_KM_FORCE}) {
print STDERR <<'BLURB';
This module requires Keyboard Maestro to be installed. The Keboard Maestro
Expand All @@ -16,16 +28,14 @@ You can download a version of Keyboard Maestro (with a free trial) from:
http://www.keyboardmaestro.com/
Giving up without creating a Makefile. Please re-run Makefile.PL once you've
installed and started Keyboard Maestro Engine.
If you do not have the Keyboard Maestro Engine running when you "make test"
then the test suite will fail.
(If for some reason you really want to install this module without first
installing Keyboard Maestro and you don't mind the test suite of this module
failing then set the PERL_KM_FORCE environment variable to true before running
this Makefile.PL)
BLURB
my $q = ExtUtils::MakeMaker::prompt("Continue with install (y/n)?","n");

# as per http://wiki.cpantesters.org/wiki/CPANAuthorNotes
exit 0;
exit 0 unless $q =~ /y/i;
}
}

Expand Down

1 comment on commit 2e28695

@paulmakepeace
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Keboard" -> "Keyboard"

Please sign in to comment.