Permalink
Browse files

i88: *.mk and *.mak are now considered Makefiles

This fixes issue 88. GNUmakefile, *.mk and *.mak files are now considered as
Makefiles. Extended the t/filetypes.t test for this.
  • Loading branch information...
1 parent 2060ddf commit 647260ba756d4b5a76ee19d6936576a8c307ae62 @blixtor blixtor committed with Jan 2, 2010
Showing with 18 additions and 7 deletions.
  1. +4 −2 Ack.pm
  2. +3 −0 Changes
  3. +4 −2 ack
  4. +1 −1 ack-help-types.txt
  5. +6 −2 t/filetypes.t
View
@@ -93,7 +93,7 @@ BEGIN {
jsp => [qw( jsp jspx jhtm jhtml )],
lisp => [qw( lisp lsp )],
lua => [qw( lua )],
- make => q{Makefiles},
+ make => q{Makefiles (including *.mk and *.mak)},
mason => [qw( mas mhtml mpl mtxt )],
objc => [qw( m h )],
objcpp => [qw( mm h )],
@@ -130,6 +130,8 @@ BEGIN {
}
}
}
+ # add manually Makefile extensions
+ push @{$types{$_}}, 'make' for qw{ mk mak };
# These have to be checked before any filehandle diddling.
$output_to_pipe = not -t *STDOUT;
@@ -488,7 +490,7 @@ sub filetypes {
return 'skipped' unless is_searchable( $basename );
my $lc_basename = lc $basename;
- return ('make',TEXT) if $lc_basename eq 'makefile';
+ return ('make',TEXT) if $lc_basename eq 'makefile' || $lc_basename eq 'gnumakefile';
return ('rake','ruby',TEXT) if $lc_basename eq 'rakefile';
# If there's an extension, look it up
View
@@ -38,6 +38,9 @@ NEXT
Added --clojure (Janne Hietamäk)
+ Files that match *.mk and *.mak as well as GNUmakefile are now included in
+ the ack filetype 'make' (issue 88).
+
'ack --count --no-filename regex' doesn't output a list of numbers but a
sum of all occurences. This is NOT what grep does but is the more sensible
behavior.
View
@@ -1228,7 +1228,7 @@ BEGIN {
jsp => [qw( jsp jspx jhtm jhtml )],
lisp => [qw( lisp lsp )],
lua => [qw( lua )],
- make => q{Makefiles},
+ make => q{Makefiles (including *.mk and *.mak)},
mason => [qw( mas mhtml mpl mtxt )],
objc => [qw( m h )],
objcpp => [qw( mm h )],
@@ -1265,6 +1265,8 @@ BEGIN {
}
}
}
+ # add manually Makefile extensions
+ push @{$types{$_}}, 'make' for qw{ mk mak };
# These have to be checked before any filehandle diddling.
$output_to_pipe = not -t *STDOUT;
@@ -1567,7 +1569,7 @@ sub filetypes {
return 'skipped' unless is_searchable( $basename );
my $lc_basename = lc $basename;
- return ('make',TEXT) if $lc_basename eq 'makefile';
+ return ('make',TEXT) if $lc_basename eq 'makefile' || $lc_basename eq 'gnumakefile';
return ('rake','ruby',TEXT) if $lc_basename eq 'rakefile';
# If there's an extension, look it up
View
@@ -29,7 +29,7 @@ Note that some extensions may appear in multiple types. For example,
--[no]jsp .jsp .jspx .jhtm .jhtml
--[no]lisp .lisp .lsp
--[no]lua .lua
- --[no]make Makefiles
+ --[no]make Makefiles (including *.mk and *.mak)
--[no]mason .mas .mhtml .mpl .mtxt
--[no]objc .m .h
--[no]objcpp .mm .h
View
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests => 29;
+use Test::More tests => 34;
use lib 't';
use Util;
@@ -27,7 +27,11 @@ ok( is_filetype( 'foo.handler.pod', 'perl' ), 'foo.handler.pod can be perl' );
ok( is_filetype( '/tmp/wango/foo.pod', 'perl' ), '/tmp/wango/foo.pod can be perl' );
ok( is_filetype( '/tmp/wango/foo.handler.pod', 'perl' ), '/tmp/wango/foo.handler.pod can be perl' );
ok( is_filetype( '/tmp/blongo/makefile', 'make' ), '/tmp/blongo/makefile is a makefile' );
-ok( is_filetype( 'Makefile', 'make' ), 'Makefile is a makefile' );
+ok( is_filetype( 'Rakefile', 'rake' ), 'Rakefile is a rakefile' );
+# check type 'make'
+for my $f ( qw{ Makefile makefile GNUmakefile part1.mk part2.mak } ) {
+ ok( is_filetype( $f, 'make' ), "$f is a makefile" );
+}
is(App::Ack::filetypes('foo.pod~'), 'skipped',
'correctly skip backup file');

0 comments on commit 647260b

Please sign in to comment.