MKDoc-Core
view release on metacpan or search on metacpan
lib/MKDoc/Setup/Core.pm view on Meta::CPAN
$cur_dir =~ s/\/$//;
-d $cur_dir or do { mkdir $cur_dir || die "Cannot create $cur_dir. Reason: $!" };
-d "$cur_dir/conf" or do { mkdir "$cur_dir/conf" || die "Cannot create $cur_dir. Reason: $!" };
-d "$cur_dir/cgi" or do { mkdir "$cur_dir/cgi" || die "Cannot create $cur_dir. Reason: $!" };
chmod 0755, $cur_dir, "$cur_dir/conf", "$cur_dir/cgi";
print "\n\n";
$self->install_mksetenv();
$self->install_httpd_conf();
$self->install_mkdoc_cgi();
$self->install_success();
exit (0);
}
sub install_mksetenv
{
my $self = shift;
my $cur_dir = $self->{MKDOC_DIR};
open FP, ">$cur_dir/mksetenv.sh" || die "Cannot create '$cur_dir/mksetenv.sh'";
print FP join "\n", (
qq |export MKDOC_DIR="$cur_dir"|,
);
print FP "\n";
close FP;
chmod 0644, "$cur_dir/mksetenv.sh";
}
sub install_httpd_conf
{
my $self = shift;
my $cur_dir = $self->{MKDOC_DIR};
open FP, ">>$cur_dir/conf/httpd.conf" || die "Cannot touch $cur_dir/conf/httpd.conf. Reason: $!";
print FP '';
lib/MKDoc/Setup/Core.pm view on Meta::CPAN
chmod 0755, "$cur_dir/cgi/mkdoc.cgi";
}
sub install_success
{
my $self = shift;
my $cur_dir = $self->{MKDOC_DIR};
print "Successfully created $cur_dir/mksetenv.sh\n\n";
print "At this point you probably should add the following in your Apache httpd.conf file:\n\n";
print "# Include all MKDoc sites\n";
print "Include $cur_dir/conf/httpd.conf\n\n";
}
1;
lib/MKDoc/Setup/Site.pm view on Meta::CPAN
For the sake of the example, we'll assume that we are using a domain called
'www.example.com' which will live in /var/www/example.com.
Note that you do not need to be root to install a new site. It would be best if
you created /var/www/example.com as root and then changed the ownership to an
unprivileged user.
=head1 SETTING UP
First there is a file in your mkdoc-core directory called 'mksetenv.sh'. You
need to source this file.
source /usr/local/mkdoc-core/mksetenv.sh
Then run the following command:
perl -MMKDoc::Setup -e install_site /var/www/example.com
You should see the following screen:
1. MKDoc Directory /usr/local/mkdoc
2. Site Directory /var/www/mkdoc/example.com
3. Server Name www.example.com
lib/MKDoc/Setup/Site.pm view on Meta::CPAN
};
return 1;
}
sub install
{
my $self = shift;
$self->install_directories();
$self->install_mksetenv();
$self->install_httpd_conf();
$self->install_httpd2_conf();
$self->install_plugins();
$self->install_register_site();
$self->install_register2_site();
exit (0);
}
sub install_directories
lib/MKDoc/Setup/Site.pm view on Meta::CPAN
chmod 0755, $SITE_DIR;
chmod 0755, "$SITE_DIR/httpd";
chmod 0755, "$SITE_DIR/httpd2";
chmod 0755, $LOG_DIR;
chmod 0777, "$SITE_DIR/cache";
print "OK\n";
}
sub install_mksetenv
{
print "Creating mksetenv.sh... ";
my $self = shift;
my $MKDOC_DIR = $self->{MKDOC_DIR};
my $SITE_DIR = $self->{SITE_DIR};
my $ADMIN = $self->{ADMIN};
my $SERVER_NAME = $self->{SERVER_NAME};
open FP, ">$SITE_DIR/mksetenv.sh" or do {
warn "Cannot open-write $SITE_DIR/mksetenv.sh - skipping";
no warnings;
close FP;
return;
};
print FP <<EOF;
source $MKDOC_DIR/mksetenv.sh
export SITE_DIR="$SITE_DIR"
export SERVER_ADMIN="$ADMIN"
export SERVER_NAME="$SERVER_NAME"
EOF
close FP;
chmod 0644, "$SITE_DIR/mksetenv.sh";
print "OK\n";
}
sub install_httpd_conf
{
print "Installing httpd.conf files... ";
my $self = shift;
my $SITE_DIR = $self->{SITE_DIR};
( run in 1.854 second using v1.01-cache-2.11-cpan-140bd7fdf52 )