From: Dave Rolsky Date: Sat, 25 Apr 2009 22:35:28 +0000 (-0500) Subject: add cpan-stable-smolder X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa815f88979ebe9d1c57ef38f83a2ed16e5296cd;p=gitmo%2Fmoose-dev-utils.git add cpan-stable-smolder --- aa815f88979ebe9d1c57ef38f83a2ed16e5296cd diff --git a/cpan-stable-smolder b/cpan-stable-smolder new file mode 100755 index 0000000..9ef4fd5 --- /dev/null +++ b/cpan-stable-smolder @@ -0,0 +1,167 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use CPAN; +use Cwd; +use File::chdir; +use File::Path qw( rmtree ); + + +CPAN::HandleConfig->load(); +CPAN::Shell::setup_output(); +CPAN::Index->reload(); + +local $CPAN::Config->{tar_verbosity} = 'none'; +local $CPAN::Config->{load_module_verbosity} = 'none'; + + +my $LOGFILE = ( cwd . "/cpan-stable-smolder.log" ); + +if ( -f $LOGFILE ) { + unlink $LOGFILE; +} + +open my $log, '>', $LOGFILE || die "Could not open $LOGFILE because $!"; + +test_all_modules( + qw[ + Moose::Autobox + MooseX::Accessors::ReadWritePrivate + MooseX::App::Cmd + MooseX::Async + MooseX::Attribute::ENV + MooseX::AttributeHelpers + MooseX::Attribute::Prototype + MooseX::Attributes::Curried + MooseX::Blessed::Reconstruct + MooseX::ClassAttribute + MooseX::Clone + MooseX::ConfigFromFile + MooseX::Constructor::AllErrors + MooseX::Contract + MooseX::Control + MooseX::CurriedHandles + MooseX::Daemonize + MooseX::Declare + MooseX::DeepAccessors + MooseX::DOM + MooseX::Emulate::Class::Accessor::Fast + MooseX::FollowPBP + MooseX::Getopt + MooseX::GlobRef::Object + MooseX::InsideOut + MooseX::Iterator + MooseX::KeyedMutex + MooseX::LazyLogDispatch + MooseX::LogDispatch + MooseX::Log::Log4perl + MooseX::MakeImmutable + MooseX::Meta::TypeConstraint::ForceCoercion + MooseX::MetaDescription + MooseX::MethodAttributes + MooseX::Method::Signatures + MooseX::MultiInitArg + MooseX::MultiMethods + MooseX::MutatorAttributes + MooseX::NaturalKey + MooseX::NonMoose + MooseX::Object::Pluggable + MooseX::Param + MooseX::Params::Validate + MooseX::Plaggerize + MooseX::POE + MooseX::Policy::SemiAffordanceAccessor + MooseX::Q4MLog + MooseX::Role::Cmd + MooseX::Role::Matcher + MooseX::Role::Parameterized + MooseX::Role::TraitConstructor + MooseX::Role::XMLRPC::Client + MooseX::Scaffold + MooseX::SemiAffordanceAccessor + MooseX::SimpleConfig + MooseX::Singleton + MooseX::Storage + MooseX::Storage::Format::XML::Simple + MooseX::StrictConstructor + MooseX::Struct + MooseX::Templated + MooseX::Timestamp + MooseX::Traits + MooseX::Traits::Attribute::CascadeClear + MooseX::Types + MooseX::Types::Authen::Passphrase + MooseX::Types::Common + MooseX::Types::Data::GUID + MooseX::Types::DateTime + MooseX::Types::IO + MooseX::Types::Path::Class + MooseX::Types::Set::Object + MooseX::Types::Structured + MooseX::Types::URI + MooseX::Types::UUID + MooseX::Types::VariantTable + MooseX::WithCache + MooseX::Workers + MooseX::YAML + Fey-ORM + ] +); + +close $log; + +exit; + +sub get_distro_from_cpan { + my $project = shift; + + ( my $module = $project ) =~ s/-/::/g; + + my @mods = CPAN::Shell->expand( 'Module', $module ); + + die "Cannot resolve $project to a single module object" + if @mods > 1; + + return unless @mods; + + my $dist = $mods[0]->distribution(); + + $dist->get(); + + return $dist; +} + +sub test_module { + my $dir = shift; + + local $CWD = $dir; + + local $ENV{PERL_AUTOINSTALL} = '--defaultdeps'; + if ( -f "Makefile.PL" ) { + return ! system $^X . ' Makefile.PL && make && make test'; + } + else { + return ! system $^X . ' Build.PL && ./Build && ./Build test'; + } +} + +sub test_all_modules { + foreach my $project (@_) { + my $dist = get_distro_from_cpan($project); + + unless ($dist) { + print $log "UNKNOWN : $project (not on CPAN?)\n"; + next; + } + + my $passed = test_module( $dist->dir() ); + + my $msg = $passed ? 'SUCCESS' : 'FAIL'; + + print $log sprintf( '%7s : %s - %s', $msg, $project, $dist->base_id() ); + print $log "\n"; + } +} + +1;