Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item14152: EmptyExtension should be installable
Add the MANIFEST and sample Config.spec

Update pseudo-install.pl to process an Extension like a Contrib.
  • Loading branch information
gac410 committed Oct 17, 2016
1 parent f263412 commit a331439
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 2 deletions.
@@ -0,0 +1,3 @@
# ---+ Extensions
# ---++ %$MODULE%
1;
Empty file.
2 changes: 2 additions & 0 deletions EmptyExtension/lib/Foswiki/Extension/EmptyExtension/MANIFEST
@@ -0,0 +1,2 @@
!noci
lib/Foswiki/Extension/Empty.pm 0444 Perl module
76 changes: 76 additions & 0 deletions EmptyExtension/lib/Foswiki/Extension/EmptyExtension/build.pl
@@ -0,0 +1,76 @@
#!/usr/bin/perl -w
#
# Example build class. Copy this file to the equivalent place in your
# plugin or contrib and edit.
#
# Read the comments at the top of lib/Foswiki/Contrib/Build.pm for
# details of how the build process works, and what files you
# have to provide and where.
#
# Requires the environment variable FOSWIKI_LIBS (a colon-separated path
# list) to be set to point at the build system and any required dependencies.
# Usage: ./build.pl [-n] [-v] [target]
# where [target] is the optional build target (build, test,
# install, release, uninstall), test is the default.
# Two command-line options are supported:
# -n Don't actually do anything, just print commands
# -v Be verbose
#

# Standard preamble
use strict;
use warnings;

BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); }

use Foswiki::Contrib::Build;

# Create the build object
my $build = new Foswiki::Contrib::Build('EmptyExtension');

# Build the target on the command line, or the default target
$build->build( $build->{target} );

=begin TML
You can do a lot more with the build system if you want; for example, to add
a new target, you could do this:
<verbatim>
{
package MyModuleBuild;
our @ISA = qw( Foswiki::Contrib::Build );
sub new {
my $class = shift;
return bless( $class->SUPER::new( "MyModule" ), $class );
}
sub target_mytarget {
my $this = shift;
# Do other build stuff here
}
}
# Create the build object
my $build = new MyModuleBuild();
</verbatim>
You can also specify a different default target server for uploads.
This can be any web on any accessible Foswiki installation.
These defaults will be used when expanding tokens in .txt
files, but be warned, they can be overridden at upload time!
<verbatim>
# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';
</verbatim>
=cut

1 change: 1 addition & 0 deletions core/lib/MANIFEST
Expand Up @@ -3,6 +3,7 @@
!include ../CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn
!include ../CommentPlugin/lib/Foswiki/Plugins/CommentPlugin
!include ../ConfigurePlugin/lib/Foswiki/Plugins/ConfigurePlugin
!include ../EmptyExtension/lib/foswiki/Extension/EmptyExtension
!include ../EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin
!include ../EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin
!include ../EmptyPlugin/lib/Foswiki/Plugins/EmptyPlugin
Expand Down
16 changes: 14 additions & 2 deletions core/pseudo-install.pl
Expand Up @@ -414,6 +414,12 @@ sub isContrib {
return $module =~ /(Contrib|Skin|AddOn|^core)$/;
}

sub isExtension {
my ($module) = @_;

return $module =~ /(Extension)$/;
}

sub installModuleByName {
my $module = shift;
my $subdir = 'Plugins';
Expand All @@ -427,7 +433,8 @@ sub installModuleByName {

$module =~ s#/+$##; #remove trailing slashes
print "Processing $module\n";
$subdir = 'Contrib' if isContrib($module);
$subdir = 'Contrib' if isContrib($module);
$subdir = 'Extension' if isExtension($module);

if ( $module eq 'core' ) {

Expand Down Expand Up @@ -497,7 +504,7 @@ sub ListGitExtensions {

foreach my $r (@rp) {
my $rname = $r->{'name'};
next unless $rname =~ m/(Plugin|Contrib|AddOn|Skin)$/;
next unless $rname =~ m/(Plugin|Contrib|AddOn|Skin|Extension)$/;
if ($filter) {
next unless $rname =~ m/$filter/i;
}
Expand Down Expand Up @@ -755,6 +762,11 @@ sub installFromMANIFEST {
$spec = File::Spec->catfile( $basedir, 'lib', 'Foswiki', 'Contrib',
$module, 'Config.spec' );
}
elsif ( !$spec && isExtension($module) ) {
$spec =
File::Spec->catfile( $basedir, 'lib', 'Foswiki', 'Extension',
$module, 'Config.spec' );
}
if ( ( $enabled || isContrib($module) ) && $spec && -f $spec ) {
if ( open( my $pluginSpec, '<', $spec ) ) {
$localConfiguration .= "# $module specific configuration\n";
Expand Down

0 comments on commit a331439

Please sign in to comment.