~percona-toolkit-dev/percona-toolkit/pt-osc-asks-for-confirmation-when-alter-foreign-key-method-none-1329422

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl

# You must run the program from util/.
if ( !(-f 'aspell.en.pws' && -f 'parse-aspell-output') ) {
   die "This script must be run from the util/ directory of a branch\n"
}

use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);

# These programs should be in your PATH.
my $pod2text = 'pod2text';
my $aspell   = 'aspell';

my $tool_file = shift @ARGV;
if ( !$tool_file ) {
   die "Usage: $PROGRAM_NAME TOOL\n";
}

my ($tool_name) = $tool_file =~ m{([a-z-]+)$};
if ( !$tool_name ) {
   die "Cannot parse tool name from $tool_file";
}

# Temp files.
my $pod_file       = "/tmp/$tool_name-pod";
my $bad_words_file = "/tmp/$tool_name-misspelled-words";

# Convert tool's POD to text.
`$pod2text $tool_file > $pod_file`;

# Spell check the text file.
`cat $pod_file | $aspell --pipe --lang en_US --personal ./aspell.en.pws > $bad_words_file`;

# Parse and match the aspell output to the text file.
print "$tool_name:\n\n";
print `./parse-aspell-output $bad_words_file $pod_file`;
print "\n";

# Cleanup.
`rm -rf $pod_file`;
`rm -rf $bad_words_file`;

exit;