From 003c18b17b4ce316dcf653836051d8cd5480665a Mon Sep 17 00:00:00 2001 From: nemunaire Date: Thu, 24 Jul 2014 18:38:47 +0200 Subject: [PATCH] Temporary patches over butler --- butler.patch | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ butler.pl | 44 +++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 butler.patch create mode 100644 butler.pl diff --git a/butler.patch b/butler.patch new file mode 100644 index 0000000..2d9c8a5 --- /dev/null +++ b/butler.patch @@ -0,0 +1,78 @@ +From 4d614d66958fead184cc0abe0c15e5c646e26b0d Mon Sep 17 00:00:00 2001 +From: nemunaire +Date: Thu, 24 Jul 2014 18:33:34 +0200 +Subject: [PATCH] butler + +--- + src/Make/DocInfo.pm | 2 +- + src/Make/Make.pm | 2 +- + src/Make/Templates.pm | 6 +++--- + src/Objects/Path.pm | 2 +- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/Make/DocInfo.pm b/src/Make/DocInfo.pm +index 67c675a..b0cdc82 100644 +--- a/src/Make/DocInfo.pm ++++ b/src/Make/DocInfo.pm +@@ -33,7 +33,7 @@ has written_in => ( + + has team => ( + is => 'ro', +- isa => enum( [qw( acu yaka )] ), ++ isa => enum( [qw( acu yaka nemu )] ), + required => 1, + ); + +diff --git a/src/Make/Make.pm b/src/Make/Make.pm +index df644a8..13f7a5d 100644 +--- a/src/Make/Make.pm ++++ b/src/Make/Make.pm +@@ -30,7 +30,7 @@ BEGIN { + ); + %PARAMS = ( + pandoc => +- "--toc --latex-engine=$ENGINE{latex} --slide-level=3 --listings", ++ "--toc --latex-engine=$ENGINE{latex} --slide-level=1 --listings", + xelatex => '-halt-on-error', + ); + +diff --git a/src/Make/Templates.pm b/src/Make/Templates.pm +index c484f40..e8cd8ae 100644 +--- a/src/Make/Templates.pm ++++ b/src/Make/Templates.pm +@@ -7,7 +7,7 @@ use utf8; + use open IO => 'utf8'; + use open ':std'; + +-use constant TEMPLATE_TYPE => 'acu'; # yaka | acu ++use constant TEMPLATE_TYPE => 'nemu'; # yaka | acu + + use lib '..'; # debug + +@@ -38,8 +38,8 @@ my %PROJECT_INFOS; + BEGIN { + $ROOT_DIR = File::Spec->rootdir(); + $TEMPLATE_DIR = +- File::Spec->catdir( $ROOT_DIR, 'sgoinfre', 'butler', 'templates', +- TEMPLATE_TYPE ); ++ File::Spec->catdir( $ROOT_DIR, 'home', 'nemunaire', 'workspace', ++ 'internship_report', 'templates', TEMPLATE_TYPE ); + + %PARTS = ( + tutorial => [qw( std frontpage copyright_and_toc newpage MAIN motto )], +diff --git a/src/Objects/Path.pm b/src/Objects/Path.pm +index e2841c9..908387a 100644 +--- a/src/Objects/Path.pm ++++ b/src/Objects/Path.pm +@@ -77,7 +77,7 @@ sub standard_for { + if ($doctype eq 'subject') { Objects::Path->new( 'subject' ) } + elsif ($doctype eq 'tutorial') { Objects::Path->new( 'tutorials' ) } + elsif ($doctype eq 'slides') { Objects::Path->new( 'slides' ) } +- elsif ($doctype eq 'other') { confess "no default path for doctype 'other'" } ++ elsif ($doctype eq 'other') { Objects::Path->new( 'report' ) } + elsif ($doctype eq 'defense') { Objects::Path->new('defenses') } + elsif ($doctype eq 'examsubject') { Objects::Path->new( 'subject' ) } + else { confess "unknown document type '$doctype'" } +-- +1.8.5.5 + diff --git a/butler.pl b/butler.pl new file mode 100644 index 0000000..8a30d8d --- /dev/null +++ b/butler.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +use 5.010_001; +use strict; +use warnings; +use utf8; +use open IO => 'utf8'; +use open ':std'; +use Data::Dumper; + +use Getopt::Long; + +use Utils::Say qw( process alert warning ); + +my $main = 'main.tex'; +my $docname = ''; +my $config_file = ''; +GetOptions( + 'main=s' => \$main, + 'docname=s' => \$docname, + 'xml=s' => \$config_file, + ); + +alert "no --docname given, can't build" unless $docname ne ''; +alert "no --xml configuration file given, can't build" unless $config_file ne ''; + +use Utils::Config; +use Utils::Git; +use Make::Templates; + +my ($config, $template, $final); +process { + $config = Utils::Config->readXML($config_file); +} "Reading $config_file" => "Project configuration read"; + +process { + $template = Make::Templates->new( $config->{project}, $docname ); +} "Creating template"; + +process { + $final = $template->assemble( $main ); +} "Assembling template"; + +print $final;