Skip to content

Commit

Permalink
DOS n dont's (#73)
Browse files Browse the repository at this point in the history
* tackling windows illiteracy one step at a time closes #71
* new ant comments
* add cache warning to Readme
* add debug build target for faster testing
* check user config at pre-install
* bump version 0.6.4

* allign readme with pre-install errors
  • Loading branch information
duncdrum committed Jul 15, 2017
1 parent e3a5b96 commit 1245093
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CBDB in TEI
[![AUR](https://img.shields.io/badge/license-GPLv3.0-blue.svg)](https://choosealicense.com/licenses/gpl-3.0/)
[![GitHub release](https://img.shields.io/badge/release-0.6.1-green.svg)](https://github.com/duncdrum/cbdb-data/releases/latest)
[![GitHub release](https://img.shields.io/badge/release-0.6.3-green.svg)](https://github.com/duncdrum/cbdb-data/releases/latest)
[![CBDB version](https://img.shields.io/badge/CBDB-20150202-red.svg)](https://hu-my.sharepoint.com/personal/hongsuwang_fas_harvard_edu/_layouts/15/guestaccess.aspx?guestaccesstoken=3E8k6iahdJx2Ew6k%2BAeKHDuP4DSSFzbpy02BbfjXhKs%3D&docid=09fda1531e3214410a18eb2aece0b003f)
[![TEI version](https://img.shields.io/badge/TEI_P5-3.1.0-yellow.svg)](http://www.tei-c.org/release/doc/tei-p5-doc/en/html/index.html)

Expand All @@ -16,8 +16,9 @@ Because *CBDB* consists of roughly ~350k records, users are strongly encouraged


## Requirements
* eXist-db version ``2.2`` or greater with min. ``2gb`` (!) allocated memory.
* (ant version ``1.10.1`` for compiling from source)
* eXist-db version ``2.2`` or greater with min. ``2gb`` (!) allocated memory.
* There are over 350k xml files in this app, so a larger then default cacheSize is recommended (min 500 Mb).
* (ant version ``1.10.1`` for compiling from source)


## Releases
Expand Down
24 changes: 15 additions & 9 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@
<property name="cbdbVersion" value="20150202"/>
<property name="build.dir" value="build"/>
<target name="xar">
<mkdir dir="${build.dir}"/>
<!-- --------------------------
Development Version
-------------------------- -->
<mkdir dir="${build.dir}"/>
<!--
Development Version includes source files
-->
<zip basedir="." destfile="${build.dir}/${project.app}-${project.version}-dev.xar" excludes="${build.dir}/*, src/xml/*.md"/>
<!-- --------------------------
GitHub Release
-------------------------- -->

<!--
Official Release for uploading on Github
-->
<!--<zip basedir="." destfile="${build.dir}/${project.app}-${project.version}.xar" excludes="${build.dir}/*, src/xml/*.xml"/>
<zip basedir="." destfile="${build.dir}/${cbdbVersion}-src.zip" includes="src/xml/*.xml"/>
<zip basedir="." destfile="${build.dir}/${teiTitle}-${project.version}.zip" includes="target/**"/>-->

<!--
DEBUG Version for faster testing
-->
<!--<zip basedir="." destfile="${build.dir}/${project.app}-${project.version}-debug.xar"
excludes="${build.dir}/*, src/xml/*.xml, **/chunk-0?/**, **/chunk-1?/**, **/chunk-2?/**">
</zip>-->
</target>
</project>

5 changes: 2 additions & 3 deletions expath-pkg.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://exist-db.org/apps/cbdb-data" abbrev="cbdb-data" version="0.6.3" spec="1.0">

<package xmlns="http://expath.org/ns/pkg" name="http://exist-db.org/apps/cbdb-data" abbrev="cbdb-data" version="0.6.4" spec="1.0">
<title>cbdb-data</title>
<dependency processor="http://exist-db.org" semver-min="3.0"/>
<dependency processor="http://exist-db.org" semver-min="3.0.4"/>
<dependency package="http://exist-db.org/apps/shared"/>
</package>
2 changes: 1 addition & 1 deletion modules/aux.xql → modules/suppl.xql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare default element namespace "http://www.tei-c.org/ns/1.0";
this module contains helper function mostly for cleaning data, testing and constructing other functions.
@author Duncan Paterson
@version 0.7
@version 0.7.1
:)


Expand Down
32 changes: 28 additions & 4 deletions pre-install.xql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
xquery version "1.0";
xquery version "3.0";

import module namespace xdb="http://exist-db.org/xquery/xmldb";
import module namespace file = "http://exist-db.org/xquery/file" at "java:org.exist.xquery.modules.file.FileModule";

(: The following external variables are set by the repo:deploy function :)

Expand All @@ -10,6 +11,8 @@ declare variable $home external;
declare variable $dir external;
(: the target collection into which the app is deployed :)
declare variable $target external;
(: the path to the exist-db installation :)
declare variable $exist_home as xs:string := system:get-exist-home();

declare function local:mkcol-recursive($collection, $components) {
if (exists($components)) then
Expand All @@ -27,6 +30,27 @@ declare function local:mkcol($collection, $path) {
local:mkcol-recursive($collection, tokenize($path, "/"))
};

(: store the collection configuration :)
local:mkcol("/db/system/config", $target),
xdb:store-files-from-pattern(concat("/system/config", $target), $dir, "*.xconf")
declare function local:check-cache-size($path as xs:string?) as xs:boolean {
if (file:is-readable($path || "/conf.xml"))
then
(
let $doc := fn:parse-xml(file:read($path || "/conf.xml"))
return
if (number(substring-before($doc//exist/db-connection/@cacheSize/string(), "M")) > 500)
then (fn:true())
else (fn:error(fn:QName('https://github.com/duncdrum/cbdb-data', 'err:cache-low'), 'Your configured cacheSize is too low')))
else(fn:true())
};

declare function local:check-mem-size($memory as xs:integer) as xs:boolean {
if ($memory > 2000000000)
then (fn:true())
else (fn:error(fn:QName('https://github.com/duncdrum/cbdb-data', 'err:memory-low'), 'Your configured -xmx memory is too low'))
};

if (local:check-mem-size(system:get-memory-max()) and local:check-cache-size($exist_home))
then (
(: store the collection configuration :)
local:mkcol("/db/system/config", $target),
xdb:store-files-from-pattern(concat("/db/system/config", $target), $dir, "*.xconf"))
else (fn:error(fn:QName('https://github.com/duncdrum/cbdb-data', 'err:pre-crash'), 'An unknown error occured during pre-install'))

0 comments on commit 1245093

Please sign in to comment.