From e5b967a556440c585cca53d1f104f9e0df9b6df6 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 7 May 2016 08:58:39 -0700 Subject: detect and activate buttercup tests --- lib/DhMakeELPA/Command/Packaging.pm | 16 ++++++++++++++++ lib/DhMakeELPA/Command/make.pm | 2 ++ 2 files changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm index e777a54..d992ae2 100644 --- a/lib/DhMakeELPA/Command/Packaging.pm +++ b/lib/DhMakeELPA/Command/Packaging.pm @@ -9,6 +9,7 @@ use File::Grep qw{fgrep}; use Array::Utils qw{array_minus}; use DhMakeELPA::MELPA; use File::Copy; +use File::Find::Rule; use File::Spec::Functions qw(catfile); use Git::Repository; @@ -271,4 +272,19 @@ sub create_watch { } } +sub detect_buttercup_tests { + my $self = shift; + + my @files = File::Find::Rule + ->file() + ->grep( "\\(describe " ) + ->in('.'); + + if ( scalar @files ) { + return 1; + } else { + return 0; + } +} + 1; diff --git a/lib/DhMakeELPA/Command/make.pm b/lib/DhMakeELPA/Command/make.pm index 91ba8bb..3f7818d 100644 --- a/lib/DhMakeELPA/Command/make.pm +++ b/lib/DhMakeELPA/Command/make.pm @@ -49,6 +49,8 @@ sub create_control { $src->Standards_Version( $self->debstdversion ); $src->Build_Depends->add( "debhelper (>= 9.20160402)" ); $src->Build_Depends->add( "dh-elpa" ); + $src->Build_Depends->add( "elpa-buttercup" ) + if ( $self->detect_buttercup_tests() ); $src->Homepage( $self->homepage ) if ( defined $self->homepage ); $self->fill_maintainer(); -- cgit v1.2.3