Commit 764a1fa6 authored by David Lawrence's avatar David Lawrence

Bug 643904 - Bugzilla::Extension should export a web_dir attribute to get full…

Bug 643904 - Bugzilla::Extension should export a web_dir attribute to get full path to the extension's web directory r/a=mkanat
parent 17d2732f
...@@ -26,7 +26,7 @@ use Bugzilla::Constants; ...@@ -26,7 +26,7 @@ use Bugzilla::Constants;
use Bugzilla::Error; use Bugzilla::Error;
use Bugzilla::Install::Util qw( use Bugzilla::Install::Util qw(
extension_code_files extension_template_directory extension_code_files extension_template_directory
extension_package_directory); extension_package_directory extension_web_directory);
use File::Basename; use File::Basename;
use File::Spec; use File::Spec;
...@@ -214,6 +214,7 @@ sub lib_dir { ...@@ -214,6 +214,7 @@ sub lib_dir {
sub template_dir { return extension_template_directory(@_); } sub template_dir { return extension_template_directory(@_); }
sub package_dir { return extension_package_directory(@_); } sub package_dir { return extension_package_directory(@_); }
sub web_dir { return extension_web_directory(@_); }
###################### ######################
# Helper Subroutines # # Helper Subroutines #
...@@ -786,6 +787,15 @@ This defaults to the C<template> subdirectory of the L</package_dir>. ...@@ -786,6 +787,15 @@ This defaults to the C<template> subdirectory of the L</package_dir>.
If you want to override this method, and you have a F<Config.pm>, you must If you want to override this method, and you have a F<Config.pm>, you must
override this method in F<Config.pm>. override this method in F<Config.pm>.
=head3 C<web_dir>
The directory that your package's web related files are in, such as css and javascript.
This defaults to the C<web> subdirectory of the L</package_dir>.
If you want to override this method, and you have a F<Config.pm>, you must
override this method in F<Config.pm>.
=head3 C<lib_dir> =head3 C<lib_dir>
The directory where your extension's libraries are. The directory where your extension's libraries are.
......
...@@ -46,6 +46,7 @@ our @EXPORT_OK = qw( ...@@ -46,6 +46,7 @@ our @EXPORT_OK = qw(
extension_package_directory extension_package_directory
extension_requirement_packages extension_requirement_packages
extension_template_directory extension_template_directory
extension_web_directory
indicate_progress indicate_progress
install_string install_string
include_languages include_languages
...@@ -214,6 +215,14 @@ sub extension_template_directory { ...@@ -214,6 +215,14 @@ sub extension_template_directory {
return "$base_dir/template"; return "$base_dir/template";
} }
# Used in this file and in Bugzilla::Extension.
sub extension_web_directory {
my $extension = shift;
my $class = ref($extension) || $extension;
my $base_dir = extension_package_directory($class);
return "$base_dir/web";
}
# For extensions that are in the extensions/ dir, this both sets and fetches # For extensions that are in the extensions/ dir, this both sets and fetches
# the name of the directory that stores an extension's "stuff". We need this # the name of the directory that stores an extension's "stuff". We need this
# when determining the template directory for extensions (or other things # when determining the template directory for extensions (or other things
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment