Skip to content

Commit 78010d1

Browse files
authored
Merge pull request #51 from line-o/fix/publish-package
fix: timeout on publish
2 parents 3e8124c + 7eb6e43 commit 78010d1

File tree

14 files changed

+127
-79
lines changed

14 files changed

+127
-79
lines changed

admin.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ <h1>Package Upload</h1>
3030
</div>
3131
<div class="col-md-6">
3232
<p>
33-
<a href="index.html?publish=true" class="btn btn-primary">
34-
<i class="glyphicon glyphicon-share"/> Publish
33+
<a href="index.html" class="btn btn-primary">
34+
<i class="glyphicon glyphicon-share"/> Return to list
3535
</a>
3636
</p>
3737
<p>Publishing will take a while to process apps.</p>

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<include name="modules/**"/>
2828
<include name="resources/**"/>
2929
<include name="templates/**"/>
30-
<include name="public/*"/>
30+
<include name="meta/*"/>
3131
<exclude name="${build}/*"/>
3232
<exclude name=".git*"/>
3333
<exclude name="*.tmpl"/>

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ <h1>Public Application Repository</h1>
1919
Manager app. Also, subscribe to the <a href="feed.xml">atom feed</a> for all package updates
2020
for this repository.</p>
2121
</div>
22-
<div data-template="app:publish"/>
2322
</div>
2423
<div class="row">
2524
<div id="listWrapper" class="col-md-8">

meta/apps.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<apps/>

meta/packages.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<packages/>

modules/app.xql

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ module namespace app="http://exist-db.org/xquery/app";
55
import module namespace config="http://exist-db.org/xquery/apps/config" at "config.xqm";
66
import module namespace scanrepo="http://exist-db.org/xquery/admin/scanrepo" at "scan.xql";
77

8-
declare function app:publish($node as node(), $model as map(*), $publish as xs:boolean?) {
9-
if ($publish) then
10-
scanrepo:scan()
11-
else
12-
()
13-
};
14-
158
declare function app:list-packages($node as node(), $model as map(*), $mode as xs:string?) {
16-
for $app in collection($config:public)//app
9+
for $app in doc($config:apps-meta)//app
1710
let $show-details := false()
1811
order by lower-case($app/title)
1912
return
@@ -23,7 +16,7 @@ declare function app:list-packages($node as node(), $model as map(*), $mode as x
2316
declare function app:view-package($node as node(), $model as map(*), $mode as xs:string?) {
2417
let $abbrev := request:get-parameter("abbrev", ())
2518
let $procVersion := request:get-parameter("eXist-db-min-version", "2.2.0")
26-
let $matching-abbrev := collection($config:public)//abbrev[. eq $abbrev]
19+
let $matching-abbrev := doc($config:apps-meta)//abbrev[. eq $abbrev]
2720
let $apps := $matching-abbrev/parent::app
2821
return
2922
(

modules/config.xqm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ declare variable $config:app-root :=
2727

2828
declare variable $config:public := concat($config:app-root, "/public");
2929

30+
declare variable $config:metadata-collection := concat($config:app-root, "/meta");
31+
declare variable $config:apps-doc := 'apps.xml';
32+
declare variable $config:packages-doc := 'packages.xml';
33+
declare variable $config:packages-meta := concat($config:metadata-collection, '/', $config:packages-doc);
34+
declare variable $config:apps-meta := concat($config:metadata-collection, '/', $config:apps-doc);
35+
3036
(:~
3137
: Returns the repo.xml descriptor for the current application.
3238
:)

modules/feed.xql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ declare option exist:serialize "method=xml media-type=application/atom+xml";
66

77
declare function local:feed-entries() {
88
let $repoURL := concat(substring-before(request:get-url(), "public-repo/"), "public-repo/")
9-
for $app in collection($config:public)//app
9+
for $app in doc($config:apps-meta)//app
1010
let $icon :=
1111
if ($app/icon) then
1212
if ($app/@status) then

modules/find.xql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ let $procVersion := request:get-parameter("processor", "2.2.0")
1818
let $app-root-absolute-url := request:get-parameter("app-root-absolute-url", ())
1919
let $app :=
2020
if ($name) then
21-
collection($config:app-root || "/public")//app[name eq $name]
21+
doc($config:apps-meta)//app[name eq $name]
2222
else
23-
collection($config:app-root || "/public")//app[abbrev eq $abbrev]
23+
doc($config:apps-meta)//app[abbrev eq $abbrev]
2424
let $app-versions := ($app, $app/other/version)
2525
let $compatible-xar := app:find-version($app-versions, $procVersion, $version, $semVer, $minVersion, $maxVersion)
2626
return
2727
if ($compatible-xar) then
2828
let $abs-public := $app-root-absolute-url || "/public/"
2929
return
3030
if ($info) then
31-
let $app := collection($config:app-root || "/public")//(app|version)[@path eq $compatible-xar]
31+
let $app := doc($config:apps-meta)//(app|version)[@path eq $compatible-xar]
3232
return
3333
<found>{$app/@sha256,($app/version,$app/@version)[1] ! attribute version {.},$compatible-xar}</found>
3434
else if ($zip) then

modules/list.xql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ declare function list:find-version($versions as element()*, $version as xs:strin
7474

7575
let $version := request:get-parameter("version", $list:DEFAULT_VERSION)
7676
let $version := if (matches($version, "^\d+\.\d+\.\d+-?.*$")) then $version else $list:DEFAULT_VERSION
77-
let $apps := doc($config:public || "/apps.xml")/apps
77+
7878
return
7979
<apps version="{$version}">
8080
{
81-
for $app in $apps/app
81+
for $app in doc($config:apps-meta)//app
8282
return
8383
list:get-app($app, $version)
8484
}

0 commit comments

Comments
 (0)