| 1 | use File::Copy; |
|---|
| 2 | use File::Spec; |
|---|
| 3 | use Module::Build; |
|---|
| 4 | use strict; |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | my $class = Module::Build->subclass( |
|---|
| 9 | code => q{ |
|---|
| 10 | sub ACTION_install { |
|---|
| 11 | my $self = shift; |
|---|
| 12 | my $ret = $self->SUPER::ACTION_install(@_); |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | require OpenGuides or die; |
|---|
| 20 | my (undef, $path, undef) = File::Spec->splitpath($INC{'OpenGuides.pm'}); |
|---|
| 21 | |
|---|
| 22 | mkdir( File::Spec->catfile( $path, "OpenGuides" ) ); |
|---|
| 23 | die "Can't make template install folder: $!\n" unless (-d File::Spec->catfile( $path, "OpenGuides" ) ); |
|---|
| 24 | |
|---|
| 25 | my $templ_dir = File::Spec->catfile( $path, "OpenGuides", "templates" ); |
|---|
| 26 | |
|---|
| 27 | mkdir( $templ_dir ); |
|---|
| 28 | die "Can't make template install folder: $!\n" unless (-d $templ_dir ); |
|---|
| 29 | |
|---|
| 30 | print "Installing templates to $templ_dir\n"; |
|---|
| 31 | opendir TEMPLATES, "templates" |
|---|
| 32 | or die "Can't open template source folder: $!\n"; |
|---|
| 33 | |
|---|
| 34 | for (grep { /\.(tt)$/ } readdir(TEMPLATES)) { |
|---|
| 35 | |
|---|
| 36 | File::Copy::copy( |
|---|
| 37 | File::Spec->catfile( "templates", $_ ), |
|---|
| 38 | File::Spec->catfile( $templ_dir, $_ ) |
|---|
| 39 | ) or die "Error copying $_: $!\n";; |
|---|
| 40 | } |
|---|
| 41 | closedir(TEMPLATES); |
|---|
| 42 | print "Done!\n"; |
|---|
| 43 | |
|---|
| 44 | return $ret; |
|---|
| 45 | } |
|---|
| 46 | }, |
|---|
| 47 | ); |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | my $build = $class->new( |
|---|
| 55 | sign => 1, |
|---|
| 56 | dist_name => "OpenGuides", |
|---|
| 57 | module_name => "OpenGuides", |
|---|
| 58 | dist_version_from => "lib/OpenGuides.pm", |
|---|
| 59 | license => "perl", |
|---|
| 60 | requires => { |
|---|
| 61 | 'Algorithm::Diff' => '0.13', |
|---|
| 62 | 'CGI' => '2.92', |
|---|
| 63 | 'CGI::Carp' => 0, |
|---|
| 64 | 'CGI::Cookie' => 0, |
|---|
| 65 | 'Wiki::Toolkit' => '0.74', |
|---|
| 66 | 'Wiki::Toolkit::Feed::Atom' => 0, |
|---|
| 67 | 'Wiki::Toolkit::Feed::RSS' => 0, |
|---|
| 68 | 'Wiki::Toolkit::Formatter::UseMod' => 0, |
|---|
| 69 | 'Wiki::Toolkit::Plugin::Categoriser' => 0, |
|---|
| 70 | 'Wiki::Toolkit::Plugin::Diff' => 0, |
|---|
| 71 | 'Wiki::Toolkit::Plugin::Locator::Grid'=> 0, |
|---|
| 72 | 'Wiki::Toolkit::Plugin::RSS::Reader' => 0, |
|---|
| 73 | 'Class::Accessor' => 0, |
|---|
| 74 | 'Config::Tiny' => 0, |
|---|
| 75 | 'Data::Dumper' => 0, |
|---|
| 76 | 'File::Spec::Functions' => 0, |
|---|
| 77 | 'File::Temp' => 0, |
|---|
| 78 | 'Geo::Coordinates::UTM' => 0, |
|---|
| 79 | 'Geography::NationalGrid' => 0, |
|---|
| 80 | 'HTML::Entities' => 0, |
|---|
| 81 | 'LWP::Simple' => 0, |
|---|
| 82 | 'MIME::Lite' => 0, |
|---|
| 83 | 'Parse::RecDescent' => 0, |
|---|
| 84 | 'POSIX' => 0, |
|---|
| 85 | 'Template' => '2.15', |
|---|
| 86 | 'Term::Prompt' => 0, |
|---|
| 87 | 'Time::Piece' => 0, |
|---|
| 88 | 'URI::Escape' => 0, |
|---|
| 89 | 'XML::RSS' => 0, |
|---|
| 90 | }, |
|---|
| 91 | build_requires => { |
|---|
| 92 | 'Module::Build' => '0.26', |
|---|
| 93 | }, |
|---|
| 94 | recommends => { |
|---|
| 95 | 'DBD::SQLite' => 0, |
|---|
| 96 | 'Test::HTML::Content' => 0, |
|---|
| 97 | 'Wiki::Toolkit::Plugin::Ping' => 0, |
|---|
| 98 | 'Geo::HelmertTransform' => 0, |
|---|
| 99 | |
|---|
| 100 | 'Plucene' => 0, |
|---|
| 101 | |
|---|
| 102 | }, |
|---|
| 103 | create_makefile_pl => "passthrough", |
|---|
| 104 | script_files => [ |
|---|
| 105 | "bin/openguides-install", |
|---|
| 106 | "bin/openguides-newpage-script", |
|---|
| 107 | "bin/openguides-preferences-script", |
|---|
| 108 | "bin/openguides-search-script", |
|---|
| 109 | "bin/openguides-wiki-script", |
|---|
| 110 | ], |
|---|
| 111 | ); |
|---|
| 112 | |
|---|
| 113 | $build->add_to_cleanup( "t/indexes/" ); |
|---|
| 114 | $build->add_to_cleanup( "t/node.db" ); |
|---|
| 115 | $build->add_to_cleanup( "t/templates/tmp/" ); |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | $build->create_build_script; |
|---|