Skip to content

Commit

Permalink
bugfix release v.1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
windauer committed Jan 18, 2022
1 parent 94e8c65 commit a4b8f40
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Synchronizes your data collection with GitHub and GitLab.

## Current restrictions

In version 1.0.1 not implemented:
In version 1.0.2 not implemented:
- webhooks are not fully implemented.

## Building and Installation
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tuttle",
"version": "1.0.1",
"version": "1.0.2",
"description": "tuttle - a Git-integration for eXist-db",
"scripts": {
"test": "gulp install && mocha --exit",
Expand Down
2 changes: 1 addition & 1 deletion src/api.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"openapi": "3.0.0",
"info": {
"version": "1.0.1",
"version": "1.0.2",
"title": "Tuttle API",
"description": "API for Tuttle Git integration"
},
Expand Down
2 changes: 1 addition & 1 deletion src/expath-pkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package
xmlns="http://expath.org/ns/pkg"
name="http://e-editiones.org/tuttle"
abbrev="tuttle" version="1.0.1" spec="1.0">
abbrev="tuttle" version="1.0.2" spec="1.0">
<title>Tuttle - Git for eXist-db</title>
<dependency processor="http://exist-db.org" semver-min="5.0.0"/>
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/>
Expand Down
27 changes: 10 additions & 17 deletions src/modules/api.xql
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,16 @@ declare function api:git-deploy($request as map(*)) {
return
if (exists($config)) then (
try {
if (xmldb:collection-available($collection-staging)) then (
if (xmldb:collection-available($collection-staging-uri)) then (
if (not(exists(doc($lockfile)))) then (
if (not(xmldb:collection-available($collection-destination))) then (
map { "message" : "Destination collection '" || $collection-destination || "' does not exist" }
)
else if (not(xmldb:collection-available($collection-staging-uri))) then (
map { "message" : "Staging collection '" || $collection-staging || "' does not exist" }
)
else if (exists(doc($lockfile))) then (
map { "message" : doc($lockfile)/task/value/text() || " in progress" }
)
else (
let $write-lock := app:lock-write($collection-destination, "deploy")
let $pre-install := if ($request?parameters?pre-install) then
config:pre-install($collection-destination,$collection-staging-uri)
Expand All @@ -214,20 +221,6 @@ declare function api:git-deploy($request as map(*)) {
map {
"sha" : app:production-sha($git-collection),
"message" : "success"
})
else
let $message := doc($lockfile)/task/value/text() || " in progress"
return
map { "message" : $message}
)
else (
map { "message" : "staging collction not exist"
}
)
)
else (
map {
"message" : "Destination collection not exist"
}
)
}
Expand Down
12 changes: 3 additions & 9 deletions src/modules/github.xql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ declare function github:clone($config as map(*), $collection as xs:string, $sha
"message" : concat($config?vcs, " error: ", github:request($url, $config?token)[1]/xs:string(@message))
} )
else (
if (github:available-sha($config, $sha)) then (
let $request := github:request($url, $config?token)
let $filter := app:unzip-filter#3
let $unzip-action := app:unzip-store#4
Expand All @@ -35,18 +34,13 @@ declare function github:clone($config as map(*), $collection as xs:string, $sha
xmldb:remove($collection)
else ()
let $create-collection := xmldb:create-collection("/", $collection)
let $wirte-sha := app:write-sha($collection,$sha)
let $write-sha := app:write-sha($collection, github:get-lastcommit-sha($config)?sha)

let $clone := compression:unzip ($request[2], $filter, $filter-params, $unzip-action, $data-params)
return map {
"message" : "Success"
}
)
else (
map {
"message" : "REF not exist"
}
)
)
}
catch * {
map {
Expand Down Expand Up @@ -102,7 +96,7 @@ declare function github:get-commits($config as map(*), $count as xs:int) {
: Get all commits in full sha lenght
:)
declare function github:get-commits-fullsha($config as map(*)) {
let $url := $config?baseurl || "/repos/" || $config?owner || "/" || $config?repo || "/commits?sha=" || $config?refss
let $url := $config?baseurl || "/repos/" || $config?owner || "/" || $config?repo || "/commits?sha=" || $config?ref
let $request :=
parse-json(util:base64-decode(github:request($url, $config?token)[2]))

Expand Down
8 changes: 1 addition & 7 deletions src/modules/gitlab.xql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ declare function gitlab:clone($config as map(*), $collection as xs:string, $sha
"message" : concat($config?vcs, " error: ", gitlab:request($url, $config?token)[1]/xs:string(@message))
} )
else (
if (gitlab:available-sha($config, $sha)) then (
let $request := gitlab:request($url, $config?token)
let $filter := app:unzip-filter#3
let $unzip-action := app:unzip-store#4
Expand All @@ -33,16 +32,11 @@ declare function gitlab:clone($config as map(*), $collection as xs:string, $sha
xmldb:remove($collection)
else ()
let $create-collection := xmldb:create-collection("/", $collection)
let $wirte-sha := app:write-sha($collection,$sha)
let $write-sha := app:write-sha($collection, gitlab:get-lastcommit-sha($config)?sha)
let $clone := compression:unzip ($request[2], $filter, $filter-params, $unzip-action, $data-params)
return map {
"message" : "Success"
}
)
else (
map {
"message" : "REF not exist"
}
)
)
}
Expand Down

0 comments on commit a4b8f40

Please sign in to comment.