Add theme skeleton generator

This commit is contained in:
Luc Didry 2015-10-07 00:35:10 +02:00
parent da9c06fc6b
commit 9601636ec1
5 changed files with 99 additions and 487 deletions

99
lib/Lufi/Command/theme.pm Normal file
View File

@ -0,0 +1,99 @@
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
package Lufi::Command::theme;
use Mojo::Base 'Mojolicious::Commands';
use FindBin qw($Bin);
use File::Spec qw(catfile cat dir);
use File::Path qw(make_path);
has description => 'Create new theme skeleton.';
has usage => sub { shift->extract_usage };
has message => sub { shift->extract_usage . "\nCreate new theme skeleton:\n" };
has namespaces => sub { ['Lufi::Command::theme'] };
sub run {
my $c = shift;
my $name = shift;
unless (defined $name) {
say $c->extract_usage;
exit 1;
}
my $home = File::Spec->catdir($Bin, '..', 'themes', $name);
unless (-d $home) {
# Create skeleton
mkdir $home;
mkdir File::Spec->catdir($home, 'public');
make_path(File::Spec->catdir($home, 'templates', 'layouts'));
make_path(File::Spec->catdir($home, 'lib', 'Lufi', 'I18N'));
my $i18n = <<EOF;
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
package Lufi::I18N;
use base 'Locale::Maketext';
use File::Basename qw/dirname/;
use Locale::Maketext::Lexicon {
_auto => 1,
_decode => 1,
_style => 'gettext',
'*' => [
Gettext => dirname(__FILE__) . '/I18N/*.po',
Gettext => dirname(__FILE__) . '/../../../default/lib/Lufi/I18N/*.po',
]
};
1;
EOF
open my $f, '>', File::Spec->catfile($home, 'lib', 'Lufi', 'I18N.pm') or die "Unable to open $home/lib/Lufi/I18N.pm: $!";
print $f $i18n;
close $f;
my $makefile = <<EOF;
EN=lib/Lufi/I18N/en.po
FR=lib/Lufi/I18N/fr.po
SEDOPTS=-e "s\@SOME DESCRIPTIVE TITLE\@Lufi language file\@" \\
-e "s\@YEAR THE PACKAGE'S COPYRIGHT HOLDER\@2015 Luc Didry\@" \\
-e "s\@CHARSET\@utf8\@" \\
-e "s\@the PACKAGE package\@the Lufi package\@" \\
-e '/^\\#\\. (/{N;/\\n\\#\\. (/{N;/\\n.*\\.\\.\\/default\\//{s/\\#\\..*\\n.*\\#\\./\\#. (/g}}}' \\
-e '/^\\#\\. (/{N;/\\n.*\\.\\.\\/default\\//{s/\\n/ /}}'
SEDOPTS2=-e '/^\\#.*\\.\\.\\/default\\//,+3d'
XGETTEXT=carton exec ../../local/bin/xgettext.pl
CARTON=carton exec
locales:
\$(XGETTEXT) -D templates -D ../default/templates -o \$(EN) 2>/dev/null
\$(XGETTEXT) -D templates -D ../default/templates -o \$(FR) 2>/dev/null
sed \$(SEDOPTS) -i \$(EN)
sed \$(SEDOPTS2) -i \$(EN)
sed \$(SEDOPTS) -i \$(FR)
sed \$(SEDOPTS2) -i \$(FR)
EOF
open $f, '>', File::Spec->catfile($home, 'Makefile') or die "Unable to open $home/Makefile: $!";
print $f $makefile;
close $f;
} else {
say "$name theme already exists. Aborting.";
exit 1;
}
}
=encoding utf8
=head1 NAME
Lufi::Command::theme - Create new theme skeleton.
=head1 SYNOPSIS
Usage: script/lufi theme THEME_NAME
Your new theme will be available in the themes directory.
=cut
1;

View File

@ -1,15 +0,0 @@
package Lufi::I18N;
use base 'Locale::Maketext';
use File::Basename qw/dirname/;
use Locale::Maketext::Lexicon {
_auto => 1,
_decode => 1,
_style => 'gettext',
'*' => [
Gettext => dirname(__FILE__) . '/I18N/*.po',
Gettext => dirname(__FILE__) . '/../../../default/lib/Lufi/I18N/*.po',
]
};
1;

View File

@ -1,390 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf8\n"
"Content-Transfer-Encoding: 8bit\n"
#. ($delay)
#. (max_delay)
#: templates/index.html.ep:35 templates/index.html.ep:44 templates/index.html.ep:45
msgid "%1 days"
msgstr "%1 days"
#: templates/index.html.ep:5
msgid "1 year"
msgstr ""
#: templates/index.html.ep:4 templates/index.html.ep:44
msgid "24 hours"
msgstr ""
#: templates/mail.html.ep:67
msgid ":"
msgstr ""
#: templates/about.html.ep:16
msgid "A thank you with a photo of kitten on <a href=\"https://framasphere.org/people/b13eb6b0beac0131e7e32a0000053625\" class=\"classic\">Diaspora*</a> or <a href=\"https://twitter.com/framasky\" class=\"classic\">Twitter</a> is cool too ;-)"
msgstr ""
#: templates/layouts/default.html.ep:41
msgid "About"
msgstr ""
#: templates/about.html.ep:18
msgid "As Lufi is a free software, you can install it on you own server. Have a look on the <a href=\"https://git.framasoft.org/luc/lufi/wikis/home\" class=\"classic\">Wiki</a> for the procedure."
msgstr ""
#: templates/about.html.ep:19
msgid "Back to homepage"
msgstr ""
#: templates/index.html.ep:67
msgid "Click to open the file browser"
msgstr ""
#: templates/mail.html.ep:11
msgid "Comma-separated email addresses"
msgstr ""
#: templates/index.html.ep:82
msgid "Copy all links to clipboard"
msgstr ""
#: templates/index.html.ep:83
msgid "Copy to clipboard"
msgstr ""
#: lib/Lufi/Controller/Files.pm:282
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr ""
#: lib/Lufi/Controller/Files.pm:210
msgid "Could not find the file. Are you sure of the URL?"
msgstr ""
#: templates/files.html.ep:16
msgid "Counter"
msgstr ""
#: templates/files.html.ep:17 templates/index.html.ep:58
msgid "Delete at first download?"
msgstr ""
#: templates/files.html.ep:20 templates/index.html.ep:84
msgid "Deletion link"
msgstr ""
#: templates/delays.html.ep:6
msgid "Don't worry: if a user begins to download the file before the expiration and the download ends after the expiration, he will be able to get the file."
msgstr ""
#: templates/index.html.ep:86 templates/render.html.ep:20
msgid "Download"
msgstr ""
#: templates/files.html.ep:15 templates/index.html.ep:85
msgid "Download link"
msgstr ""
#: templates/about.html.ep:10
msgid "Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file when you want."
msgstr ""
#: templates/index.html.ep:64
msgid "Drop files here"
msgstr ""
#: templates/mail.html.ep:27
msgid "Email body"
msgstr ""
#: templates/mail.html.ep:19
msgid "Email subject"
msgstr ""
#: templates/mail.html.ep:13 templates/mail.html.ep:15
msgid "Emails"
msgstr ""
#: lib/Lufi/Controller/Files.pm:146
msgid "Error: the file existed but has been deleted."
msgstr ""
#: lib/Lufi/Controller/Files.pm:187
msgid "Error: the file has not been send entirely."
msgstr ""
#: lib/Lufi/Controller/Files.pm:192
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr ""
#: templates/index.html.ep:87
msgid "Expiration:"
msgstr ""
#: templates/files.html.ep:19
msgid "Expires at"
msgstr ""
#: lib/Lufi/Controller/Files.pm:266
msgid "File deleted"
msgstr ""
#: templates/files.html.ep:14
msgid "File name"
msgstr ""
#: templates/mail.html.ep:62
msgid "Hello,\\n\\nHere's some files I want to share with you:\\n"
msgstr ""
#: templates/mail.html.ep:21 templates/mail.html.ep:23
msgid "Here's some files"
msgstr ""
#: templates/index.html.ep:89
msgid "Hit Enter, then Ctrl+C to copy all the download links"
msgstr ""
#: templates/index.html.ep:88
msgid "Hit Enter, then Ctrl+C to copy the download link"
msgstr ""
#: templates/about.html.ep:9
msgid "How does it works?"
msgstr ""
#: templates/about.html.ep:17
msgid "How to install the software on my server?"
msgstr ""
#: templates/about.html.ep:12
msgid "How to report an illegal file?"
msgstr ""
#: templates/delays.html.ep:5
msgid "If you choose a delay, the file will be deleted after that delay."
msgstr ""
#: templates/mail.html.ep:6
msgid "If you send the mail from this server, the links will be send to the server, which may lower your privacy protection."
msgstr ""
#: templates/index.html.ep:30
msgid "Important: more information on delays"
msgstr ""
#: templates/delays.html.ep:3
msgid "Information about delays"
msgstr ""
#: templates/render.html.ep:18
msgid "It seems that the key in your URL is incorrect. Please, verify your URL."
msgstr ""
#: templates/index.html.ep:11
msgid "Javascript is disabled. You won't be able to use Lufi."
msgstr ""
#: templates/about.html.ep:4
msgid "Lufi is a free (as in free speech) file hosting software."
msgstr ""
#: templates/files.html.ep:2 templates/layouts/default.html.ep:40
msgid "My files"
msgstr ""
#. (format_bytes($json->{size})
#: lib/Lufi/Controller/Files.pm:45
msgid "No enough space available on the server for this file (size: %1)."
msgstr ""
#: templates/index.html.ep:91
msgid "No expiration delay"
msgstr ""
#: templates/files.html.ep:7
msgid "Only the files sent with this browser will be listed here. The informations are stored in localStorage: if you delete your localStorage data, you'll loose this informations."
msgstr ""
#. (config('contact')
#: templates/about.html.ep:13
msgid "Please contact the administrator: %1"
msgstr ""
#: templates/render.html.ep:9
msgid "Please wait while we are getting your file"
msgstr ""
#: templates/about.html.ep:5
msgid "Privacy"
msgstr ""
#: templates/files.html.ep:6
msgid "Purge expired files from localStorage"
msgstr ""
#: templates/index.html.ep:90
msgid "Send all links by email"
msgstr ""
#: templates/mail.html.ep:34
msgid "Send with this server"
msgstr ""
#: templates/mail.html.ep:35
msgid "Send with your own mail software"
msgstr ""
#. (url_for('/')
#: templates/mail.html.ep:75
msgid "Share your files in total privacy on %1"
msgstr ""
#: templates/index.html.ep:25
msgid "Sorry, the uploading is currently disabled. Please try again later."
msgstr ""
#: lib/Lufi/Controller/Files.pm:33
msgid "Sorry, uploading is disabled."
msgstr ""
#: templates/about.html.ep:7
msgid "The administrator can only see the file's name, its size and its mimetype (what kind of file it is: video, text, etc)."
msgstr ""
#: lib/Lufi/Controller/Mail.pm:32
msgid "The email body can't be empty."
msgstr ""
#: lib/Lufi/Controller/Mail.pm:31
msgid "The email subject can't be empty."
msgstr ""
#: lib/Lufi/Controller/Files.pm:263
msgid "The file has already been deleted"
msgstr ""
#: templates/about.html.ep:6
msgid "The files uploaded on a Lufi instance are encrypted before the upload to the server: the administrator of the server can not see the file's content."
msgstr ""
#. (join(', ', @bad)
#: lib/Lufi/Controller/Mail.pm:27
msgid "The following email addresses are not valid: %1"
msgstr ""
#: lib/Lufi/Controller/Mail.pm:55
msgid "The mail has been sent."
msgstr ""
#. (url_for('/')
#: templates/about.html.ep:15
msgid "The original (and only for now) author is <a href=\"https://fiat-tux.fr\" class=\"classic\">Luc Didry</a>. If you want to support him, you can to it via <a href=\"https://flattr.com/submit/auto?user_id=_SKy_&amp;url=%1&amp;title=Lufi&amp;category=software\" class=\"classic\">Flattr</a> or with <a href=\"bitcoin:1CJYU2uGmPKhvithCGntyniTTe2hofpPX3?label=Lufi\" class=\"classic\">Bitcoin</a>."
msgstr ""
#: templates/delays.html.ep:8
msgid "This server sets limitations according to the file size. The expiration delay of your file will be the minimum between what you choose and the following limitations:"
msgstr ""
#. ($short)
#: lib/Lufi/Controller/Files.pm:247
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr ""
#. ($short)
#: lib/Lufi/Controller/Files.pm:237
msgid "Unable to get counter for %1. The token is unvalid."
msgstr ""
#: templates/layouts/default.html.ep:39
msgid "Upload files"
msgstr ""
#: templates/files.html.ep:18
msgid "Uploaded at"
msgstr ""
#: templates/index.html.ep:72
msgid "Uploaded files"
msgstr ""
#: templates/about.html.ep:3
msgid "What is Lufi?"
msgstr ""
#: templates/about.html.ep:14
msgid "Who wrote this software?"
msgstr ""
#: templates/about.html.ep:11
msgid "You can see the list of your files by clicking on the \"My files\" link at the top right of this page."
msgstr ""
#: templates/about.html.ep:8
msgid "You don't need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don't panic, it is normally the case of all sites on which you send files."
msgstr ""
#: templates/render.html.ep:21
msgid "You don't seem to have a key in your URL. You won't be able to decrypt the file. Download canceled."
msgstr ""
#: templates/render.html.ep:19
msgid "You have attempted to leave this page. The download will be canceled. Are you sure?"
msgstr ""
#: templates/index.html.ep:81
msgid "You have attempted to leave this page. The upload will be canceled. Are you sure?"
msgstr ""
#: lib/Lufi/Controller/Mail.pm:30
msgid "You must give email addresses."
msgstr ""
#. (format_bytes($json->{size})
#: lib/Lufi/Controller/Files.pm:39
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr ""
#. (format_bytes($keys[$i])
#: templates/delays.html.ep:18
msgid "between %1 and %2, the file will be kept %3 day(s)."
msgstr ""
#. (format_bytes($keys[$i])
#: templates/delays.html.ep:20
msgid "between %1 and %2, the file will be kept forever."
msgstr ""
#: templates/mail.html.ep:69
msgid "deadline: "
msgstr ""
#. (format_bytes($keys[$i])
#: templates/delays.html.ep:24
msgid "for %1 and more, the file will be kept %2 day(s)"
msgstr ""
#. (format_bytes($keys[$i])
#: templates/delays.html.ep:26
msgid "for %1 and more, the file will be kept forever."
msgstr ""
#: templates/index.html.ep:3
msgid "no time limit"
msgstr ""
#: templates/index.html.ep:65
msgid "or"
msgstr ""

View File

@ -1,21 +0,0 @@
# Lufi FR translation
# Copyright (C) 2015 Luc Didry
# This file is distributed under the same license as the Lufi package.
# Luc Didry <luc@didry.org>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2015-10-05 23:06+0200\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.5\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: fr\n"
msgid "Use Framadrop!"
msgstr "Utiliser Framadrop !"

View File

@ -1,61 +0,0 @@
% # vim:set sw=4 ts=4 sts=4 ft=html.epl expandtab:
<!DOCTYPE html>
<html>
<head>
<title>Let's Upload that FIle</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" type="image/png" href="<%= url_for('/img/favicon.png') %>">
<link rel="icon" sizes="128x128" href="<%= url_for('/img/lufi128.png') %>">
<link rel="icon" sizes="196x196" href="<%= url_for('/img/lufi196.png') %>">
<link rel="apple-touch-icon" href="<%= url_for('/img/lufi60.png') %>">
<link rel="apple-touch-icon" sizes="76x76" href="<%= url_for('/img/lufi76.png') %>">
<link rel="apple-touch-icon" sizes="120x120" href="<%= url_for('/img/lufi120.png') %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%= url_for('/img/lufi152.png') %>">
<link rel="apple-touch-icon-precomposed" sizes="128x128" href="<%= url_for('/img/lufi128.png') %>">
%= stylesheet '/css/bootstrap.min.css'
%= stylesheet '/css/cover.css'
%= stylesheet '/css/lufi.css'
%= stylesheet '/css/fontello.css'
%= javascript begin
function confirmExit() {
console.log(i18n.confirmExit);
return i18n.confirmExit;
}
% end
</head>
<body>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand"><a href="<%= url_for('/') %>"><img src="<%= url_for('/img/lufi-min.png') %>" alt="logo"> Framadrop</a></h3>
<nav>
<ul class="nav masthead-nav">
<li<%== ' class="active"' if (current_route eq 'index') %>><a href="<%= url_for('/') %>"><%= l('Use Framadrop!') %></a></li>
<li<%== ' class="active"' if (current_route eq 'files') %>><a href="<%= url_for('/files') %>"><%= l('My files') %></a></li>
<li<%== ' class="active"' if (current_route eq 'about') %>><a href="<%= url_for('/about') %>"><%= l('About') %></a></li>
</ul>
</nav>
</div>
</div>
<div class="inner cover render">
<%= content %>
</div>
<!-- <div class="mastfoot">
<div class="inner">
<p>Lufi, &copy; 2015 <a href="https://fiat-tux.fr">Luc Didry</a>, <a href="https://gnu.org/licenses/agpl.html">GNU Affero Public License</a></p>
</div>
</div> -->
</div>
</div>
</div>
% if (defined(config('piwik_img'))) {
<img src="<%== config('piwik_img') %>" style="border:0" alt="" />
% }
</body>
</html>