<commit_before>#!/usr/bin/perl
#
# Pivotal Instance Management Schema for Apache HTTP Server
#
# Copyright (C) 2017-Present Pivotal Software, Inc. All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the under the Apache License, Version 2.0 (the "License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# fixrootpath.pl
#
# This script searches and replaces the installation paths specified by:
#
#   --srcdir=path or string to be replaced 
#   --dstdir=/path/to/destination/installation
#
# Pivotal Web Server patch distributions include two patterns to replace:
#
#   @@ PRODUCT_ROOT @@    --  the product root path
#   @@ SERVER_ROOT @@	  --  one /path-to-root/servers/{instance}
#                             to be used for individual server instances
#
# Invoking this script from the product root path will default the
# @@ PRODUCT_ROOT @@ to the current working directory
#
# NOTE: the whitespace within the @@ ... @@ patterns above is to prevent
# this script from modifying it's own documentation - do not include the
# spaces when specifying these patterns.

use Getopt::Long;
use File::Find;
use Cwd;

my $DESTDIR   = Cwd::cwd;
my $SUBSTDIR  = '@@PRODUCT'.'_ROOT@@';

GetOptions('srcdir=s'   => \$SUBSTDIR,
	   'dstdir=s'   => \$DESTDIR);

if (length($DESTDIR) < 2) {
    print "Error; invalid --dstdir was given, or could not be determined by Cwd::cwd\n";
    exit 1;
}

if (length($SUBSTDIR) < 2) {
    print "Error; invalid --srcdir was given\n";
    exit 1;
}

my $STRIPDIR = $SUBSTDIR;

my $URIROOT = '';

$SUBSTDIR =~ s#\/+#\\\/\+#g;
$URIROOT = '(file\:)?\/\/' . $SUBSTDIR . "\\\/\+html\\\/\+";
$STRIPDIR =~ s#\/+#\\\/\+#g;
$STRIPDIR .= '\/+html\/+';
<commit_msg>Fix Win32-style mixed slash/backslash path identification<commit_after>﻿#!/usr/bin/perl
#
# Pivotal Instance Management Schema for Apache HTTP Server
#
# Copyright (C) 2017-Present Pivotal Software, Inc. All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the under the Apache License, Version 2.0 (the "License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# fixrootpath.pl
#
# This script searches and replaces the installation paths specified by:
#
#   --srcdir=path or string to be replaced 
#   --dstdir=/path/to/destination/installation
#
# Pivotal Web Server patch distributions include two patterns to replace:
#
#   @@ PRODUCT_ROOT @@    --  the product root path
#   @@ SERVER_ROOT @@	  --  one /path-to-root/servers/{instance}
#                             to be used for individual server instances
#
# Invoking this script from the product root path will default the
# @@ PRODUCT_ROOT @@ to the current working directory
#
# NOTE: the whitespace within the @@ ... @@ patterns above is to prevent
# this script from modifying it's own documentation - do not include the
# spaces when specifying these patterns.

use Getopt::Long;
use File::Find;
use Cwd;

my $DESTDIR   = Cwd::cwd;
my $SUBSTDIR  = '@@PRODUCT'.'_ROOT@@';

GetOptions('srcdir=s'   => \$SUBSTDIR,
	   'dstdir=s'   => \$DESTDIR);

if (length($DESTDIR) < 2) {
    print "Error; invalid --dstdir was given, or could not be determined by Cwd::cwd\n";
    exit 1;
}

if (length($SUBSTDIR) < 2) {
    print "Error; invalid --srcdir was given\n";
    exit 1;
}

my $STRIPDIR = $SUBSTDIR;

my $URIROOT = '';

$SUBSTDIR =~ s#\/+#\\\/\+#g;
$SUBSTDIR =~ s#\\+#[\\\\\\\/]\+#g;
$URIROOT = '(file\:)?\/\/' . $SUBSTDIR . "\\\/\+html\\\/\+";
$STRIPDIR =~ s#\/+#\\\/\+#g;
$STRIPDIR =~ s#\\+#[\\\\\\\/]\+#g;
$STRIPDIR .= '\/+html\/+';

{'fraction_non_alphanumeric': 0.13708772717074266, 'fraction_numerical': 0.005833520305137985, 'mean_word_length': 3.3705882352941177, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4927768', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1397, 'n_words': 519}