Dist-Man

 view release on metacpan or  search on metacpan

lib/Dist/Man/Simple.pm  view on Meta::CPAN


sub create_basedir {
    my $self = shift;

    # Make sure there's no directory
    if ( -e $self->{basedir} ) {
        die( "$self->{basedir} already exists.  ".
             "Use --force if you want to stomp on it.\n"
            ) unless $self->{force};

        local @ARGV = $self->{basedir};
        rm_rf();

        die "Couldn't delete existing $self->{basedir}: $!\n"
          if -e $self->{basedir};
    }

    CREATE_IT: {
        $self->progress( "Created $self->{basedir}" );

        local @ARGV = $self->{basedir};
        mkpath();

        die "Couldn't create $self->{basedir}: $!\n" unless -d $self->{basedir};
    }

    return;
}

=head2 create_modules( @modules )

lib/Dist/Man/Simple.pm  view on Meta::CPAN

    my $rtname = shift;

    my @parts = split( /::/, $module );
    my $filepart = (pop @parts) . '.pm';
    my @dirparts = ( $self->{basedir}, 'lib', @parts );
    my $SLASH = q{/};
    my $manifest_file = join( $SLASH, 'lib', @parts, $filepart );
    if ( @dirparts ) {
        my $dir = File::Spec->catdir( @dirparts );
        if ( not -d $dir ) {
            local @ARGV = $dir;
            mkpath @ARGV;
            $self->progress( "Created $dir" );
        }
    }

    my $module_file = File::Spec->catfile( @dirparts,  $filepart );

    $self->{module_file}{$module} = File::Spec->catfile('lib', @parts, $filepart);
    $self->create_file( $module_file, $self->module_guts( $module, $rtname ) );
    $self->progress( "Created $module_file" );

lib/Dist/Man/Simple.pm  view on Meta::CPAN

}

sub _create_t {
    my $self = shift;
    my $filename = shift;
    my $content = shift;

    my @dirparts = ( $self->{basedir}, 't' );
    my $tdir = File::Spec->catdir( @dirparts );
    if ( not -d $tdir ) {
        local @ARGV = $tdir;
        mkpath();
        $self->progress( "Created $tdir" );
    }

    my $fname = File::Spec->catfile( @dirparts, $filename );
    $self->create_file( $fname, $content );
    $self->progress( "Created $fname" );

    return "t/$filename";
}

t/dist-man-app.t  view on Meta::CPAN

use Carp;

use lib './t/lib';
use TestParseFile;

my $module_base_dir =
    File::Spec->catdir("t", "data", "mymodule-dir")
    ;

{
    local @ARGV = (qw(setup --mb --module=MyModule::Test),
        "--dir=$module_base_dir",
        qw(--distro=MyModule-Test --author=ShlomiFish
        --email=shlomif@cpan.org --license=mit --verbose
        ),
    );

    Dist::Man::App->run();
}

{

t/lib/Dist/Man/TestPlugin.pm  view on Meta::CPAN

        chomp $ENV{HOME};
        croak 'Not a valid directory. Aborting.'
            if !-d $ENV{HOME};
    }

    # Create the directories...
    my $template_dir
        = File::Spec->catdir( $ENV{HOME}, '.module-starter', 'PBP' );
    if ( not -d $template_dir ) {
        print {*STDERR} "Creating $template_dir...";
        local @ARGV = $template_dir;
        mkpath;
        print {*STDERR} "done.\n";
    }

    my $template_test_dir
        = File::Spec->catdir( $ENV{HOME}, '.module-starter', 'PBP', 't' );
    if ( not -d $template_test_dir ) {
        print {*STDERR} "Creating $template_test_dir...";
        local @ARGV = $template_test_dir;
        mkpath;
        print {*STDERR} "done.\n";
    }

    # Create or update the config file (making a backup, of course)...
    my $config_file
        = File::Spec->catfile( $ENV{HOME}, '.module-starter', 'config' );

    my @config_info;



( run in 0.635 second using v1.01-cache-2.11-cpan-49f99fa48dc )