package Zucchini::Config::Create; # vim: ts=8 sts=4 et sw=4 sr sta use Moose; # automatically turns on strict and warnings __PACKAGE__->meta->make_immutable; use Zucchini::Version; our $VERSION = $Zucchini::VERSION; use IO::File; sub write_default_config { my $self = shift; my $filename = shift; if (-e $filename) { # TODO - copy file to file.TIMESTAMP and create new warn "$filename already exists\n"; return; } # create a filehandle to write to my $fh = IO::File->new($filename, 'w'); # loop through the __DATA__ for this module # and print it to the filehandle while (my $line = ) { print $fh ; } $fh->close; close DATA; } 1; =head1 NAME Zucchini::Config::Create - write a sample configuration file =head1 SYNOPSIS # create a new object $zucchini_cfg_create = Zucchini::Config::Create->new(); # write out a default config file $zucchini_cfg_create->write_default_config( file($ENV{HOME}, q{.zucchini}) ); =head1 DESCRIPTION It's mean to expect people to pluck a configuration file out if thin air. This module's sole purpose is to write out a default .zucchini file to give users a fighting chance. =head1 METHODS =head2 new Creates a new instance of the top-level Zucchini object: # create a new object $zucchini_cfg_create = Zucchini::Config::Create->new(); =head2 write_default_config Given a filename, write out the default/sample configuration file. If the file already exists it I be overwritten. # write out a default config file $zucchini_cfg_create->write_default_config( file($ENV{HOME}, q{.zucchini}) ); =head1 SAMPLE CONFIGURATION FILE The sample configuration file is supposed to be a reasonable example of how a functioning configuration file should look. You should be able to get up and running with Zucchini by creating the default file, and modifying the following variables: I, I, I. You might also like to edit some of the values in the C<< >> section. =head1 SEE ALSO L, L =head1 AUTHOR Chisel Wright C<< >> =head1 LICENSE Copyright 2008-2009 by Chisel Wright This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See =cut __DATA__ default_site default # a default site source_dir /path/to/tt_templates includes_dir /path/to/tt_includes output_dir /var/www/default_site/html template_files \.html\z ignore_dirs CVS ignore_dirs .svn ignore_files \.swp\z lint_check 1 author Joe Bloggs email joe@localhost copyright © 2006-2008 Joe Bloggs. All rights reserved. hostname remote.ftp.site username joe.bloggs password sekrit passive 1 path / # a second site definition - to demonstrate how to define multiple sites source_dir /path/to/tt_templates includes_dir /path/to/tt_includes output_dir /var/www/default_site/html plugin_base MyPrefix::Template::Plugin template_files \.html\z ignore_dirs CVS ignore_dirs .svn ignore_files \.swp\z lint_check 1 author Joe Bloggs email joe@localhost copyright © 2000-2006 Joe Bloggs. All rights reserved. hostname remote.site path /home/joe.bloggs