update to thumbnailator 0.4.8

This commit is contained in:
Andy Bunce 2016-04-16 22:21:17 +01:00
parent b91d5adfcb
commit 4b00a768fa
18 changed files with 303 additions and 98 deletions

34
tools/build.xq Normal file
View file

@ -0,0 +1,34 @@
(: create o/ps
: xar package and xqdoc
:)
declare namespace pkg="http://expath.org/ns/pkg";
import module namespace build = "quodatum.utils.build" at "buildx.xqm";
declare variable $base:=resolve-uri("../");
declare variable $src:=resolve-uri("../src/main/");
declare variable $dest:=resolve-uri("../dist/");
(:~
: the package definition as a pkg:package
:)
declare variable $package as element(pkg:package) :=doc(resolve-uri("expath-pkg.xml",$src))/pkg:package;
declare variable $content:=resolve-uri("content/",$src);
declare variable $dest-doc:=resolve-uri("doc/",$dest);
let $files:=build:files($src)
let $name:= build:xar-name($package)
return (
(: save xqdoc :)
build:files($content)!build:write-xqdoc(.,$content,$dest-doc),
(: write xar file :)
file:write-binary(
resolve-uri($name,$dest),
archive:create($files,$files!file:read-binary(fn:resolve-uri(.,$src)))
),
(: update package.xml located at $cxan :)
build:publish($package,resolve-uri("package.xml",$base))
)

66
tools/buildx.xqm Normal file
View file

@ -0,0 +1,66 @@
(:~
: build utils
: @author Andy Bunce
: @copyright Quodatum Ltd
: @licence Apache 2
: @since may-2015
:)
module namespace build = 'quodatum.utils.build';
declare default function namespace 'quodatum.utils.build';
declare namespace pkg="http://expath.org/ns/pkg";
(:~
: file paths below $src
: $src typically from resolve-uri
: @return sequences of relative file paths "content/ebnf/CR-xquery-31-20141218.ebnf" "..."
:)
declare function files($src as xs:string) as xs:string*
{
fn:filter(file:list($src,fn:true()),
function ($f){file:is-file($src || $f)}
)
!fn:translate(.,"\","/")
};
(:~
: write xqdoc for $src/$path to $dest
:)
declare %updating function write-xqdoc($path,$src,$dest){
let $url:=fn:resolve-uri( $path,$src)
let $type:=fetch:content-type($url)
return switch($type)
case "application/xquery"
return file:write(
fn:resolve-uri($path || ".xml",$dest),
inspect:xqdoc($url)
)
default
return ()
};
(:~
: name of dist xar file eg "fred-0.1.0.xar"
:)
declare function xar-name($package as element(pkg:package)) as xs:string
{
fn:concat($package/@abbrev , "-" ,$package/@version, ".xar")
};
(:~
: update package.xml located at $cxan to ensure has entry for package $pkg
:)
declare %updating function publish($pkg as element(pkg:package),$cxan)
{
let $doc:=copy $c:=fn:doc($cxan)
modify(
let $pack:=$c/repo/pkg[name=$pkg/@name]
let $hit:= $pack/version[@num=$pkg/@version]
let $new:=<version num="{$pkg/@version}">
<!-- generated: {fn:current-dateTime()} -->
</version>
return if($hit)then ()
else insert node $new into $pack
)
return $c
return fn:put($doc,$cxan)
};

19
tools/test.xq Normal file
View file

@ -0,0 +1,19 @@
(: create o/ps
: xar package and xqdoc
:)
declare namespace pkg="http://expath.org/ns/pkg";
import module namespace build = "quodatum.utils.build" at "buildx.xqm";
declare variable $base:=resolve-uri("../");
declare variable $src:=resolve-uri("../src/main/");
declare variable $dest:=resolve-uri("../dist/");
(:~
: the package definition as a pkg:package
:)
declare variable $package as element(pkg:package) :=doc(resolve-uri("expath-pkg.xml",$src))/pkg:package;
declare variable $content:=resolve-uri("content/",$src);
declare variable $dest-doc:=resolve-uri("doc/",$dest);
build:files($src)