]> git.mjollnir.org Git - cil.git/commitdiff
Fixed multiple issues related to missing dependencies or namespacing
authorPenny Leach <penny@mjollnir.org>
Tue, 21 Jul 2009 09:35:52 +0000 (11:35 +0200)
committerAndrew Chilton <andychilton@gmail.com>
Mon, 9 Nov 2009 03:49:10 +0000 (16:49 +1300)
lib/CIL/Command/Am.pm
lib/CIL/Command/Attach.pm
lib/CIL/Command/Edit.pm

index dde1812acd79ed16e548d37cb21caad9d718e7b5..02b96e60334aa9d059c87130fd86b929d01699db 100644 (file)
@@ -24,6 +24,8 @@ package CIL::Command::Am;
 use strict;
 use warnings;
 
+use File::Slurp qw(read_file write_file);
+use Email::Date qw(find_date);
 use base qw(CIL::Command);
 
 ## ----------------------------------------------------------------------------
@@ -33,15 +35,16 @@ sub name { 'am' }
 sub run {
     my ($self, $cil, undef, $email_filename) = @_;
 
-    unless ( -f $email_filename ) {
-        $cil->fatal("couldn't load email '$email_filename'");
+
+    unless ( -r $email_filename ) {
+        CIL::Utils::fatal("couldn't load email '$email_filename'");
     }
 
     my $msg_text = read_file($email_filename);
 
     my $email = Email::Simple->new($msg_text);
     unless ( defined $email ) {
-        $cil->fatal("email file '$email_filename' didn't look like an email");
+        CIL::Utils::fatal("email file '$email_filename' didn't look like an email");
     }
 
     # extract some fields
@@ -57,7 +60,7 @@ sub run {
         push @issue_names, @new;
     }
 
-    $cil->msg("Found possible issue names in email: ", ( join(' ', @issue_names) || '[none]' ));
+    CIL::Utils->msg("Found possible issue names in email: ", ( join(' ', @issue_names) || '[none]' ));
 
     my %issue;
     foreach ( @issue_names ) {
@@ -68,7 +71,7 @@ sub run {
     }
 
     if ( keys %issue ) {
-        $cil->msg( "Found actual issues: " . (join(' ', keys %issue)) );
+        CIL::Utils->msg( "Found actual issues: " . (join(' ', keys %issue)) );
 
         # create the new comment
         my $comment = CIL::Comment->new('tmpname');
@@ -87,7 +90,7 @@ sub run {
             $issue = (values %issue)[0];
         }
         else {
-            my $ans = ans('To which issue would you like to add this comment: ');
+            my $ans = CIL::Utils::ans('To which issue would you like to add this comment: ');
 
             # ToDo: decide whether we let them choose an arbitrary issue, for
             # now quit unless they choose one from the list
@@ -100,10 +103,10 @@ sub run {
         # set the parent issue
         $comment->Issue( $issue->name );
 
-        add_comment_loop($cil, undef, $issue, $comment);
+        CIL::Utils->add_comment_loop($cil, undef, $issue, $comment);
     }
     else {
-        $cil->msg("Couldn't find reference to any issues in the email.");
+        CIL::Utils->msg("Couldn't find reference to any issues in the email.");
 
         # no issue found so make up the issue first
         my $issue = CIL::Issue->new('tmpname');
@@ -119,8 +122,8 @@ sub run {
         CIL::Utils->display_issue_full($cil, $issue);
 
         # then ask if the user would like to add it
-        $cil->msg("Couldn't find any likely issues, so this might be a new one.");
-        my $ans = ans('Would you like to add this message as an issue shown above (y/n): ');
+        CIL::Utils->msg("Couldn't find any likely issues, so this might be a new one.");
+        my $ans = CIL::Utils::ans('Would you like to add this message as an issue shown above (y/n): ');
         return unless $ans eq 'y';
 
         CIL::Utils->add_issue_loop($cil, undef, $issue);
index 412498312f017d39eb565142adf1f5b069e3749e..f1146147bea24b9d4a0d509609b634a98176ae53 100644 (file)
@@ -25,6 +25,9 @@ use strict;
 use warnings;
 
 use base qw(CIL::Command);
+use File::Basename;
+use File::Slurp;
+use Digest::MD5 qw(md5_hex);
 
 ## ----------------------------------------------------------------------------
 
index 9c9cd89c09bf6f314104c24728ff5d42da46cb08..dcb1d92564a239c18174652cfd6a4bb14851f694 100644 (file)
@@ -54,8 +54,8 @@ sub run {
             $edit = 'n';
         }
         else {
-            msg($_) foreach @{ $issue->errors };
-            $edit = ans('Would you like to re-edit (y/n): ');
+            CIL::Utils->msg($_) foreach @{ $issue->errors };
+            $edit = CIL::Utils::ans('Would you like to re-edit (y/n): ');
         }
     }