From 506e08eb829bb26ae54bd8dc81adafdb4736e650 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Wed, 28 Oct 2015 10:13:43 +0100 Subject: [PATCH] Add helper scripts for packaging --- tools/check_so_changes.sh | 23 +++++++++++++ tools/generate-guide-html.pl | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 tools/check_so_changes.sh create mode 100755 tools/generate-guide-html.pl diff --git a/tools/check_so_changes.sh b/tools/check_so_changes.sh new file mode 100755 index 000000000..d77e39c39 --- /dev/null +++ b/tools/check_so_changes.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +[ $# -eq 1 ] && since=$1 || { + since=$(git describe --tags | cut -d'-' -f1) + since=$(git show $since | sed '/Date/!d;s/Date: *//') +} + +check_changes() +{ + git fetch origin + changes=$(git log --pretty=oneline --since="$since" --remotes -- c_src | wc -l) + [ $((changes)) -eq 0 ] || echo "* $1" +} + +echo "Checking library changes since $since..." +for dep in deps/*/c_src +do + cd ${dep%/c_src} + check_changes $(echo $dep | cut -d'/' -f2) + cd ../.. +done +check_changes jlib +echo "Done." diff --git a/tools/generate-guide-html.pl b/tools/generate-guide-html.pl new file mode 100755 index 000000000..1adace4b6 --- /dev/null +++ b/tools/generate-guide-html.pl @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use strict; +use File::Slurp; +use IPC::Run3; + +my $index = read_file("content/admin/guide/index.md"); +my @files; +my %refs; +my $idx = 0; + +while ($index =~ /\[.*?\]\[(.*?)\]/g) { + $refs{$1} = $idx++; +} + +while ($index =~ /\[(.*?)\]:\s*(\S+)/g) { + $files[$refs{$1}] = $2 if exists $refs{$1}; +} + +my @css = ("static/shared/css/docs.style.min.css", "static/shared/css/pygments.min.css"); +my $css = join("\n", map {read_file($_)} @css); + +$css.= " +.TOC { float: left; width: 20% } +#content { float: left; width: 70%; } +code { + background: inherit; + color: inherit; + margin: 0px; + padding: 0px; + font-size: inherit !important; + font-family: inherit; +} +"; +$css =~ s/\n/\n /g; + +my $in; + +$in="--- +title: ejabberd Installation and Operation Guide +bodyclass: nocomment +HTML header: +--- + +{{TOC}} +
+"; + +$idx = 1; +for (@files) { + s/\/$/.md/; + my $content = read_file("content".$_); + $content =~ s/^---.*?---\s*//s; + $content =~ s/\[(.*?)\]\[(.*?)\]/[$1][$idx$2]/g; + $content =~ s/\[(.*?)\]:/[$idx$1]:/g; + $in.= "$content\n\n"; + $idx++; +} +my $out; +run3("multimarkdown", \$in, \$out, \undef); + +$out =~ s/class="TOC"/id="sidebar" class="TOC"/; + +write_file("guide.html", $out);