Permalink
Browse files

Add flag for excluding files

  • Loading branch information...
1 parent 04fabf1 commit 2fd09db841d3337b40db243cb7c819155107d005 @forestbelton forestbelton committed Jan 22, 2014
Showing with 24 additions and 6 deletions.
  1. +4 −0 bin/jemplate
  2. +12 −3 jemplate
  3. +8 −3 lib/Jemplate.pm
View
@@ -63,6 +63,7 @@ Where C<compile-opt> can include:
--eval
--noeval
-s, --source
+ --exclude
See below for more information
@@ -149,4 +150,7 @@ These compile time options are specific to Jemplate.
Include the original template source code as a JavaScript
comment next to each compiled template.
+ --exclude
+ Exclude any file matching the given regular expression.
+
=cut
View
@@ -19988,6 +19988,7 @@ Where "compile-opt" can include:
--eval
--noeval
-s, --source
+ --exclude
For more information use:
perldoc jemplate
@@ -20007,7 +20008,7 @@ sub main {
return unless $compile;
}
- my $templates = make_file_list(@argv);
+ my $templates = make_file_list($jemplate_options->{exclude}, @argv);
print_usage_and_exit() unless @$templates;
if ($list) {
@@ -20064,7 +20065,8 @@ sub get_options {
? $ENV{JEMPLATE_EVAL_JAVASCRIPT}
: 1;
- my $source = 0;
+ my $source = 0;
+ my $exclude = 0;
my ($ajax, $json, $xxx, $xhr, $compact, $minify);
my $help = 0;
@@ -20083,6 +20085,7 @@ sub get_options {
"eval!" => \$eval_javascript,
"source|s" => \$source,
+ "exclude=s" => \$exclude,
"ajax:s" => \$ajax,
"json:s" => \$json,
@@ -20125,6 +20128,7 @@ sub get_options {
$options,
{ compile => $compile, runtime => $runtime, list => $list,
source => $source,
+ exclude => $exclude,
ajax => $ajax, json => $json, xxx => $xxx, xhr => $xhr,
compact => $compact, minify => $minify },
);
@@ -20154,13 +20158,14 @@ sub recurse_dir {
}
sub make_file_list {
- my @args = @_;
+ my ($exclude, @args) = @_;
my @list;
foreach my $arg (@args) {
unless (-e $arg) { next; } # file exists
unless (-s $arg or -d $arg) { next; } # file size > 0 or directory (for Win platform)
+ if ($exclude and $arg =~ m/$exclude/) { next; } # file matches exclude regex
if (-d $arg) {
foreach my $full ( recurse_dir($arg) ) {
@@ -20388,6 +20393,7 @@ Where C<compile-opt> can include:
--eval
--noeval
-s, --source
+ --exclude
See below for more information
@@ -20474,4 +20480,7 @@ These compile time options are specific to Jemplate.
Include the original template source code as a JavaScript
comment next to each compiled template.
+ --exclude
+ Exclude any file matching the given regular expression.
+
=cut
View
@@ -74,6 +74,7 @@ Where "compile-opt" can include:
--eval
--noeval
-s, --source
+ --exclude
For more information use:
perldoc jemplate
@@ -93,7 +94,7 @@ sub main {
return unless $compile;
}
- my $templates = make_file_list(@argv);
+ my $templates = make_file_list($jemplate_options->{exclude}, @argv);
print_usage_and_exit() unless @$templates;
if ($list) {
@@ -150,7 +151,8 @@ sub get_options {
? $ENV{JEMPLATE_EVAL_JAVASCRIPT}
: 1;
- my $source = 0;
+ my $source = 0;
+ my $exclude = 0;
my ($ajax, $json, $xxx, $xhr, $compact, $minify);
my $help = 0;
@@ -169,6 +171,7 @@ sub get_options {
"eval!" => \$eval_javascript,
"source|s" => \$source,
+ "exclude=s" => \$exclude,
"ajax:s" => \$ajax,
"json:s" => \$json,
@@ -211,6 +214,7 @@ sub get_options {
$options,
{ compile => $compile, runtime => $runtime, list => $list,
source => $source,
+ exclude => $exclude,
ajax => $ajax, json => $json, xxx => $xxx, xhr => $xhr,
compact => $compact, minify => $minify },
);
@@ -240,13 +244,14 @@ sub recurse_dir {
}
sub make_file_list {
- my @args = @_;
+ my ($exclude, @args) = @_;
my @list;
foreach my $arg (@args) {
unless (-e $arg) { next; } # file exists
unless (-s $arg or -d $arg) { next; } # file size > 0 or directory (for Win platform)
+ if ($exclude and $arg =~ m/$exclude/) { next; } # file matches exclude regex
if (-d $arg) {
foreach my $full ( recurse_dir($arg) ) {

0 comments on commit 2fd09db

Please sign in to comment.