From 0a32b0ffea877561f6ab52e34ef519b645f713fb Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 7 Sep 2010 12:22:42 +1200 Subject: [PATCH] First commit. --- Changes | 5 +++ MANIFEST | 8 +++++ META.yml | 14 ++++++++ Makefile.PL | 16 +++++++++ README | 36 +++++++++++++++++++ lib/App/BCVI/AutoInstall.pm | 72 +++++++++++++++++++++++++++++++++++++ t/00-load.t | 34 ++++++++++++++++++ t/pod.t | 12 +++++++ 8 files changed, 197 insertions(+) create mode 100644 Changes create mode 100644 MANIFEST create mode 100644 META.yml create mode 100644 Makefile.PL create mode 100644 README create mode 100644 lib/App/BCVI/AutoInstall.pm create mode 100644 t/00-load.t create mode 100644 t/pod.t diff --git a/Changes b/Changes new file mode 100644 index 0000000..9700e0b --- /dev/null +++ b/Changes @@ -0,0 +1,5 @@ +Revision history for App-BCVI-AutoInstall + +0.1 2010-08-07 + - first version, based on App::BCVI::InstallManager + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..c5ddf94 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,8 @@ +Changes +lib/App/BCVI/AutoInstall.pm +Makefile.PL +MANIFEST +README +t/00-load.t +t/pod.t +META.yml Module meta-data (added by MakeMaker) diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..11df8a6 --- /dev/null +++ b/META.yml @@ -0,0 +1,14 @@ +--- #YAML:1.0 +name: App-BCVI-AutoInstall +version: 0.1 +abstract: Automatically install bcvi on new servers. +license: ~ +author: + - Andrew Ruthven +generated_by: ExtUtils::MakeMaker version 6.42 +distribution_type: module +requires: + Test::More: 0 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.3.html + version: 1.3 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..848a4f3 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,16 @@ +use strict; +use warnings; +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'App::BCVI::AutoInstall', + AUTHOR => 'Andrew Ruthven ', + VERSION_FROM => 'lib/App/BCVI/AutoInstall.pm', + ABSTRACT_FROM => 'lib/App/BCVI/AutoInstall.pm', + PL_FILES => {}, + PREREQ_PM => { + 'Test::More' => 0, + }, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'App-BCVI-AutoInstall-*' }, +); diff --git a/README b/README new file mode 100644 index 0000000..4f2c3dc --- /dev/null +++ b/README @@ -0,0 +1,36 @@ +NAME + App::BCVI::AutoInstall - Automatically install bcvi on a new host + +DESCRIPTION + This module is a plugin for "bcvi" (see: App::BCVI). If you are + connecting to a server for the first time it will install the required + files for you. + + It requires App::BCVI::InstallManager for tracking which servers you've + already installed the bcvi files on. + +SUPPORT + You can look for information at: + + * RT: CPAN's request tracker + + + + * AnnoCPAN: Annotated CPAN documentation + + + + * CPAN Ratings + + + + * Search CPAN + + + +COPYRIGHT & LICENSE + Copyright 2010 Andrew Ruthven + + This program is free software; you can redistribute it and/or modify it + under the same terms as Perl itself. + diff --git a/lib/App/BCVI/AutoInstall.pm b/lib/App/BCVI/AutoInstall.pm new file mode 100644 index 0000000..6de81e5 --- /dev/null +++ b/lib/App/BCVI/AutoInstall.pm @@ -0,0 +1,72 @@ +package App::BCVI::AutoInstall; + +use warnings; +use strict; + +use App::BCVI::InstallManager; + +our $VERSION = '0.1'; + +sub wrap_ssh { + my ($self, @args_in) = @_; + + my $sig = $self->get_install_signature($host); + if (! defined $sig) { + $self->install_to_host($host); + } + $self->SUPER::wrap_ssh(@args_in); +} + +App::BCVI->hook_client_class(); + +1; + +__END__ + +=head1 NAME + +App::BCVI::AutoInstall - Automatically install bcvi on a new host + + +=head1 DESCRIPTION + +This module is a plugin for C (see: L). If you are connecting +to a server for the first time it will install the required files for you. + +It requires App::BCVI::InstallManager for tracking which servers you've already +installed the bcvi files on. + +=head1 SUPPORT + +You can look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L + +=item * AnnoCPAN: Annotated CPAN documentation + +L + +=item * CPAN Ratings + +L + +=item * Search CPAN + +L + +=back + + +=head1 COPYRIGHT & LICENSE + +Copyright 2010 Andrew Ruthven Eandrew@etc.gen.nzE + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..1ee3733 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,34 @@ +#!perl + +use File::Spec qw(); +use Test::More tests => 1; + +my $bin_file = find_bcvi(); + +if(not $bin_file) { + diag 'App::BCVI does not appear to be installed'; + ok(1); + exit(0); +} + +eval { require $bin_file }; +if($@) { + diag qq{Your bcvi installation ($bin_file) appears to be old/broken: "$@"}; + ok(1); + exit(0); +} + +use_ok('App::BCVI::AutoInstall'); + +exit; + + + +sub find_bcvi { + foreach my $dir (File::Spec->path) { + my $path = File::Spec->catfile($dir, 'bcvi'); + return $path if -x $path; + } + return; +} + diff --git a/t/pod.t b/t/pod.t new file mode 100644 index 0000000..ee8b18a --- /dev/null +++ b/t/pod.t @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); -- 2.30.2