forked from GlPortal/glPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalan
executable file
·32 lines (27 loc) · 1.05 KB
/
alan
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
#!/usr/bin/perl
use Template;
use Getopt::Long;
my $className = "";
GetOptions ("class=s" => \$className)
or die("Error in command line arguments\n");
$num_args = $#ARGV + 1;
if ($num_args != 1) {
print "\nUsage: alan generate -class=ClassName\n";
exit;
}
if (($ARGV[0] == "generate") && !($className eq "")){
print "\nGenerating ${className} class.\n";
$capitalClassName = $className;
$capitalClassName =~ s/((?<=[a-z])[A-Z][a-z]+)/_\U$1/g;
$capitalClassName =~ s/(\b[A-Z][a-z]+)/\U$1/g;
my %data = ( name => $className, capName => $capitalClassName);
my $template = Template->new;
$template->process('tools/alan/templates/hpp.tpl', \%data, "${className}.hpp") || die $template->error;
$template->process('tools/alan/templates/cpp.tpl', \%data, "${className}.cpp") || die $template->error;
exit;
}
if (($ARGV[0] == "blender") && ($ARGV[1] == "install") && (defined $ARGV[2])){
system("./tools/blender/copyGameData");
system("./tools/blender/linkExtension -b ${ARGV[2]}");
}
print "\nUsage: alan command\n";