Skip to content

Commit e191890

Browse files
Benoit Persongitster
authored andcommitted
git-remote-mediawiki: introduction of Git::Mediawiki.pm
We would want to allow the user to preview what he has edited locally before pushing it out (and thus creating a non-removable revision in the mediawiki's history). This patch introduces a new perl package in which we will be able to share code between that new tool and the remote helper: git-remote-mediawiki.perl. A perl package offers the best way to handle such case: Each script can select what should be imported in its namespace. The package namespacing limits the use of side effects in the shared code. An alternate solution is to concatenate a "toolset" file with each *.perl when 'make'-ing the project. In that scheme, everything is imported in the script's namespace. Plus, files should be renamed in order to chain to Git's toplevel makefile. Hence, this solution is not acceptable. Signed-off-by: Benoit Person <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9832cb9 commit e191890

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

contrib/mw-to-git/Git/Mediawiki.pm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package Git::Mediawiki;
2+
3+
use 5.008;
4+
use strict;
5+
use Git;
6+
7+
BEGIN {
8+
9+
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK);
10+
11+
# Totally unstable API.
12+
$VERSION = '0.01';
13+
14+
require Exporter;
15+
16+
@ISA = qw(Exporter);
17+
18+
@EXPORT = ();
19+
20+
# Methods which can be called as standalone functions as well:
21+
@EXPORT_OK = ();
22+
}
23+
24+
1; # Famous last words

contrib/mw-to-git/Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,36 @@
22
# Copyright (C) 2013
33
# Matthieu Moy <[email protected]>
44
#
5-
## Build git-remote-mediawiki
5+
# To install, run Git's toplevel 'make install' then run:
6+
#
7+
# make install
68

9+
GIT_MEDIAWIKI_PM=Git/Mediawiki.pm
710
SCRIPT_PERL=git-remote-mediawiki.perl
811
GIT_ROOT_DIR=../..
912
HERE=contrib/mw-to-git/
1013

1114
SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL))
15+
INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \
16+
-s --no-print-directory instlibdir)
1217

1318
all: build
1419

15-
build install clean:
20+
install_pm:
21+
install $(GIT_MEDIAWIKI_PM) $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)
22+
23+
build:
24+
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
25+
build-perl-script
26+
27+
install: install_pm
1628
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
17-
$@-perl-script
29+
install-perl-script
30+
31+
clean:
32+
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
33+
clean-perl-script
34+
rm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)
35+
1836
perlcritic:
1937
perlcritic -2 *.perl

0 commit comments

Comments
 (0)