Merge pull request #2298 from spjspj/master

spjspj - Generate a 'tracking issue' similar to Fenhl's for kaladesh.…
This commit is contained in:
spjspj 2016-09-17 12:40:39 +10:00 committed by GitHub
commit 6c92b47cd7

View file

@ -14,12 +14,43 @@ my %knownSets;
my @setCards; my @setCards;
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
while(my $line = <DATA>) {
my @data = split('\\|', $line);
$knownSets{$data[0]} = $data[1];
#print ("$data[0] ===> $data[1]\n");
}
close(DATA);
# gets the set name # gets the set name
my $setName = $ARGV[0]; my $setName = $ARGV[0];
if(!$setName) { if(!$setName) {
print 'Enter a set name: '; print 'Enter a set name: ';
$setName = <STDIN>; $setName = <STDIN>;
chomp $setName; chomp $setName;
$setName = $setName;
}
while (!defined ($knownSets{$setName}))
{
print ("Invalid set - '$setName'\n");
print (" Possible sets you meant:\n");
my $origSetName = $setName;
$setName =~ s/^(.).*/$1/;
my $key;
foreach $key (sort keys (%knownSets))
{
if ($key =~ m/^$setName/img)
{
print (" '$key'\n");
}
}
print 'Enter a set name: ';
$setName = <STDIN>;
$setName = $setName;
chomp $setName;
} }
@ -32,13 +63,6 @@ while(my $line = <DATA>) {
} }
close(DATA); close(DATA);
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
while(my $line = <DATA>) {
my @data = split('\\|', $line);
$knownSets{$data[0]}= $data[1];
}
close(DATA);
open (DATA, $setsFile) || die "can't open $setsFile"; open (DATA, $setsFile) || die "can't open $setsFile";
while(my $line = <DATA>) { while(my $line = <DATA>) {
my @data = split('\\|', $line); my @data = split('\\|', $line);
@ -63,11 +87,16 @@ sub toCamelCase {
} }
# TODO: check for basic lands with ending 1,2,3,4,5 ... # TODO: check for basic lands with ending 1,2,3,4,5 ...
my %cardNames;
my $toPrint = ''; my $toPrint = '';
foreach my $card (sort cardSort @setCards) { foreach my $card (sort cardSort @setCards) {
my $className = toCamelCase(@{$card}[0]); my $className = toCamelCase(@{$card}[0]);
$cardNames {@{$card}[0]} = 1;
my $currentFileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . $className . ".java"; my $currentFileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . $className . ".java";
if(! -e $currentFileName) { if(! -e $currentFileName) {
$cardNames {@{$card}[0]} = 0;
if ($toPrint) { if ($toPrint) {
$toPrint .= "\n"; $toPrint .= "\n";
} }
@ -79,3 +108,24 @@ open CARD, "> " . lc($sets{$setName}) ."_unimplemented.txt";
print CARD $toPrint; print CARD $toPrint;
close CARD; close CARD;
print ("Unimplemented cards are here: " . lc($sets{$setName}) ."_unimplemented.txt\n");
open ISSUE_TRACKER, "> " . lc($sets{$setName}) ."_issue_tracker.txt";
print ISSUE_TRACKER "# Cards in set:\n- [x] [Example Card Name] (example URL here)\n";
my $cn;
foreach $cn (sort keys (%cardNames))
{
my $x_or_not = "[ ]";
if ($cardNames {$cn} == 1)
{
$x_or_not = "[x]";
}
my $cn2 = $cn;
$cn2 =~ s/ /+/g;
print ISSUE_TRACKER "- $x_or_not [$cn] (https://www.google.com.au/search?q=$cn2+MTG&tbm=isch)\n";
}
close ISSUE_TRACKER;
print ("Tracking Issue text for a new Github issue (similar to https://github.com/magefree/mage/issues/2215): " . lc($sets{$setName}) ."_issue_tracker.txt\n");