Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xsawyerx opened this issue Jan 5, 2015 · 2 comments
Open

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

xsawyerx opened this issue Jan 5, 2015 · 2 comments

Comments

@xsawyerx
Copy link
Owner

xsawyerx commented Jan 5, 2015

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
Copy link
Owner Author

xsawyerx commented Jan 5, 2015

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

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

@xsawyerx
Copy link
Owner Author

xsawyerx commented Jan 5, 2015

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant