FreePAN
view release on metacpan or search on metacpan
lib/FreePAN/Command.pm view on Meta::CPAN
sub prompt_info {
my $author_name = io->prompt('Enter your full name: ');
$self->author_name($author_name) if $author_name;
my $author_email = io->prompt('Enter your email address: ');
$self->author_email($author_email) if $author_email;
}
sub create_file {
my $path = shift;
my $template_name = shift || io->file($path)->filename;
my $content = $self->hub->template->process($template_name,
$self->all,
);
my $output = io($path);
# XXX assert is broken without a directory path.
$output->assert if $path =~ /\//;
$output->print($content);
}
sub setup {
$self->update_registry
if $self->registry_outdated;
$self->hub->registry->load;
}
sub install {
my $class_id = shift;
my $object = $self->hub->$class_id
or return;
return unless $object->can('extract_files');
my $class_title = $self->hub->$class_id->class_title;
$self->msg("Extracting files for $class_title:\n");
$self->hub->$class_id->quiet($self->quiet);
$self->hub->$class_id->extract_files;
$self->msg("\n");
}
sub install_plugins {
map {
$self->install($_->{id});
} @{$self->hub->registry->lookup->{plugins}};
}
sub create_registry {
my $registry = $self->hub->registry;
my $registry_path = $registry->registry_path;
$self->msg("Generating FreePAN Registry '$registry_path'\n");
$registry->update;
if ($registry->validate) {
$registry->write;
}
$registry->load;
}
sub registry_outdated {
my $base = io($self->hub->config->base)->chdir;
-M 'plugins' < -M 'registry.dd';
}
sub update_registry {
$self->create_registry(@_);
}
sub handle_all {
warn "-all not yet implemented\n";
}
sub handle_update {
my $base = io($self->hub->config->base)->chdir;
$self->create_registry;
$self->install_plugins;
}
sub usage {
warn <<END . $self->command_usage(" freepan -%-14s# %s\n");
usage:
freepan -update # Upate FreePAN configuration
END
}
__DATA__
=head1 NAME
FreePAN::Command - FreePAN Command Line Tool Module
=head1 SYNOPSIS
> cd ~/src/cpan/My-Module
> module -release
=head1 DESCRIPTION
=head1 AUTHOR
Brian Ingerson <INGY@cpan.org>
=head1 COPYRIGHT
Copyright (c) 2004. Brian Ingerson. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
=cut
( run in 2.370 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )