Apache-PageKit
view release on metacpan or search on metacpan
scripts/pkit_rename_app.pl view on Meta::CPAN
while ( defined( $_ = <> ) ) {
s/\b$prefix_a(?=::)/$new_name/g;
print;
}
if ( $use_svn ) {
my $old_dir = Cwd::getcwd;
chdir $eg_root || die $!;
system( svn => mv => '--force',
"$eg_root/Model/$path", "$eg_root/Model/$new_name" ) == 0 or die $?;
my $changes = `svn status`;
system( svn => ci => -m => <<"ENDE" ) == 0 or die $?;
Rename $path to $new_name. And modilfy the following files:
$changes
ENDE
system( svn => 'update' ) == 0 or die $?;
chdir $old_dir || die $!;
}
elsif ( $use_svk ) {
my $old_dir = Cwd::getcwd;
chdir $eg_root || die $!;
system( svk => move => '--force',
"$eg_root/Model/$path", "$eg_root/Model/$new_name" ) == 0 or die $?;
my $changes = `svn status`;
system( svk => ci => -m => <<"ENDE" ) == 0 or die $?;
Rename $path to $new_name. And modilfy the following files:
$changes
ENDE
chdir $old_dir || die $!;
}
# no version control
else {
rename "$eg_root/Model/$path", "$eg_root/Model/$new_name";
}
=pod
=head1 Start a new Application with C<Apache::PageKit>
=head1 Overview
This script renames a Apache::PageKit Application and all the modules. Bellow $pkit_root/Model.
=head1 Requirements
You need a working Apache::PageKit application. Not running, you need only the files.
=head1 Usage
pkit_rename_app.pl MyNewAplicationName
pkit_rename_app.pl pkit_root MyNewAplicationName
pkit_rename_app.pl --svn pkit_root MyNewAplicationName
pkit_rename_app.pl --svk pkit_root MyNewAplicationName
C<MyNewAplicationName> is the new name for your application.
C<pkit_root> is the name of root of your application. That is the Directory where F<Config>, F<Model>, F<View> and F<Content> is.
=head1 Description
The script renames the application B<INPLACE> so do it on a backup.
It reads the F<Config/Config.xml> to figure out what your old name is.
Then all is the file F<Config/Config.xml> and all your F<*.pm> files are scanned and and replaced with your new App's name. As a last step your directory F<Model/oldname> is moved to F<Model/newname> thats it.
This might become handy if you start a new application and you can reuse a good part of an older one. It is also helpfull if you work on more sites and you have some virtualhosts running F<Apache::Pagekit> applications.
=head1 Example
Now a little example that clones the example site to anotherone.
cp -r eg a_new_site
pkit_rename_app.pl a_new_site MyNewSite
or with version control
svn co http://mysvn/repository/pagekit/trunk newapp
cd newapp
./scripts/pkit_rename_app.pl --svn eg MyNewApp
or with svk version control
svk co //depotpath/pagekit/trunk newapp
cd newapp
./scripts/pkit_rename_app.pl --svk eg MyNewApp
=head1 AUTHOR
Boris Zentner bzm@2bz.de
( run in 0.558 second using v1.01-cache-2.11-cpan-2398b32b56e )