module-starter icon indicating copy to clipboard operation
module-starter copied to clipboard

Better templating support [rt.cpan.org #12017]

Open xsawyerx opened this issue 9 years ago • 2 comments

https://rt.cpan.org/Ticket/Display.html?id=12017

Module::Starter is great, very useful but it could be even more useful. Here are some ideas for when a user is using a template directory (and perhaps even an inline template set):

* Where a standard file is missing from the directory (e.g. .cvsignore) then that file is not cretated - currently a 0 byte file of that name is created. I would find this useful because i use subversion and choose to name my ignore files .svnignore rather than .cvsignore
* Where a file is in the template directory but Module::Starter doesn't know about it, the file should just be processed like any other file and just placed in the target directory. (e.g. I can place a MANIFEST.SKIP in my template directory and this will be copied through,  i can add a T::D test into the t/ directory and this will be copied through etc. etc.)

I think by adding these features it will make Module::Starter even more flexible and give fewer people a reason not to use it.

I'm happy to look at providing a patch if you're busy and are upfront about what guidlines i'll have to stick to for the patch to be accepted 

xsawyerx avatar Jan 05 '15 18:01 xsawyerx

RJBS - 2005-07-07 02:23:20

I agree with your comments, and want to address them soon.

xsawyerx avatar Jan 05 '15 18:01 xsawyerx

sjn - 2006-09-04 11:49:33

On Ons. 06. Jul. 2005 22:23:20, RJBS wrote:

I agree with your comments, and want to address them soon.

How are things going with this? I'd like to see this kind of support too...

Right now I'm overriding create_MANIFEST with this (which, obviously, isn't a solution that should be necessary when using an open source tool.)

==============================8<------------------------ package Module::Starter::Plugin::Template::ManifestSkip;

sub create_MANIFEST { my $self = shift; my @files = @_;

push(@files, $self->create_MANIFEST_SKIP() );

$self->SUPER::create_MANIFEST(@files);

}

sub create_MANIFEST_SKIP { my $self = shift;

my $fname = File::Spec->catfile( $self->{basedir}, "MANIFEST.SKIP" );
open( my $fh, ">", $fname ) or die "Can't create $fname: $!\n";
print $fh $self->MANIFEST_SKIP_guts();
close $fh;

$self->progress( "Created $fname" );

return "MANIFEST.SKIP";

}

sub MANIFEST_SKIP_guts { my $self = shift; my %options;

my $template = $self->{templates}{"MANIFEST.SKIP"};
$self->render($template, \%options);

} --------------------->8==================================

A more general solution for adding files would be GREATLY appreciated! (hint, hint :)

xsawyerx avatar Jan 05 '15 18:01 xsawyerx