diff options
Diffstat (limited to 'extensions/create.pl')
-rwxr-xr-x | extensions/create.pl | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/extensions/create.pl b/extensions/create.pl index 8927c172c..3d3bfaa93 100755 --- a/extensions/create.pl +++ b/extensions/create.pl @@ -27,7 +27,7 @@ my $base_dir = bz_locations()->{'extensionsdir'}; my $name = $ARGV[0] or ThrowUserError('extension_create_no_name'); if ($name !~ /^[A-Z]/) { - ThrowUserError('extension_first_letter_caps', { name => $name }); + ThrowUserError('extension_first_letter_caps', {name => $name}); } my $extension_dir = "$base_dir/$name"; @@ -35,33 +35,33 @@ mkpath($extension_dir) || die "$extension_dir already exists or cannot be created.\n"; my $lcname = lc($name); -foreach my $path (qw(lib web template/en/default/hook), - "template/en/default/$lcname") +foreach + my $path (qw(lib web template/en/default/hook), "template/en/default/$lcname") { - mkpath("$extension_dir/$path") || die "$extension_dir/$path: $!"; + mkpath("$extension_dir/$path") || die "$extension_dir/$path: $!"; } my $year = DateTime->now()->year; -my $template = Bugzilla->template; -my $vars = { year => $year, name => $name, path => $extension_dir }; +my $template = Bugzilla->template; +my $vars = {year => $year, name => $name, path => $extension_dir}; my %create_files = ( - 'config.pm.tmpl' => 'Config.pm', - 'extension.pm.tmpl' => 'Extension.pm', - 'util.pm.tmpl' => 'lib/Util.pm', - 'web-readme.txt.tmpl' => 'web/README', - 'hook-readme.txt.tmpl' => 'template/en/default/hook/README', - 'name-readme.txt.tmpl' => "template/en/default/$lcname/README", + 'config.pm.tmpl' => 'Config.pm', + 'extension.pm.tmpl' => 'Extension.pm', + 'util.pm.tmpl' => 'lib/Util.pm', + 'web-readme.txt.tmpl' => 'web/README', + 'hook-readme.txt.tmpl' => 'template/en/default/hook/README', + 'name-readme.txt.tmpl' => "template/en/default/$lcname/README", ); foreach my $template_file (keys %create_files) { - my $target = $create_files{$template_file}; - my $output; - $template->process("extensions/$template_file", $vars, \$output) - or ThrowTemplateError($template->error()); - open(my $fh, '>', "$extension_dir/$target"); - print $fh $output; - close($fh); + my $target = $create_files{$template_file}; + my $output; + $template->process("extensions/$template_file", $vars, \$output) + or ThrowTemplateError($template->error()); + open(my $fh, '>', "$extension_dir/$target"); + print $fh $output; + close($fh); } print get_text('extension_created', $vars), "\n"; |