#!/usr/bin/env perl
# PODNAME: installer
# ABSTRACT: Install an .installer configuration file

use strict;
use warnings;
use App::Installer;

App::Installer->new_with_options;

__END__

=pod

=head1 NAME

installer - Install an .installer configuration file

=head1 VERSION

version 0.003

=head1 SYNOPSIS

  # Will use .installer file in local directory
  installer ~/myprojectenv

  # Using a specific installer file
  installer --file=/other/installer_file ~/myprojectenv

  # On shell do the following for using the environment after installation
  . ~/myprojectenv/export.sh

Sample .installer file might look like

  perl "5.18.1";
  url "http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.gz", with => {
    pgport => 15432,
  };
  url "http://download.osgeo.org/gdal/1.10.1/gdal-1.10.1.tar.gz";
  url "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2";
  url "http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz";
  cpanm "DBD::Pg";

The .installer file can also be fetched by URL:

  installer -u http://stardestroyer.de/postgis.installer ~/postgistest

=head1 DESCRIPTION

B<TOTALLY BETA, PLEASE TEST :D>

Bigger example for installer file options:

  url "http://host/file.tar.gz",
    with => {
      key => "value",
      other_key => undef,
    },
    enable => [qw( satan )],
    disable => [qw( god )],
    without => [qw( religion )],
    testable => 1;

Would endup with the following parameter on I<./configure>: B<--with-key=value
--with-other_key --enable-satan --disable-god --without-religion>. Also it
would run "make test" if there is a Makefile after configuration. Another
options possible (so far):

  url "http://host/file.tar.gz",
    custom_test => sub {
      $_[0]->run($_[0]->unpack_path,'testcommand','--args')
    },
    custom_configure => sub {
      $self->run($self->unpack_path,'./Configure','-des','-Dprefix='.$self->target_directory);
    },
    post_install => sub {
      $self->run(undef,'command'); # run in target directory after install
    },
    export_sh => sub {
      return "# extra lines", "# for getting added to", "# export.sh";
    };

Same options can go towards a local file:

  file "/some/local/file.tar.gz";

You can also run a custom command (it will be run inside the target directory):

  run "custom_command", "args", "args";

Install specific perl (so far no options):

  perl "5.8.8";

Or install packages via cpanm:

  cpanm qw( Yeb Dist::Zilla );

B<Be careful!> It doesn't care if you have installed a perl in the target
directory or not, and just fire up cpanm, so it would install on your local
perl installation, if you don't install perl before.

Or install packages via pip:

  pip qw( rtree imposm );

B<Be careful!> It doesn't care if you have installed pip in the target
directory or not, and just fire up pip, so it would install on your local
python environment, if you don't installed pip before.

=head1 AUTHOR

Torsten Raudssus <torsten@raudss.us>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
