Skip to content

Commit a4b8f40

Browse files
committed
bugfix release v.1.0.2
1 parent 94e8c65 commit a4b8f40

File tree

7 files changed

+18
-37
lines changed

7 files changed

+18
-37
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Synchronizes your data collection with GitHub and GitLab.
2222

2323
## Current restrictions
2424

25-
In version 1.0.1 not implemented:
25+
In version 1.0.2 not implemented:
2626
- webhooks are not fully implemented.
2727

2828
## Building and Installation

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tuttle",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "tuttle - a Git-integration for eXist-db",
55
"scripts": {
66
"test": "gulp install && mocha --exit",

src/api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"openapi": "3.0.0",
33
"info": {
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"title": "Tuttle API",
66
"description": "API for Tuttle Git integration"
77
},

src/expath-pkg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package
33
xmlns="http://expath.org/ns/pkg"
44
name="http://e-editiones.org/tuttle"
5-
abbrev="tuttle" version="1.0.1" spec="1.0">
5+
abbrev="tuttle" version="1.0.2" spec="1.0">
66
<title>Tuttle - Git for eXist-db</title>
77
<dependency processor="http://exist-db.org" semver-min="5.0.0"/>
88
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/>

src/modules/api.xql

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,16 @@ declare function api:git-deploy($request as map(*)) {
196196
return
197197
if (exists($config)) then (
198198
try {
199-
if (xmldb:collection-available($collection-staging)) then (
200-
if (xmldb:collection-available($collection-staging-uri)) then (
201-
if (not(exists(doc($lockfile)))) then (
199+
if (not(xmldb:collection-available($collection-destination))) then (
200+
map { "message" : "Destination collection '" || $collection-destination || "' does not exist" }
201+
)
202+
else if (not(xmldb:collection-available($collection-staging-uri))) then (
203+
map { "message" : "Staging collection '" || $collection-staging || "' does not exist" }
204+
)
205+
else if (exists(doc($lockfile))) then (
206+
map { "message" : doc($lockfile)/task/value/text() || " in progress" }
207+
)
208+
else (
202209
let $write-lock := app:lock-write($collection-destination, "deploy")
203210
let $pre-install := if ($request?parameters?pre-install) then
204211
config:pre-install($collection-destination,$collection-staging-uri)
@@ -214,20 +221,6 @@ declare function api:git-deploy($request as map(*)) {
214221
map {
215222
"sha" : app:production-sha($git-collection),
216223
"message" : "success"
217-
})
218-
else
219-
let $message := doc($lockfile)/task/value/text() || " in progress"
220-
return
221-
map { "message" : $message}
222-
)
223-
else (
224-
map { "message" : "staging collction not exist"
225-
}
226-
)
227-
)
228-
else (
229-
map {
230-
"message" : "Destination collection not exist"
231224
}
232225
)
233226
}

src/modules/github.xql

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ declare function github:clone($config as map(*), $collection as xs:string, $sha
2424
"message" : concat($config?vcs, " error: ", github:request($url, $config?token)[1]/xs:string(@message))
2525
} )
2626
else (
27-
if (github:available-sha($config, $sha)) then (
2827
let $request := github:request($url, $config?token)
2928
let $filter := app:unzip-filter#3
3029
let $unzip-action := app:unzip-store#4
@@ -35,18 +34,13 @@ declare function github:clone($config as map(*), $collection as xs:string, $sha
3534
xmldb:remove($collection)
3635
else ()
3736
let $create-collection := xmldb:create-collection("/", $collection)
38-
let $wirte-sha := app:write-sha($collection,$sha)
37+
let $write-sha := app:write-sha($collection, github:get-lastcommit-sha($config)?sha)
38+
3939
let $clone := compression:unzip ($request[2], $filter, $filter-params, $unzip-action, $data-params)
4040
return map {
4141
"message" : "Success"
4242
}
4343
)
44-
else (
45-
map {
46-
"message" : "REF not exist"
47-
}
48-
)
49-
)
5044
}
5145
catch * {
5246
map {
@@ -102,7 +96,7 @@ declare function github:get-commits($config as map(*), $count as xs:int) {
10296
: Get all commits in full sha lenght
10397
:)
10498
declare function github:get-commits-fullsha($config as map(*)) {
105-
let $url := $config?baseurl || "/repos/" || $config?owner || "/" || $config?repo || "/commits?sha=" || $config?refss
99+
let $url := $config?baseurl || "/repos/" || $config?owner || "/" || $config?repo || "/commits?sha=" || $config?ref
106100
let $request :=
107101
parse-json(util:base64-decode(github:request($url, $config?token)[2]))
108102

src/modules/gitlab.xql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ declare function gitlab:clone($config as map(*), $collection as xs:string, $sha
2222
"message" : concat($config?vcs, " error: ", gitlab:request($url, $config?token)[1]/xs:string(@message))
2323
} )
2424
else (
25-
if (gitlab:available-sha($config, $sha)) then (
2625
let $request := gitlab:request($url, $config?token)
2726
let $filter := app:unzip-filter#3
2827
let $unzip-action := app:unzip-store#4
@@ -33,16 +32,11 @@ declare function gitlab:clone($config as map(*), $collection as xs:string, $sha
3332
xmldb:remove($collection)
3433
else ()
3534
let $create-collection := xmldb:create-collection("/", $collection)
36-
let $wirte-sha := app:write-sha($collection,$sha)
35+
let $write-sha := app:write-sha($collection, gitlab:get-lastcommit-sha($config)?sha)
3736
let $clone := compression:unzip ($request[2], $filter, $filter-params, $unzip-action, $data-params)
3837
return map {
3938
"message" : "Success"
4039
}
41-
)
42-
else (
43-
map {
44-
"message" : "REF not exist"
45-
}
4640
)
4741
)
4842
}

0 commit comments

Comments
 (0)