Author: dom
Date: 2007-06-17 16:13:47 +0100 (Sun, 17 Jun 2007)
New Revision: 1088
Added:
trunk/static/
Modified:
trunk/Build.PL
trunk/INSTALL
trunk/lib/OpenGuides/Build.pm
trunk/lib/OpenGuides/Config.pm
Log:
Add support for installing static files (fixes #213)
Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL 2007-06-17 02:15:35 UTC (rev 1087)
+++ trunk/Build.PL 2007-06-17 15:13:47 UTC (rev 1088)
@@ -104,7 +104,7 @@
default_gmaps_search_zoom force_wgs84 google_analytics_key
licence_name licence_url licence_info_url moderation_requires_password
enable_node_image enable_common_categories enable_common_locales
- spam_detector_module
+ spam_detector_module static_path static_url
) ) {
my $q_method = $var . "__qu";
my $qu = $existing_config->$q_method;
@@ -375,5 +375,9 @@
"wanted_pages.tt"
] );
+$build->config_data( __static_files => [
+ # XXX to be supplied when we have some
+ ] );
+
# Finally write the build script.
$build->create_build_script;
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2007-06-17 02:15:35 UTC (rev 1087)
+++ trunk/INSTALL 2007-06-17 15:13:47 UTC (rev 1088)
@@ -283,6 +283,17 @@
accepts a hash with content and metadata as keys, and returns true or false
to the question of whether the edit should be considered to be spam.
+ "What directory should we install static content (CSS, images, javascript)
+ to?"
+
+OpenGuides comes with some static content which will be installed
+automatically.
+
+ "What is the URL corresponding to the static content?"
+
+You will need to configure the above directory in your web server, then
+input the URL the content will be visible at here.
+
"Distance calculation methods available are:
1) British National Grid
2) Irish National Grid
@@ -330,6 +341,7 @@
Once you have installed OpenGuides you may wish to edit templates that
provide site-specific design. These templates are stored in the directory
custom-templates/ by default and are described in the file CUSTOMISATION.
+
The id and class tags used for the CSS in OpenGuides are specified in
README.CSS.
Modified: trunk/lib/OpenGuides/Build.pm
===================================================================
--- trunk/lib/OpenGuides/Build.pm 2007-06-17 02:15:35 UTC (rev 1087)
+++ trunk/lib/OpenGuides/Build.pm 2007-06-17 15:13:47 UTC (rev 1088)
@@ -59,8 +59,10 @@
my $template_path = $config->template_path;
my $custom_template_path = $config->custom_template_path;
my $custom_lib_path = $config->custom_lib_path;
+ my $static_path = $config->static_path;
my @extra_scripts = @{ $self->config_data( "__extra_scripts" )
};
my @templates = @{ $self->config_data( "__templates" ) };
+ my @static_files = @{ $self->config_data( "__static_files" ) };
print "Installing scripts to $install_directory:\n";
# Allow for blank script_name - assume "index.cgi".
@@ -139,8 +141,8 @@
foreach my $template ( @templates ) {
if ( $FAKE ) {
print "templates/$template -> $template_path/$template
(FAKE)\n";
- } else {
- $self->copy_if_modified(from => "templates/$template", to_dir =>
$template_path, flatten => 1)
+ } else {
+ $self->copy_if_modified(from => "templates/$template", to_dir
=> $template_path, flatten => 1)
or print "Skipping $template_path/$template (unchanged)\n";
}
}
@@ -152,6 +154,16 @@
mkdir $custom_template_path or warn "Could not make
$custom_template_path";
}
}
+
+ print "Installing static files to $static_path:\n";
+ foreach my $static_file ( @static_files ) {
+ if ( $FAKE ) {
+ print "static/$static_file -> $static_path/$static_file
(FAKE)\n";
+ } else {
+ $self->copy_if_modified(from => "static/$static_file", to_dir
=> $static_path, flatten => 1)
+ or print "Skipping $static_path/$static_file (unchanged)\n";
+ }
+ }
}
sub add_custom_lib_path {
Modified: trunk/lib/OpenGuides/Config.pm
===================================================================
--- trunk/lib/OpenGuides/Config.pm 2007-06-17 02:15:35 UTC (rev 1087)
+++ trunk/lib/OpenGuides/Config.pm 2007-06-17 15:13:47 UTC (rev 1088)
@@ -21,7 +21,7 @@
centre_lat default_gmaps_zoom default_gmaps_search_zoom force_wgs84
licence_name licence_url licence_info_url moderation_requires_password
enable_node_image enable_common_categories enable_common_locales
- spam_detector_module
+ spam_detector_module static_path static_url
);
my @questions = map { $_ . "__qu" } @variables;
OpenGuides::Config->mk_accessors( @variables );
@@ -108,6 +108,7 @@
licence_url => "",
licence_info_url => "",
spam_detector_module => "",
+ static_path => "/usr/local/share/openguides/static",
);
# See if we already have some config variables set.
@@ -189,6 +190,8 @@
licence_url => "What is the URL to your licence?",
licence_info_url => "What is the URL to your local page about your
licensing policy?",
spam_detector_module => "What module would you like to use for spam
detection? (optional)",
+ static_path => "What directory should we install static content (CSS,
images, javascript) to?",
+ static_url => "What is the URL corresponding to the static
content?",
);
foreach my $var ( keys %questions ) {
@@ -315,6 +318,10 @@
=item * spam_detector_module
+=item * static_path
+
+=item * static_url
+
=back
=head1 AUTHOR
Show replies by date