Skip to content

Commit

Permalink
refactor: rename blacklist to ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
line-o committed Oct 4, 2023
1 parent 86d0301 commit 1229819
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/data/tuttle-example-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
</repos>

<!-- these files will not be extracted from archives and left untouched when cleaning up -->
<blacklist>
<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>
</blacklist>
</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">
Expand Down
12 changes: 6 additions & 6 deletions src/modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ declare function app:unzip-store($path as xs:string, $data-type as xs:string, $d
};

(:~
: Filter function to blacklist resources
: Filter out ignored resources
:)
declare function app:unzip-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean {
not(contains($path, config:blacklist()))
not(contains($path, config:ignore()))
};

(:~
Expand Down Expand Up @@ -84,12 +84,12 @@ declare function app:move-resources($collection-source as xs:string, $collection
: Cleanup destination collection - delete collections from target collection
:)
declare function app:cleanup-collection($collection as xs:string, $prefix as xs:string) {
let $blacklist := [config:blacklist(), config:lock()]
let $ignore := [config:ignore(), config:lock()]
let $fullpath-collection := $prefix || "/" || $collection

return
for $child in xmldb:get-child-collections($fullpath-collection)
where not(contains($child, $blacklist))
where not(contains($child, $ignore))
let $fullpath-child := $fullpath-collection || "/" || $child
return
xmldb:remove($fullpath-child)
Expand All @@ -99,12 +99,12 @@ declare function app:cleanup-collection($collection as xs:string, $prefix as xs:
: Cleanup destination collection - delete resources from target collection
:)
declare function app:cleanup-resources($collection as xs:string, $prefix as xs:string) {
let $blacklist := config:blacklist()
let $ignore := config:ignore()
let $fullpath-collection := $prefix || "/" || $collection

return
for $child in xmldb:get-child-resources($fullpath-collection)
where not(contains($child, $blacklist))
where not(contains($child, $ignore))
return
xmldb:remove($fullpath-collection, $child)
};
Expand Down
6 changes: 3 additions & 3 deletions src/modules/config.xql
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ declare function config:default-collection() as xs:string? {
};

(:~
: Blacklist - these files are not checkout from git and are ignored
: ignore - these files are not checkout from git and are ignored
:)
declare function config:blacklist() as xs:string* {
$config:tuttle-config/blacklist/file/string()
declare function config:ignore() as xs:string* {
$config:tuttle-config/ignore/file/string()
};

(:~
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/alt-tuttle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
</collection>
</repos>

<blacklist>
<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>
</blacklist>
</ignore>

<config prefix="/db/apps/" suffix="-stage" lock="git-lock.xml" apikeys="/db/system/auth/tuttle-token.xml">
<sm user="nobody" group="nogroup" mode="rw-r--r--"/>
Expand Down

0 comments on commit 1229819

Please sign in to comment.