From ad77b7d3dee6e61405535dd0dabd117398731ad1 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 31 Jan 2014 22:21:11 +0200 Subject: [PATCH] Move prepare and prepare_files to Format.pm --- lib/Gruntmaster/Daemon.pm | 25 +------------------------ lib/Gruntmaster/Daemon/Format.pm | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index b5d210d..a4d1902 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -7,7 +7,7 @@ use warnings; our $VERSION = '0.001'; use Gruntmaster::Daemon::Constants qw/ERR/; -use Gruntmaster::Daemon::Format qw/mkrun/; +use Gruntmaster::Daemon::Format qw/prepare_files/; use Gruntmaster::Data; use File::Basename qw/fileparse/; @@ -38,29 +38,6 @@ sub safe_can { safe_can_nodie @_ or get_logger->logdie("No such \l$type: '$name'"); } -sub prepare{ - my ($name, $format) = @_; - our $errors; - my $basename = fileparse $name, qr/\.[^.]*/; - get_logger->trace("Preparing file $name..."); - - $errors .= `gruntmaster-compile $format $basename $name 2>&1`; - $errors .= "\n"; - die 'Compile error' if $? -} - -sub prepare_files{ - my $meta = shift; - - for my $file (values $meta->{files}) { - my ($format, $name, $content) = @{$file}{qw/format name content/}; - - $file->{run} = mkrun($format); - write_file $name, $content; - prepare $name, $format; - } -} - sub process{ my $job = shift; diff --git a/lib/Gruntmaster/Daemon/Format.pm b/lib/Gruntmaster/Daemon/Format.pm index 137b64c..3c0a84e 100644 --- a/lib/Gruntmaster/Daemon/Format.pm +++ b/lib/Gruntmaster/Daemon/Format.pm @@ -14,7 +14,7 @@ use List::MoreUtils qw/natatime/; use IPC::Signal qw/sig_name sig_num/; our $VERSION = '0.001'; -our @EXPORT_OK = qw/mkrun/; +our @EXPORT_OK = qw/prepare_files/; ################################################## @@ -68,4 +68,27 @@ sub mkrun{ } } +sub prepare{ + my ($name, $format) = @_; + our $errors; + my $basename = fileparse $name, qr/\.[^.]*/; + get_logger->trace("Preparing file $name..."); + + $errors .= `gruntmaster-compile $format $basename $name 2>&1`; + $errors .= "\n"; + die 'Compile error' if $? +} + +sub prepare_files{ + my $meta = shift; + + for my $file (values $meta->{files}) { + my ($format, $name, $content) = @{$file}{qw/format name content/}; + + $file->{run} = mkrun($format); + write_file $name, $content; + prepare $name, $format; + } +} + 1 -- 2.39.2