X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FInstallationCheck.pm;h=e8670761c918f8354ee8862ceebc77471f536b95;hb=72be9c763f3b7f7df1fae4fe10011e45f9e2ad1d;hp=ef1baba5a6a61d080d8c120e1c7266c44f741522;hpb=554034c0587282b99d58cf42758b2f836367f2eb;p=kivitendo-erp.git diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index ef1baba5a..e8670761c 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -3,7 +3,7 @@ package SL::InstallationCheck; use English '-no_match_vars'; use IO::File; -use vars qw(@required_modules @optional_modules); +use vars qw(@required_modules @optional_modules @developer_modules); use strict; @@ -24,6 +24,7 @@ BEGIN { { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-object-perl' }, { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-perl' }, { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' }, + { name => "String::ShellQuote", version => 1.01, url => "http://search.cpan.org/~rosch/", debian => 'libstring-shellquote-perl' }, { name => "Sort::Naturally", url => "http://search.cpan.org/~sburke/", debian => 'libsort-naturally-perl' }, { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/", debian => 'libtemplate-perl' }, { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' }, @@ -35,8 +36,15 @@ BEGIN { @optional_modules = (); +@developer_modules = ( + { name => "Devel::REPL", url => "http://search.cpan.org/~doy/", debian => 'libdevel-repl-perl' }, + { name => "Moose::Role", url => "http://search.cpan.org/~doy/", debian => 'libmoose-role-perl' }, + { name => "Perl::Tags", url => "http://search.cpan.org/~osfameron/", debian => 'libperl-tags-perl' }, +); + $_->{fullname} = join ' ', grep $_, @$_{qw(name version)} - for @required_modules, @optional_modules; + for @required_modules, @optional_modules, @developer_modules; + } sub module_available { @@ -46,6 +54,36 @@ sub module_available { return eval "use $module $version; 1"; } +sub check_kpsewhich { + my $exit = system("which kpsewhich > /dev/null"); + + return $exit > 0 ? 0 : 1; +} + +sub template_dirs { + my ($path) = @_; + opendir my $dh, $path || die "can't open $path"; + my @templates = sort grep { !/^\.\.?$/ } readdir $dh; + close $dh; + + return @templates; +} + +sub classes_from_latex { + my ($path, $class) = @_; + eval { use String::ShellQuote; 1 } or warn "can't load String::ShellQuote" && return; + $path = shell_quote $path; + $class = shell_quote $class; + + open my $pipe, q#egrep -rs '^[\ \t]*# . "$class' $path". q# | sed 's/ //g' | awk -F '{' '{print $2}' | awk -F '}' '{print $1}' |#; + my @cls = <$pipe>; + close $pipe; + + # can't use uniq here + my %class_hash = map { $_ => 1 } map { s/\n//; $_ } split ',', join ',', @cls; + return sort keys %class_hash; +} + my %conditional_dependencies; sub check_for_conditional_dependencies {