git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH V3 1/4] git-mw: Introduction of GitMediawiki.pm

From
Bbenoit.person@ensimag.fr <benoit.person@ensimag.fr>
Date
Jun 16, 2013, 02:31 UTC
Message-ID
<1371349893-7789-2-git-send-email-benoit.person@ensimag.fr>
In-Reply-To
<1371349893-7789-1-git-send-email-benoit.person@ensimag.fr>
From: Benoit Person <benoit.person@ensimag.fr>
GitMediawiki.pm enable code factoring between several scripts in mw-to-git.

To make it usable in scripts (ie: accessible in @INC) it adds two targets (copy_pm & install_pm) into the Makefile, one for tests and one for installation.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
---
changes from the V2:
  - Add a way to test, without installation, code that uses GitMediawiki.pm.
 contrib/mw-to-git/GitMediawiki.pm | 24 ++++++++++++++++++++++++
 contrib/mw-to-git/Makefile        | 26 +++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 contrib/mw-to-git/GitMediawiki.pm
diff --git a/contrib/mw-to-git/GitMediawiki.pm b/contrib/mw-to-git/GitMediawiki.pm
new file mode 100644
index 0000000..8a0ffc7
--- /dev/null
+++ b/contrib/mw-to-git/GitMediawiki.pm
@@ -0,0 +1,24 @@
+package GitMediawiki;
+
+use 5.008;
+use strict;
+use Git;
+
+BEGIN {
+
+our ($VERSION, @ISA, @EXPORT, @EXPORT_OK);
+
+# Totally unstable API.
+$VERSION = '0.01';
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = ();
+
+# Methods which can be called as standalone functions as well:
+@EXPORT_OK = ();
+}
+
+1; # Famous last words
\ No newline at end of file
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index 1fb2424..b0c7cf2 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -4,16 +4,36 @@
 #
 ## Build git-remote-mediawiki
 
+GIT_MEDIAWIKI_PM=GitMediawiki.pm
 SCRIPT_PERL=git-remote-mediawiki.perl
 GIT_ROOT_DIR=../..
 HERE=contrib/mw-to-git/
 
 SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL))
+INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \
+                -s --no-print-directory instlibdir)
 
 all: build
 
-build install clean:
+copy_pm:
+	cp $(GIT_MEDIAWIKI_PM) $(GIT_ROOT_DIR)/perl/blib/lib/
+
+install_pm:
+	cp $(GIT_MEDIAWIKI_PM) $(INSTLIBDIR)
+
+build: copy_pm
+	$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
+                build-perl-script
+
+install: install_pm
 	$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
-                $@-perl-script
+                install-perl-script
+
+clean:
+	$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
+                clean-perl-script
+	rm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) \
+       $(GIT_ROOT_DIR)/perl/blib/lib/$(GIT_MEDIAWIKI_PM)
+
 perlcritic:
-	perlcritic -2 *.perl
+	perlcritic -2 *.perl
\ No newline at end of file
-- 
1.8.3.GIT
Previous: benoit.person@ensimag.frNext: Matthieu Moy
Message 2 of 13 in “git-remote-mediawiki: new tool to preview local changes without pushing”
  1. 0/4 git-remote-mediawiki: new tool to preview local changes without pushingbenoit.person@ensimag.fr, Jun 16, 2013
  2. 1/4 git-mw: Introduction of GitMediawiki.pmbenoit.person@ensimag.fr, Jun 16, 2013
  3. Matthieu MoyJun 16, 2013
  4. Benoît PersonJun 16, 2013
  5. Matthieu MoyJun 17, 2013
  6. Benoît PersonJun 18, 2013
  7. Matthieu MoyJun 18, 2013
  8. Matthieu MoyJun 18, 2013
  9. 2/4 git-mw: Move some functions from git-remote-mediawiki.perl to GitMediawiki.pmbenoit.person@ensimag.fr, Jun 16, 2013
  10. 3/4 git-mw: Adding git-mw commandbenoit.person@ensimag.fr, Jun 16, 2013
  11. 4/4 git-mw: Add preview subcommand into git mw.benoit.person@ensimag.fr, Jun 16, 2013
  12. Matthieu MoyJun 16, 2013
  13. Ramkumar RamachandraJun 16, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.