]> iEval git - app-edwardng.git/commitdiff
Use File::Share(Dir) for templates
authorMarius Gavrilescu <marius@ieval.ro>
Tue, 8 Jul 2014 06:39:16 +0000 (09:39 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 8 Jul 2014 06:40:17 +0000 (09:40 +0300)
17 files changed:
MANIFEST
Makefile.PL
lib/App/EdwardNG.pm
share/tmpl/en/encrypt [new file with mode: 0644]
share/tmpl/en/encrypt_error [new file with mode: 0644]
share/tmpl/en/error [new file with mode: 0644]
share/tmpl/en/plain [new file with mode: 0644]
share/tmpl/en/sign [new file with mode: 0644]
share/tmpl/en/sign_error [new file with mode: 0644]
share/tmpl/en/signencrypt [new file with mode: 0644]
tmpl/en/encrypt [deleted file]
tmpl/en/encrypt_error [deleted file]
tmpl/en/error [deleted file]
tmpl/en/plain [deleted file]
tmpl/en/sign [deleted file]
tmpl/en/sign_error [deleted file]
tmpl/en/signencrypt [deleted file]

index a001eb1aa1d8b26769d8d6b77cd1b18b1e8343f1..79df2cd63edee102698c598c001f8482dfb0b499 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -14,10 +14,10 @@ t/data/mime-signed-encrypted
 t/keydir/pubring.gpg
 t/keydir/secring.gpg
 t/keydir/trustdb.gpg
-tmpl/en/encrypt
-tmpl/en/encrypt_error
-tmpl/en/error
-tmpl/en/plain
-tmpl/en/sign
-tmpl/en/sign_error
-tmpl/en/signencrypt
+share/tmpl/en/encrypt
+share/tmpl/en/encrypt_error
+share/tmpl/en/error
+share/tmpl/en/plain
+share/tmpl/en/sign
+share/tmpl/en/sign_error
+share/tmpl/en/signencrypt
index 99e91db34db0f1312fee945db8753ebefaa89ddc..8b028b9a42564b25b05b6094df3c690b8be0deb4 100644 (file)
@@ -1,5 +1,8 @@
 use 5.014000;
 use ExtUtils::MakeMaker;
+use File::ShareDir::Install;
+
+install_share 'share';
 
 WriteMakefile(
        NAME              => 'App::EdwardNG',
@@ -11,6 +14,7 @@ WriteMakefile(
        SIGN              => 1,
        PREREQ_PM         => {
                qw/Email::Sender::Simple 0
+                  File::Share           0
                   File::Slurp           0
                   Getopt::Long          0
                   MIME::Entity          5.419
@@ -18,7 +22,11 @@ WriteMakefile(
                   Mail::GnuPG           0
                   PerlX::Maybe          0
                   Template              0
-                  Try::Tiny             0/
+                  Try::Tiny             0/,
+       },
+       BUILD_REQUIRES     => {
+               qw/ExtUtils::MakeMaker     0
+                  File::ShareDir::Install 0/,
        },
        META_MERGE         => {
                dynamic_config => 0,
@@ -27,3 +35,6 @@ WriteMakefile(
                }
        }
 );
+
+package MY;
+use File::ShareDir::Install qw/postamble/;
index a9cac089365c515bf4f89e67d2b7a7c3d17b1d8d..4da1968ce2ab082321fc2ea5b334252f2ee6767e 100644 (file)
@@ -8,6 +8,7 @@ our $VERSION = '0.001';
 our @EXPORT = qw/process_message/;
 
 use Email::Sender::Simple qw/sendmail/;
+use File::Share qw/dist_file/;
 use File::Slurp qw/read_file/;
 use File::Spec::Functions qw/rel2abs/;
 use Getopt::Long;
@@ -117,7 +118,7 @@ sub run {
 
        $params{plaintext} = first_part $params{decrypted} if $params{decrypted};
 
-       my $tt = Template->new(INCLUDE_PATH => rel2abs $tmpl_path, 'tmpl');
+       my $tt = Template->new(INCLUDE_PATH => rel2abs $tmpl_path, dist_file 'App-EdwardNG', 'tmpl');
        my $data;
        $tt->process($tmpl, \%params, \$data);
        my $email = MIME::Entity->build(
diff --git a/share/tmpl/en/encrypt b/share/tmpl/en/encrypt
new file mode 100644 (file)
index 0000000..28891f0
--- /dev/null
@@ -0,0 +1,7 @@
+Message decrypted successfully.
+
+You said:
+[% plaintext %]
+
+GnuPG said:
+[% message %]
\ No newline at end of file
diff --git a/share/tmpl/en/encrypt_error b/share/tmpl/en/encrypt_error
new file mode 100644 (file)
index 0000000..842f06f
--- /dev/null
@@ -0,0 +1 @@
+Could not decrypt message: [% message %]
\ No newline at end of file
diff --git a/share/tmpl/en/error b/share/tmpl/en/error
new file mode 100644 (file)
index 0000000..8acf24f
--- /dev/null
@@ -0,0 +1 @@
+Error while processing message: [% message %]
\ No newline at end of file
diff --git a/share/tmpl/en/plain b/share/tmpl/en/plain
new file mode 100644 (file)
index 0000000..4ca17e3
--- /dev/null
@@ -0,0 +1 @@
+This message is neither signed nor encrypted.
\ No newline at end of file
diff --git a/share/tmpl/en/sign b/share/tmpl/en/sign
new file mode 100644 (file)
index 0000000..b111854
--- /dev/null
@@ -0,0 +1,4 @@
+This message is correctly signed with key [% keyid %] from [% email %].
+
+GnuPG said:
+[% message %]
\ No newline at end of file
diff --git a/share/tmpl/en/sign_error b/share/tmpl/en/sign_error
new file mode 100644 (file)
index 0000000..f35899d
--- /dev/null
@@ -0,0 +1 @@
+Could not verify message signature: [% message %]
\ No newline at end of file
diff --git a/share/tmpl/en/signencrypt b/share/tmpl/en/signencrypt
new file mode 100644 (file)
index 0000000..9fee0c2
--- /dev/null
@@ -0,0 +1,7 @@
+Message encrypted and signed with key [% keyid %] from [% email %].
+
+You said;
+[% plaintext %]
+
+GnuPG said:
+[% message %]
\ No newline at end of file
diff --git a/tmpl/en/encrypt b/tmpl/en/encrypt
deleted file mode 100644 (file)
index 28891f0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Message decrypted successfully.
-
-You said:
-[% plaintext %]
-
-GnuPG said:
-[% message %]
\ No newline at end of file
diff --git a/tmpl/en/encrypt_error b/tmpl/en/encrypt_error
deleted file mode 100644 (file)
index 842f06f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Could not decrypt message: [% message %]
\ No newline at end of file
diff --git a/tmpl/en/error b/tmpl/en/error
deleted file mode 100644 (file)
index 8acf24f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Error while processing message: [% message %]
\ No newline at end of file
diff --git a/tmpl/en/plain b/tmpl/en/plain
deleted file mode 100644 (file)
index 4ca17e3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-This message is neither signed nor encrypted.
\ No newline at end of file
diff --git a/tmpl/en/sign b/tmpl/en/sign
deleted file mode 100644 (file)
index b111854..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-This message is correctly signed with key [% keyid %] from [% email %].
-
-GnuPG said:
-[% message %]
\ No newline at end of file
diff --git a/tmpl/en/sign_error b/tmpl/en/sign_error
deleted file mode 100644 (file)
index f35899d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Could not verify message signature: [% message %]
\ No newline at end of file
diff --git a/tmpl/en/signencrypt b/tmpl/en/signencrypt
deleted file mode 100644 (file)
index 9fee0c2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Message encrypted and signed with key [% keyid %] from [% email %].
-
-You said;
-[% plaintext %]
-
-GnuPG said:
-[% message %]
\ No newline at end of file
This page took 0.044436 seconds and 4 git commands to generate.