PrePAN

Sign in to PrePAN

Path::Maker make files and directories as scaffolding

Good

Synopsis

use Path::Maker;

my $maker = Path::Maker->new(base_dir => $ENV{HOME});
$maker->render_to_file('gitconfig.mt' => '.gitconfig', $ENV{USER});
$maker->create_dir('.swap');
$maker->write_file('.vimrc', "set directory=~/.swap\n");
$maker->chmod('.ssh/id_rsa', 0400);

__DATA__

@@ gitconfig.mt
[user]
    name = <?= $_[0] ?>

Description

Path::Maker helps you make files or directories as scaffolding. When I wrote a CLI script for mojo, I found that Mojolicious::Command is very useful. This module provides some functionality of that module with template syntax Text::MicroTemplate.

Comments

The "App::" namespace seems to be more for standalones, I don't think the namespace is right.
I agree with you :) Can you recommend me a good name?
"Path::Maker"? "Scaffolding::Maker"?
I changed the name to Path::Maker. Thanks a lot!
Doesn't Path::Tiny almost do all of this? Could just write a Path::Tiny::Chmod that adds ->chmod or ask author to put it in. The rest should be covered
oh and the template functionality should be added
When I write a script that makes files or directories as scaffolding, I need:

1. simple path manipulation
2. simple template engine

Yeah, Path::Tiny satisfies 1, but not 2.
Mojolicious::Command satisfies both, but it requires me to install all Mojolicious distribution :)
Anyway thank you for your comment, @torbjorn.
There are a number of templating engines on the cpan -- Text::Template is a fairly simple one that should fit your needs here.

Please sign up to post a review.