-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from eeditiones/fix/12
next round of refactoring
- Loading branch information
Showing
28 changed files
with
679 additions
and
1,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: TODO: $target is not set in cleanup phase :) | ||
declare variable $configuration-collection := "/db/apps/tuttle/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: backup tuttle configuration :) | ||
if (not(xmldb:collection-available($backup-collection))) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Creating configuration backup collection"), | ||
xmldb:create-collection("/db", "tuttle-backup"), | ||
sm:chmod(xs:anyURI($backup-collection), "rwxr-x---") | ||
) | ||
else () | ||
, | ||
util:log("info", "Backing up configuration"), | ||
xmldb:move($configuration-collection, $backup-collection, $configuration-filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<tuttle> | ||
<repos> | ||
<collection name="tuttle-sample-data"> | ||
<!-- optional: make _one_ repository the default | ||
for endpoints without {collection} | ||
--> | ||
<default>true</default> | ||
|
||
<!-- which sercive to connect to --> | ||
<type>github</type> | ||
<baseurl>https://api.github.com/</baseurl> | ||
|
||
<!-- necessary to provide for GitHub --> | ||
<owner>eeditiones</owner> | ||
<repo>tuttle-sample-data</repo> | ||
|
||
<!-- branch to pull from --> | ||
<ref>next</ref> | ||
|
||
<!-- authenticate against remote service, | ||
can also be read from environment variables --> | ||
<token>XXX</token> | ||
|
||
<!-- only necessary if you need the service to call tuttle --> | ||
<hookuser>admin</hookuser> | ||
<hookpasswd></hookpasswd> | ||
</collection> | ||
|
||
<collection name="tuttle-sample-gitlab"> | ||
<!-- which sercive to connect to --> | ||
<type>gitlab</type> | ||
<baseurl>https://gitlab.com/api/v4/</baseurl> | ||
|
||
<!-- this is not needed for Gitlab but can be added for human consumption --> | ||
<owner>line-o</owner> | ||
<repo>tuttle-sample-data</repo> | ||
|
||
<!-- necessary to provide for Gitlab --> | ||
<project-id>50872175</project-id> | ||
|
||
<!-- branch to pull from --> | ||
<ref>main</ref> | ||
|
||
<!-- authenticate against remote service, | ||
can also be read from environment variables --> | ||
<token>XXX</token> | ||
|
||
<!-- only necessary if you need the service to call tuttle --> | ||
<hookuser>admin</hookuser> | ||
<hookpasswd></hookpasswd> | ||
</collection> | ||
</repos> | ||
|
||
<!-- these files will not be extracted from archives and left untouched when cleaning up --> | ||
<ignore> | ||
<file>existdb.json</file> | ||
<file>build.xml</file> | ||
<file>README.md</file> | ||
<file>.gitignore</file> | ||
<file>expath-pkg.xml.tmpl</file> | ||
<file>repo.xml.tmpl</file> | ||
<file>build.properties.xml</file> | ||
</ignore> | ||
|
||
<!-- prefix, suffix, lock and apikeys can usually be left as-is --> | ||
<config prefix="/db/apps/" suffix="-stage" lock="git-lock.xml" apikeys="/db/system/auth/tuttle-token.xml"> | ||
<!-- | ||
The permissions the deployed data gets assigned, if no expath-pkg.xml is found. | ||
The initial setting is safe, but this can and should be adapted to your requirements. | ||
--> | ||
<sm user="admin" group="dba" mode="rw-r-----"/> | ||
</config> | ||
</tuttle> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package | ||
xmlns="http://expath.org/ns/pkg" | ||
name="http://e-editiones.org/tuttle" | ||
abbrev="tuttle" version="1.2.0" spec="1.0"> | ||
<title>Tuttle - Git for eXist-db</title> | ||
<dependency processor="http://exist-db.org" semver-min="5.5.1"/> | ||
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/> | ||
<dependency package="http://exist-db.org/apps/shared" semver-min="0.9.1"/> | ||
<dependency package="http://expath.org/ns/crypto" semver-min="5.0.0"/> | ||
<package xmlns="http://expath.org/ns/pkg" spec="1.0" | ||
name="http://e-editiones.org/tuttle" abbrev="tuttle" version="2.0.0"> | ||
<title>Tuttle - Git for eXist-db</title> | ||
<dependency processor="http://exist-db.org" semver-min="5.5.1" semver-max="6" /> | ||
<dependency package="http://e-editiones.org/roaster" semver-min="1.0.0"/> | ||
<dependency package="http://expath.org/ns/crypto" semver-min="5.0.0"/> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: the target collection into which the app is deployed :) | ||
declare variable $target external; | ||
|
||
declare variable $configuration-collection := $target || "/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: look for backed up tuttle configuration :) | ||
if (doc-available($backup-collection || $configuration-filename)) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Restoring tuttle configuration from backup."), | ||
xmldb:move($backup-collection, $configuration-collection, $configuration-filename), | ||
xmldb:remove($backup-collection) | ||
) | ||
else ((: copy example configuration when no backup was found :) | ||
util:log("info", "No previous tuttle configuration found."), | ||
xmldb:copy-resource( | ||
$configuration-collection, "tuttle-example-config.xml", | ||
$configuration-collection, $configuration-filename | ||
) | ||
) | ||
, | ||
(: tighten security for configuration file :) | ||
sm:chmod(xs:anyURI($configuration-collection || $configuration-filename), "rw-r-----") | ||
, | ||
(: set gid for API :) | ||
sm:chmod(xs:anyURI($target || "/modules/api.xql"), "rwxr-sr-x") | ||
|
Oops, something went wrong.