Compare commits

6 Commits
Author SHA1 Message Date
reachableceo 61ce9dc843 more local pipeline cleanup 2026-09-08 07:47:17 -05:00
reachableceo 72c41405e4 shell render retired
grav with twig templating replaces all shell rendering
2026-09-08 07:45:44 -05:00
vptechops 890c99ab26 v0.1: fix Soverign->Sovereign typo in KNEL DC services catalog
Last outstanding typo from the review findings. Fixed at the CSV
source of truth and regenerated through RenderCSVToMarkdown.sh plus
the Grav services-page assembly; generated files show no other churn.

Ticket: https://projects.knownelement.com/issues/924
2026-09-08 05:28:43 -05:00
mrcharles 9612011422 chore: untrack session gate file, ignore .crush/
Ticket: https://projects.knownelement.com/issues/924
2026-09-07 18:25:54 -05:00
mrcharles 16528ff813 v0.1: replace shell-rendered site with Grav-native pages + theme
- Drop site/ + RenderSite.sh: repo now carries grav/user/pages as
  native Grav markdown pages (home/services/terms/sign/execution)
- Add knel-contract theme: inherits quark2 via stream fallback, adds
  sign.html.twig (Twig) driving the DocuSeal flow through the APISIX
  gateway; esign wiring lives in the theme yaml for forks to retarget
- CreateDocument.sh refreshes the Grav services page from the
  rendered catalogs instead of invoking the removed site renderer

Ticket: https://projects.knownelement.com/issues/924
2026-09-07 14:41:50 -05:00
mrcharles 4bc56c83d3 v0.1: contract legal overhaul + Grav site + e-sign integration
- Real dispute-resolution/governing-law/venue section replaces the
  unenforceable 'auto resolved in our favor' clause; jury waiver
  rewritten with carve-outs
- New sections: definitions, liability cap, confidentiality, IP,
  force majeure, assignment, notices, termination/renewal, e-sign
- SLA/SLO semantics fixed (SLA=contractual min, SLO=non-binding
  target); payment currency/invoicing terms added
- Introduction now mustache-templated ({{PARTY2}} bug fixed)
- SUMMARY.md structure fixed (case mismatch, empty heading, dupes)
- RenderBook.sh build-only; new RenderSite.sh renders Grav pages
  (site/) incl. DocuSeal e-sign page via APISIX

Ticket: https://projects.knownelement.com/issues/924
2026-09-07 14:15:04 -05:00
126 changed files with 761 additions and 5515 deletions
+1
View File
@@ -1 +1,2 @@
book
.crush/
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
# Put together the KNEL services contract template
set -euo pipefail
# Pull in contract variables
echo "Sourcing contract template variables..."
source ./KNEL-Contract-Template-Variables.env
echo "Rendering templates..."
bash RenderTemplates.sh
echo "Rendering CSV..."
bash RenderCSVToMarkdown.sh
echo "Putting it all together..."
bash RenderBook.sh
-14
View File
@@ -1,14 +0,0 @@
export PARTY1="Known Element Enterprises LLC"
export PARTY2="TSYS Group Component"
export CONTRACT_LENGTH="99 years"
export PAYMENT_AMOUNT="100.00"
export PAYMENT_FREQUENCY="Monthly"
export SERVICES_SLA="95%"
export SERVICES_SLO="99%"
export SLA_PENALTY="none"
export SLO_PENALTY="none"
-3
View File
@@ -1,3 +0,0 @@
#/bin/bash
mdbook build && mdbook serve
-148
View File
@@ -1,148 +0,0 @@
#!/bin/bash
# Render CSV to markdown table
COOLIFY_TO_ALL="src/services-coolify-techops-all.md"
rm $COOLIFY_TO_ALL || true
echo "# Services hosted in KNEL Coolify Techops Instance, offered to all TSYS Group components" >> $COOLIFY_TO_ALL
#Table heading
echo " " >> $COOLIFY_TO_ALL
echo "|Function|Vendor|Instance|" >> $COOLIFY_TO_ALL
echo "|---|---|---|" >> $COOLIFY_TO_ALL
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-coolify-techops-all.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $COOLIFY_TO_ALL
done
COOLIFY_TO_LOB="src/services-coolify-techops-lob.md"
rm $COOLIFY_TO_LOB || true
echo "# Services hosted in KNEL Coolify Techops Instance, offered to certain TSYS Group components under bespoke arrangement" >> $COOLIFY_TO_LOB
#Table heading
echo " " >> $COOLIFY_TO_LOB
echo "|Function|Vendor|Instance|" >> $COOLIFY_TO_LOB
echo "|---|---|---|" >> $COOLIFY_TO_LOB
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-coolify-techops-lob.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $COOLIFY_TO_LOB
done
COOLIFY_RD_ALL="src/services-coolify-randd-all.md"
rm $COOLIFY_RD_ALL || true
echo "# Services hosted in KNEL Coolify R&D Instance, offered to all TSYS Group components" >> $COOLIFY_RD_ALL
#Table heading
echo " " >> $COOLIFY_RD_ALL
echo "|Function|Vendor|Instance|" >> $COOLIFY_RD_ALL
echo "|---|---|---|" >> $COOLIFY_RD_ALL
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-coolify-randd-all.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $COOLIFY_RD_ALL
done
COOLIFY_RD_LOB="src/services-coolify-randd-lob.md"
rm $COOLIFY_RD_LOB || true
echo "# Services hosted in KNEL Coolify R&D Instance, offered to certain TSYS Group components under bespoke arrangement" >> $COOLIFY_RD_LOB
#Table heading
echo " " >> $COOLIFY_RD_LOB
echo "|Function|Vendor|Instance|" >> $COOLIFY_RD_LOB
echo "|---|---|---|" >> $COOLIFY_RD_LOB
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-coolify-randd-lob.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $COOLIFY_RD_LOB
done
KNELDC_ALL="src/services-kneldc-all.md"
rm $KNELDC_ALL || true
echo "# Services hosted in KNEL Datacenter, offered to all TSYS Group components" >> $KNELDC_ALL
#Table heading
echo " " >> $KNELDC_ALL
echo "|Function|Vendor|Instance|" >> $KNELDC_ALL
echo "|---|---|---|" >> $KNELDC_ALL
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-kneldc-all.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $KNELDC_ALL
done
KNELDC_LOB="src/services-kneldc-lob.md"
rm $KNELDC_LOB || true
echo "# Services hosted in KNEL Datacenter, offered to certain TSYS Group components under bespoke arrangement" >> $KNELDC_LOB
#Table heading
echo " " >> $KNELDC_LOB
echo "|Function|Vendor|Instance|" >> $KNELDC_LOB
echo "|---|---|---|" >> $KNELDC_LOB
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-kneldc-lob.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $KNELDC_LOB
done
CLOUDRON_ALL="src/services-cloudron-all.md"
rm $CLOUDRON_ALL || true
echo "# Services hosted in KNEL Cloudron, offered to all TSYS Group components" >> $CLOUDRON_ALL
#Table heading
echo " " >> $CLOUDRON_ALL
echo "|Function|Vendor|Instance|" >> $CLOUDRON_ALL
echo "|---|---|---|" >> $CLOUDRON_ALL
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-cloudron-all.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $CLOUDRON_ALL
done
CLOUDRON_LOB="src/services-cloudron-lob.md"
rm $CLOUDRON_LOB || true
echo "# Services hosted in KNEL Cloudron, offered to certain TSYS Group components under bespoke arrangement" >> $CLOUDRON_LOB
#Table heading
echo " " >> $CLOUDRON_LOB
echo "|Function|Vendor|Instance|" >> $CLOUDRON_LOB
echo "|---|---|---|" >> $CLOUDRON_LOB
#Table rows
IFS=$'\n\t'
for service in \
$(cat "service-csv/services-cloudron-lob.csv"); do
export FUNCTION="$(echo $service|awk -F ',' '{print $1}')"
export VENDOR="$(echo $service|awk -F ',' '{print $2}')"
export INSTANCE="$(echo $service|awk -F ',' '{print $3}')"
echo "|$FUNCTION|$VENDOR|$INSTANCE|" >> $CLOUDRON_LOB
done
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
set -euo pipefail
source ./KNEL-Contract-Template-Variables.env
MUSTACHE_PATH="vendor/git.knownelement.com/ExternalVendorCode/mo/mo"
for input_file in $(ls -1 contract-inputs/*.md);
do
OUTPUT_FILE_NAME="$(echo $input_file | awk -F '/' '{print $2}')"
bash $MUSTACHE_PATH $input_file > src/$OUTPUT_FILE_NAME
done
-6
View File
@@ -1,6 +0,0 @@
[book]
authors = ["Charles N Wyble"]
language = "en"
multilingual = false
src = "src"
title = "Known Element Enterprises LLC Services Contract"
+32
View File
@@ -0,0 +1,32 @@
## Introduction
- This contract is a public document showing the full terms and conditions of a proposed contract between:
- (Party 1) {{PARTY1}} (as the management company of Turnkey Network Systems LLC)
- (Party 2) {{PARTY2}}
for the provision of needed support services by {{PARTY1}} for {{PARTY2}} to conduct its front/middle/back office IT/business operations functions as a TSYS Group component.
- This contract is licensed under the AGPL v3.0 only, with a small amount of proprietary scoped components (listed below). This repository is meant to be forked to a private, proprietary / confidential repository for execution with the only permitted proprietary alterations being:
- {{PARTY2}} officer name/contact details
- Entity in scope
- Execution date
- Payment terms
- Length of contract term
- Renewal / extension options
- If any other modifications to this contract are needed (other than those listed above), they must be done in this repository and placed under AGPL v3.0 only.
- {{PARTY2}} may elect to have the forked repository be public/read only as they wish. {{PARTY1}} hereby agrees to that option automatically upon {{PARTY2}} election to do so.
- This contract is governed solely and entirely by the laws of the State of {{GOVERNING_STATE}}, without regard to its conflict-of-laws rules.
- {{PARTY2}} hereby certifies it has conducted extensive due diligence on {{PARTY1}} and its officers, including any public material and private material that may have been provided by the officers of {{PARTY1}}, and is entering into this agreement having fully read and understood it.
This contract documents the:
- Applications
- Systems
- Services
offered to all TSYS Group components.
+14
View File
@@ -0,0 +1,14 @@
## Definitions
For purposes of this contract:
- **"{{PARTY1}}"** ("**Party 1**", "**Provider**") means Known Element Enterprises LLC, the management company of Turnkey Network Systems LLC.
- **"{{PARTY2}}"** ("**Party 2**", "**Recipient**") means the TSYS Group component entity identified in the Parties section of this contract.
- **"TSYS Group"** means Turnkey Network Systems LLC and all component/series LLCs under it.
- **"Services"** means the applications, systems, and services listed in the sections titled "Services Offered by {{PARTY1}}", as amended from time to time by mutual written agreement.
- **"Group-wide Service"** means a Service offered to all TSYS Group components (the "All TSYS Group" catalogs).
- **"LOB Bespoke Service"** means a Service offered only to a specific line of business ("**LOB**") of Party 2 (the "LOB Bespoke" catalogs).
- **"SLA"** (Service Level Agreement) means the minimum availability commitment stated in the SLA/SLO section.
- **"SLO"** (Service Level Objective) means the internal availability target stated in the SLA/SLO section, which is aspirational and non-binding.
- **"Monthly Uptime"** means, for a given calendar month, the percentage of minutes in which the Service was reachable and responding, measured by {{PARTY1}}'s monitoring platform, excluding scheduled maintenance windows noticed at least 48 hours in advance.
- **"Confidential Information"** means non-public information disclosed by one party to the other that is marked confidential or that a reasonable person would understand to be confidential, including business, financial, and technical information.
@@ -0,0 +1,20 @@
## Dispute Resolution, Governing Law, and Waivers
### Governing law and venue
- This contract is governed solely and entirely by the laws of the State of {{GOVERNING_STATE}}, without regard to its conflict-of-laws rules.
- The exclusive venue for any action arising out of or relating to this contract is the state or federal courts located in {{VENUE_COUNTY}}, {{GOVERNING_STATE}}, and each party consents to personal jurisdiction and venue in those courts.
### Informal resolution first
- Before commencing any court or arbitration proceeding, the parties will attempt in good faith to resolve the dispute by direct negotiation between the officers identified in the Notices section, escalating to the chief executives of both parties if not resolved within 30 days of written notice of the dispute.
### Jury trial waiver
- TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, EACH PARTY KNOWINGLY, VOLUNTARILY, AND IRREVOCABLY WAIVES ITS RIGHT TO A TRIAL BY JURY IN ANY ACTION OR PROCEEDING ARISING OUT OF OR RELATING TO THIS CONTRACT.
- This waiver is mutual, is given in exchange for the other party's waiver, and does not waive either party's right to seek any remedy otherwise available at law or in equity, including injunctive and other equitable relief.
- Nothing in this contract limits either party's right to bring claims arising from the other party's fraud, willful misconduct, gross negligence, or violation of criminal law, or any claim that cannot be waived as a matter of law.
### Severability of waivers
- If any waiver or limitation in this section is held unenforceable, it will be enforced to the maximum extent permissible, and the remainder of this contract remains in full force and effect.
+53
View File
@@ -0,0 +1,53 @@
## General Terms and Conditions
### Term, renewal, and termination
- Initial term: {{CONTRACT_LENGTH}}, commencing on the Effective Date (the date of last signature below).
- Renewal: this contract automatically renews for successive {{RENEWAL_TERM}} terms unless either party gives at least 90 days' written notice of non-renewal.
- Termination for convenience: either party may terminate this contract on 180 days' written notice.
- Termination for cause: either party may terminate on 30 days' written notice if the other party materially breaches this contract and fails to cure within that period.
- Effect of termination: termination does not relieve Party 2 of the obligation to pay amounts already accrued, and Party 1 will provide reasonable transition assistance (including data export in open formats) for up to 60 days at then-standard rates.
### Payment
- The Services are offered for an all-inclusive delivered price of {{PAYMENT_AMOUNT}} {{PAYMENT_CURRENCY}} per TSYS Group component per {{PAYMENT_FREQUENCY}}.
- Invoices are issued {{INVOICE_CADENCE}} and are due within {{PAYMENT_DUE_DAYS}} days of receipt.
- Late amounts accrue interest at the lesser of 1.5% per month or the maximum rate permitted by law.
### SLA / SLO
- Group-wide and LOB Bespoke Services are provided with the following service levels, measured as Monthly Uptime:
- Service Level Agreement (SLA — contractual minimum): {{SERVICES_SLA}}
- Service Level Objective (SLO — internal target, aspirational and non-binding): {{SERVICES_SLO}}
- The SLO is a target only; only the SLA creates contractual obligations.
- Remedies for missing the SLA: {{SLA_PENALTY}}. For the avoidance of doubt, where the SLA penalty is "none", the SLA is enforced through the termination rights above and no service credits or damages are available for SLA misses.
### Liability
- To the maximum extent permitted by law, each party's aggregate liability arising out of or relating to this contract is capped at the total fees paid or payable under this contract in the 12 months preceding the event giving rise to the claim.
- Neither party is liable for indirect, incidental, special, consequential, or punitive damages, or for lost profits, even if advised of their possibility.
- Nothing in this contract limits liability for a party's fraud, willful misconduct, or gross negligence, or any liability that cannot be limited as a matter of law.
### Confidentiality
- Each party will protect the other's Confidential Information with at least the same care it uses for its own, use it only to perform this contract, and return or destroy it on written request. These obligations survive termination for 3 years.
### Intellectual property
- The contract text is licensed AGPL v3.0 only (see Introduction). Each party retains ownership of its pre-existing intellectual property. Deliverables and configurations created by Party 1 specifically for Party 2 under a LOB Bespoke Service are licensed to Party 2 for the term of this contract; Group-wide Services and the underlying platforms remain the property of Party 1.
### Force majeure
- Neither party is liable for delays or failures in performance caused by events beyond its reasonable control (natural disasters, war, civil unrest, labor disputes not involving that party, utility or internet backbone failures), provided the affected party gives prompt notice and resumes performance as soon as practicable.
### Assignment
- Neither party may assign this contract without the other's prior written consent, except to an affiliate or in connection with a merger or sale of substantially all assets, with notice to the other party.
### Notices
- Notices must be in writing and delivered by email with confirmation, or by certified mail, to the officers identified in the Parties section. Notice is effective on receipt.
### Electronic signature
- The parties agree that this contract may be executed by electronic signature (including via the KNEL DocuSeal e-signature platform), and that such electronic signatures have the same force and effect as original ink signatures.
+23
View File
@@ -0,0 +1,23 @@
## Execution
IN WITNESS WHEREOF, the parties have executed this contract as of the Effective Date.
### For {{PARTY1}}
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### For {{PARTY2}}
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### Electronic execution
This contract may be executed electronically via the KNEL e-signature platform:
[Sign this contract electronically](https://contract.knownelement.com/sign)
-4
View File
@@ -1,4 +0,0 @@
## Contract Length
- Contract Length : {{CONTRACT_LENGTH}}
-4
View File
@@ -1,4 +0,0 @@
## Payment Terms
- The services are offered for an all inclusive delivered price of {{PAYMENT_AMOUNT}} which must be paid {{PAYMENT_FREQUENCY}}
-11
View File
@@ -1,11 +0,0 @@
## SLA/SLO
- The services listed in the section titled "Services Offered by Known Element Enterprises LLC " are provided with the following SLA/SLO:
- Service Level Agreement (SLA): {{SERVICES_SLA}}
- Service Level Objective (SLO): {{SERVICES_SLO}}
- Penalities to {{PARTY1}} for not hitting the SLA/SLO
- Penalty for missing the SLA: {{SLA_PENALTY}}
- Penalty for missing the SLO: {{SLO_PENALTY}}
+49
View File
@@ -0,0 +1,49 @@
---
title: 'KEE Services Contract'
visible: true
menu: Home
---
## Introduction
- This contract is a public document showing the full terms and conditions of a proposed contract between:
- (Party 1) Known Element Enterprises LLC (as the management company of Turnkey Network Systems LLC)
- (Party 2) TSYS Group Component
for the provision of needed support services by Known Element Enterprises LLC for TSYS Group Component to conduct its front/middle/back office IT/business operations functions as a TSYS Group component.
- This contract is licensed under the AGPL v3.0 only, with a small amount of proprietary scoped components (listed below). This repository is meant to be forked to a private, proprietary / confidential repository for execution with the only permitted proprietary alterations being:
- TSYS Group Component officer name/contact details
- Entity in scope
- Execution date
- Payment terms
- Length of contract term
- Renewal / extension options
- If any other modifications to this contract are needed (other than those listed above), they must be done in this repository and placed under AGPL v3.0 only.
- TSYS Group Component may elect to have the forked repository be public/read only as they wish. Known Element Enterprises LLC hereby agrees to that option automatically upon TSYS Group Component election to do so.
- This contract is governed solely and entirely by the laws of the State of Texas, without regard to its conflict-of-laws rules.
- TSYS Group Component hereby certifies it has conducted extensive due diligence on Known Element Enterprises LLC and its officers, including any public material and private material that may have been provided by the officers of Known Element Enterprises LLC, and is entering into this agreement having fully read and understood it.
This contract documents the:
- Applications
- Systems
- Services
offered to all TSYS Group components.
## Parties To The Contract
### Party 1
Known Element Enterprises LLC
### Party 2
TSYS Group Component
Explore the [services offered](/services), the [terms and conditions](/terms), and [sign electronically](/sign).
+115
View File
@@ -0,0 +1,115 @@
---
title: 'Services'
visible: true
menu: Services
---
# General Services Offered
- backups (of KNEL microservices and wordpress/grav site and bizapp application code/data (stored in KNEL microservice systems)
# Services hosted in KNEL Cloudron, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|Business Intelligence|[Apache Superset](https://superset.apache.org/)|[KNEL BI](https://bi.knownelement.com)|
|Reference Library|[Audio BookShelf](https://www.audiobookshelf.org/)|Multiple|
|File sharing|[Cubby](https://getcubby.org/)|[KNEL File Sharing](https://share.knownelement.com/#files/home/)|
|Forums|[Discourse](https://www.discourse.org/)|[KNEL TSYS Group Community](https://community.turnsys.com)|
|Esignature|[Documenso](https://documenso.com/)|[KNEL Esign](https://esign.knownelement.com)|
|ERP|[Dolibarr](https://www.dolibarr.org/)|Multiple (one per TSYS Group component)|
|Finance|[Firefly III](https://www.firefly-iii.org/)|Multiple|
|Helpdesk|[Freescout](https://freescout.net/)|[KNEL Helpdesk](https://helpdesk.knownelement.com)|
|RSS Reader|[FreshRSS](https://freshrss.org/)|[KNEL RSS](https://rss.knownelement.com)|
|Source/package management|[Gitea](https://github.com/go-gitea/gitea)|[KNEL Gitea](https://git.knownelement.com)|
|Graphs/dashboards|[Grafana](https://grafana.com/)|[KNEL Grafana](https://grafana.knownelement.com/)|
|RDP/SSH Portal|[Apache Guacamole](https://guacamole.apache.org/)|[KNEL Desktop](https://jumpin.knownelement.com/#/)|
|Web document/presentation editing|[HedgeDoc](https://hedgedoc.org/)|[KNEL Webdoc](https://webdocs.knownelement.com/)|
|Note/KB/Second brain|[Joplin Client/Server](https://joplinapp.org/)|[KNEL Joplin](https://notes.knownelement.com)|
|Surveys|[Lime Survey](https://www.limesurvey.org/)|[KNEL Surveys](https://surveys.knownelement.com/)|
|Federated Social Media Profile|[Mastodon](https://joinmastodon.org/)|[KNEL Social](https://socialnet.turnsys.com/explore)|
|Web Analytics|[Matomo](https://matomo.org/)|[KNEL Webstats](https://webstats.knownelement.com/)|
|Marketing Campaigns|[Mautic](https://www.mautic.org/)|[KNEL Marketing](https://marketing.knownelement.com/s/login)|
|Object Storage|[Minio](https://min.io/)|[KNEL Minio](https://objects.knownelement.com/)|
|Video/whiteboard/screenshare meeting|[MiroTalk](https://github.com/miroslavpejic85/mirotalk)|[KNEL Conference](https://meet.knownelement.com/)|
|Learning Management System|[Moodle](https://moodle.org/)|[KNEL LMS](https://learn.knownelement.com/)|
|Push Notifications|[ntfy](https://ntfy.sh/)|[KNEL Push](https://notify.knownelement.com/)|
|Web Design/Mockup|[Penpot](https://penpot.app/)|[KNEL Mockup](https://design.knownelement.com/)|
|Time series/alert manager|[Promethus Alert Manager](https://prometheus.io/docs/alerting/latest/alertmanager/)|[KNEL PromAM](https://alertmanager.knownelement.com/login?redirect=/)|
|Meeting coordination|[Rally](https://github.com/lukevella/rallly)|[KNEL Meeting Scheduler](https://companymeetings.knownelement.com/)|
|Project/task management|[Redmine](https://www.redmine.org/)|[KNEL Project](https://projects.knownelement.com/)|
|Web Search|[SearXNG](https://docs.searxng.org/)|[KNEL Websearch](https://websearch.knownelement.com/)|
|IT Asset Management|[Snipe-IT](https://snipeitapp.com/)|[KNEL Asset Management](https://assets.knownelement.com/login)|
|Environment data management system|[Emoncms](https://emoncms.org/)|Being deployed to [KNEL Emoncms](https://emoncms.knownelement.com/)|
|Up/down monitoring/alerting|[Uptime Kuma](https://uptime.kuma.pet/)|[KNEL Up/down](https://status.knownelement.com/dashboard)|
|Automated Secrets Management|[Hashicorp Vault](https://www.vaultproject.io/)|[KNEL Vault](https://vault.knownelement.com)|
|Password and (non)(automated) Secrets Management|[VaultWarden](https://github.com/dani-garcia/vaultwarden)|[KNEL Passwords](https://pwvault.turnsys.com/#/login)|
|VPN|[Cloudron Wireguard VPN](https://www.cloudron.io/store/io.cloudron.openvpn.html)|[KNEL VPN](https://vpn.knownelement.com/)|
|Whiteboard|[WBO](https://github.com/lovasoa/whitebophir)|[KNEL Whiteboard](https://whiteboard.knownelement.com/login?redirect=/)|
|URL Sharing|[Yourls](https://yourls.org/)|[KNEL URL](https://url.knownelement.com/)|
|Website Archiving|[Wallabag](https://wallabag.org/)|[KNEL Archiver](https://readlater.knownelement.com/login)|
|CMS/App platform|[Cloudron Managed Wordpress](https://docs.cloudron.io/apps/wordpress-managed/)|Multiple|
|CMS/App platform|[Cloudron Managed Grav](https://docs.cloudron.io/apps/grav/)| Multiple|
|Photos|[Immich](https://immich.app/)|[KNEL Photos](https://photos.knownelement.com/auth/login)|
|Forms Manager|[EasyForms](https://easyforms.dev/)|[KNEL Forms](https://forms.knownelement.com/)|
|Advertising Network|[Revive](https://www.revive-adserver.com/)|[KNEL Ads](https://ads.knownelement.com/www/admin/index.php)|
|IP Address Management|[phpipam](https://phpipam.net/)|Being deployed to [KNEL IPAM](https://ipam.knownelement.com/)|
|Mailing List|[phplist](https://www.phplist.com/)|Being deployed to [KNEL Mailing List](https://lists.knownelement.com)|
|Web office|[Nextcloud](https://nextcloud.com/)|[KNEL Nextcloud](https://nextcloud.knownelement.com/)|
|Webmail/Inbound/outbound E-mai (with 1gb quota aggregate across all mailboxes) (for non customer/corporate/non-automated use only)|[Roundcube](https://roundcube.net/)|[KNEL Webmail](https://webmail.knownelement.com/)|
# Services hosted in KNEL Cloudron, offered to certain TSYS Group components under bespoke arrangement
|Function|Vendor|Instance|
|---|---|---|
|Podcast Management - LOB bespoke arrangement|[Castopod](https://castopod.org/)|[Peernet Castopod](https://podcasts.thepeernet.com/)|
|Booking Management - LOB bespoke arrangement|[EasyAppointments](https://easyappointments.org/)|Multiple|
|Matrix Chat - LOB bespoke arrangement |[Element](https://element.io/)|[ReachableCEO Enterprise Element](https://chat.reachableceo.com/)|
|Records Management System - LOB bespoke arrangement|[Paperless-NGX](https://docs.paperless-ngx.com/)|[KNEL Paperless](https://paperless.knownelement.com/accounts/login/?next=/)|
|Wiki - LOB bespoke arrangement|[Mediawiki](https://www.mediawiki.org/wiki/MediaWiki)|Multiple|
|Newsletter - LOB bespoke arrangement|[Ghost](https://ghost.org/)|[ReachableCEO Enterprises Newsletter](https://newsletter.reachableceo.com/)|
|CRM - LOB bespoke arrangement| [CiviCRM](https://civicrm.org/)|[FNF CRM](https://crm.thefnf.net/)|
# Services hosted in KNEL Coolify Techops Instance, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|LLC Governance|TBD|TBD|
# Services hosted in KNEL Coolify Techops Instance, offered to certain TSYS Group components under bespoke arrangement
|Function|Vendor|Instance|
|---|---|---|
|coming soon|coming soon|coming soon|
# Services hosted in KNEL Coolify R&D Instance, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|coming soon|coming soon|coming soon|
# Services hosted in KNEL Coolify R&D Instance, offered to certain TSYS Group components under bespoke arrangement
|Function|Vendor|Instance|
|---|---|---|
|LOB bizapp compute/storage|TBD|TBD|
# Services hosted in KNEL Datacenter, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|Sovereign Hosting|[Umbrel](https://umbrel.com/)|N/A(KNEL DC VPN no external access) |
|Bitcoin Node|details coming soon|N/A(KNEL DC VPN no external access)|
|Ethereum Node|details coming soon|N/A (KNEL DC VPN no external access)|
|Bitcoin Payment Processing|details coming soon|N/A (KNEL DC VPN no external access)|
|VOIP (inbound)|details coming soon|N/A (KNEL DC VPN no external access)|
|Certificate Authority|details coming soon|N/A (KNEL DC VPN no external access)|
# Services hosted in KNEL Datacenter, offered to certain TSYS Group components under bespoke arrangement
|Function|Vendor|Instance|
|---|---|---|
|SLURM/BOINC Managed Electronic design automation/RF lab/environmental lab/network interop lab/General Storage Compute Network Capacity| Dell/Nvidia/Netapp/other| N/A|
|Production Big data/ETL etc processing|details coming soon| N/A (KNEL DC VPN no external access)|
|R&D Big data/ETL etc processing|details coming soon| N/A (KNEL DC VPN no external access)|
|NFS/SMB Fileserver|details coming soon|N/A (KNEL DC VPN no external access)|
|Value4Value|[Helipad](https://tryhelipad.com/)|N/A(KNEL DC VPN no external access) |
+94
View File
@@ -0,0 +1,94 @@
---
title: 'Terms and Conditions'
visible: true
menu: Terms
---
## Definitions
For purposes of this contract:
- **"Known Element Enterprises LLC"** ("**Party 1**", "**Provider**") means Known Element Enterprises LLC, the management company of Turnkey Network Systems LLC.
- **"TSYS Group Component"** ("**Party 2**", "**Recipient**") means the TSYS Group component entity identified in the Parties section of this contract.
- **"TSYS Group"** means Turnkey Network Systems LLC and all component/series LLCs under it.
- **"Services"** means the applications, systems, and services listed in the sections titled "Services Offered by Known Element Enterprises LLC", as amended from time to time by mutual written agreement.
- **"Group-wide Service"** means a Service offered to all TSYS Group components (the "All TSYS Group" catalogs).
- **"LOB Bespoke Service"** means a Service offered only to a specific line of business ("**LOB**") of Party 2 (the "LOB Bespoke" catalogs).
- **"SLA"** (Service Level Agreement) means the minimum availability commitment stated in the SLA/SLO section.
- **"SLO"** (Service Level Objective) means the internal availability target stated in the SLA/SLO section, which is aspirational and non-binding.
- **"Monthly Uptime"** means, for a given calendar month, the percentage of minutes in which the Service was reachable and responding, measured by Known Element Enterprises LLC's monitoring platform, excluding scheduled maintenance windows noticed at least 48 hours in advance.
- **"Confidential Information"** means non-public information disclosed by one party to the other that is marked confidential or that a reasonable person would understand to be confidential, including business, financial, and technical information.
## Dispute Resolution, Governing Law, and Waivers
### Governing law and venue
- This contract is governed solely and entirely by the laws of the State of Texas, without regard to its conflict-of-laws rules.
- The exclusive venue for any action arising out of or relating to this contract is the state or federal courts located in Collin County, Texas, and each party consents to personal jurisdiction and venue in those courts.
### Informal resolution first
- Before commencing any court or arbitration proceeding, the parties will attempt in good faith to resolve the dispute by direct negotiation between the officers identified in the Notices section, escalating to the chief executives of both parties if not resolved within 30 days of written notice of the dispute.
### Jury trial waiver
- TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, EACH PARTY KNOWINGLY, VOLUNTARILY, AND IRREVOCABLY WAIVES ITS RIGHT TO A TRIAL BY JURY IN ANY ACTION OR PROCEEDING ARISING OUT OF OR RELATING TO THIS CONTRACT.
- This waiver is mutual, is given in exchange for the other party's waiver, and does not waive either party's right to seek any remedy otherwise available at law or in equity, including injunctive and other equitable relief.
- Nothing in this contract limits either party's right to bring claims arising from the other party's fraud, willful misconduct, gross negligence, or violation of criminal law, or any claim that cannot be waived as a matter of law.
### Severability of waivers
- If any waiver or limitation in this section is held unenforceable, it will be enforced to the maximum extent permissible, and the remainder of this contract remains in full force and effect.
## General Terms and Conditions
### Term, renewal, and termination
- Initial term: 99 years, commencing on the Effective Date (the date of last signature below).
- Renewal: this contract automatically renews for successive one-year terms unless either party gives at least 90 days' written notice of non-renewal.
- Termination for convenience: either party may terminate this contract on 180 days' written notice.
- Termination for cause: either party may terminate on 30 days' written notice if the other party materially breaches this contract and fails to cure within that period.
- Effect of termination: termination does not relieve Party 2 of the obligation to pay amounts already accrued, and Party 1 will provide reasonable transition assistance (including data export in open formats) for up to 60 days at then-standard rates.
### Payment
- The Services are offered for an all-inclusive delivered price of 100.00 USD per TSYS Group component per month.
- Invoices are issued monthly and are due within 30 days of receipt.
- Late amounts accrue interest at the lesser of 1.5% per month or the maximum rate permitted by law.
### SLA / SLO
- Group-wide and LOB Bespoke Services are provided with the following service levels, measured as Monthly Uptime:
- Service Level Agreement (SLA — contractual minimum): 95%
- Service Level Objective (SLO — internal target, aspirational and non-binding): 99%
- The SLO is a target only; only the SLA creates contractual obligations.
- Remedies for missing the SLA: none. For the avoidance of doubt, where the SLA penalty is "none", the SLA is enforced through the termination rights above and no service credits or damages are available for SLA misses.
### Liability
- To the maximum extent permitted by law, each party's aggregate liability arising out of or relating to this contract is capped at the total fees paid or payable under this contract in the 12 months preceding the event giving rise to the claim.
- Neither party is liable for indirect, incidental, special, consequential, or punitive damages, or for lost profits, even if advised of their possibility.
- Nothing in this contract limits liability for a party's fraud, willful misconduct, or gross negligence, or any liability that cannot be limited as a matter of law.
### Confidentiality
- Each party will protect the other's Confidential Information with at least the same care it uses for its own, use it only to perform this contract, and return or destroy it on written request. These obligations survive termination for 3 years.
### Intellectual property
- The contract text is licensed AGPL v3.0 only (see Introduction). Each party retains ownership of its pre-existing intellectual property. Deliverables and configurations created by Party 1 specifically for Party 2 under a LOB Bespoke Service are licensed to Party 2 for the term of this contract; Group-wide Services and the underlying platforms remain the property of Party 1.
### Force majeure
- Neither party is liable for delays or failures in performance caused by events beyond its reasonable control (natural disasters, war, civil unrest, labor disputes not involving that party, utility or internet backbone failures), provided the affected party gives prompt notice and resumes performance as soon as practicable.
### Assignment
- Neither party may assign this contract without the other's prior written consent, except to an affiliate or in connection with a merger or sale of substantially all assets, with notice to the other party.
### Notices
- Notices must be in writing and delivered by email with confirmation, or by certified mail, to the officers identified in the Parties section. Notice is effective on receipt.
### Electronic signature
- The parties agree that this contract may be executed by electronic signature (including via the KNEL DocuSeal e-signature platform), and that such electronic signatures have the same force and effect as original ink signatures.
+8
View File
@@ -0,0 +1,8 @@
---
title: 'Sign Electronically'
visible: true
menu: Sign
template: sign
---
This contract may be executed electronically via the KNEL DocuSeal e-signature platform, reached through the KNEL APISIX API gateway. Enter the signer's details below; DocuSeal will issue a signing session.
+28
View File
@@ -0,0 +1,28 @@
---
title: 'Execution'
visible: true
menu: Execution
---
## Execution
IN WITNESS WHEREOF, the parties have executed this contract as of the Effective Date.
### For Known Element Enterprises LLC
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### For TSYS Group Component
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### Electronic execution
This contract may be executed electronically via the KNEL e-signature platform:
[Sign this contract electronically](https://contract.knownelement.com/sign)
@@ -0,0 +1,6 @@
name: knel-contract
slug: knel-contract
type: theme
version: 0.1.0
description: KNEL services contract site theme
author: KNEL
@@ -0,0 +1,17 @@
enabled: true
# Any quark2 template not overridden here falls through to quark2
streams:
schemes:
theme:
type: ReadOnlyStream
prefixes:
'':
- user/themes/knel-contract
- user/themes/quark2
# E-sign wiring (forks: point these at your own gateway/template)
esign:
api_url: 'https://apigw.knownelement.com/contract-sign/api/submissions'
sign_url: 'https://esign.knownelement.com'
template_id: '2'
@@ -0,0 +1,69 @@
{% extends 'partials/base.html.twig' %}
{% block content %}
<div class="sign-page">
{{ page.content|raw }}
<style>
.sign-page form { max-width: 32rem; }
.sign-page label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }
.sign-page input { display: block; width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.sign-page button { margin-top: 1rem; padding: 0.6rem 1.4rem; cursor: pointer; }
</style>
<form id="esign-form">
<label for="esign-name">Full name</label>
<input type="text" id="esign-name" name="name" required>
<label for="esign-email">Email address</label>
<input type="email" id="esign-email" name="email" required>
<label for="esign-entity">Entity (Party 2)</label>
<input type="text" id="esign-entity" name="entity" required>
<button type="submit">Request signature link</button>
</form>
<p id="esign-status"></p>
</div>
<script>
(function () {
var form = document.getElementById('esign-form');
var status = document.getElementById('esign-status');
var config = {{ grav.config.themes['knel-contract'].esign|json_encode|raw }};
form.addEventListener('submit', function (ev) {
ev.preventDefault();
status.textContent = 'Requesting signing link…';
var name = document.getElementById('esign-name').value;
var email = document.getElementById('esign-email').value;
var entity = document.getElementById('esign-entity').value;
fetch(config.api_url, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: Number(config.template_id),
send_email: false,
submitters: [
{role: 'First Party', name: name, email: email},
{role: 'Second Party', name: name + ' (' + entity + ')', email: email}
]
})
}).then(function (r) {
if (!r.ok) { throw new Error('gateway returned ' + r.status); }
return r.json();
}).then(function (data) {
var slug = data.submitters && data.submitters[0] && data.submitters[0].slug;
if (slug) {
window.location.href = config.sign_url + '/s/' + slug;
} else {
status.textContent = 'Signing request created. Check ' + email + ' for the signing link.';
}
}).catch(function (e) {
status.textContent = 'Could not create the signing request (' + e.message + '). Contact the KNEL helpdesk.';
});
});
})();
</script>
{% endblock %}
+10
View File
@@ -0,0 +1,10 @@
slug: knel-contract
name: 'KNEL Contract'
type: theme
version: 0.1.0
description: 'KNEL services contract site. Inherits Quark2; adds the DocuSeal e-sign page template.'
icon: file-text
author:
name: Known Element Enterprises LLC
keywords: contract
license: AGPL-3.0
+1 -1
View File
@@ -1,4 +1,4 @@
Soverign Hosting,[Umbrel](https://umbrel.com/),N/A(KNEL DC VPN no external access)
Sovereign Hosting,[Umbrel](https://umbrel.com/),N/A(KNEL DC VPN no external access)
Bitcoin Node,details coming soon,N/A(KNEL DC VPN no external access)
Ethereum Node,details coming soon,N/A (KNEL DC VPN no external access)
Bitcoin Payment Processing,details coming soon,N/A (KNEL DC VPN no external access)
1 Soverign Hosting Sovereign Hosting [Umbrel](https://umbrel.com/) N/A(KNEL DC VPN no external access)
2 Bitcoin Node Bitcoin Node details coming soon N/A(KNEL DC VPN no external access)
3 Ethereum Node Ethereum Node details coming soon N/A (KNEL DC VPN no external access)
4 Bitcoin Payment Processing Bitcoin Payment Processing details coming soon N/A (KNEL DC VPN no external access)
-38
View File
@@ -1,38 +0,0 @@
## Introduction
- This contract is a public document showing the full terms and conditions of a proposed contract between:
- (party1) Known Element Enterprises LLC (as the management company of Turnkey Network Systems LLC)
- (party2) A TSYS Group component entity
for the provision of needed support services by Known Element Enterprises LLC for party2 to conduct it's front/middle/back office IT/business operations functions as a TSYS Group Component.
- This contract is licensed under the AGPL v3.0 only, with a small amount of proprietary scoped components (listed below). This repository is meant to be forked to a private, proprietary / confidential repository for execution with the only permitted proprietary alterations being:
- PARTY2 officer name/contact details
- Entity in scope
- Execution date
- Payment terms
- Length of contract term
- Renewal / extension options
- If any other modifications to this contract are needed (other than those listed above), they must be done in this repository and placed under AGPL v3.0 only.
- Party 2 may elect to have the forked repository be public/read only as they wish. Party 1 hereby agrees to that option automatically upon Party 2 election to do so.
- This contract is governed solely and entirely by Texas law.
- All disputes are hereby auto resolved in the favor of Known Element Enterprises LLC.
- All rights to trial by jury, arbitration, relief of any kind are hereby waved by {{PARTY2}} except in cases of clear civil or criminal acts by Known Element Enterprises LLC officers (gross negligence) etc as is standard exception in the law.
- {{PARTY2}} hereby certifies they have conducted extensive due diligence on Known Element Enterprises LLC and it's officers, including any public
material and private material that may have been provided by the officers of Known Element Enterprises LLC and are entering into this agreement having fully read and understood it.
This contract documents the:
- Applications
- Systems
- Services
offered to all TSYS Group components.
+7 -5
View File
@@ -1,8 +1,9 @@
# Introduction
- [Introduction](./introduction.md)
- [Definitions](./legal-definitions.md)
# Services Offered by Known Element Enterprises
# Services Offered by Known Element Enterprises LLC
- [Cloudron All TSYS Group](./services-cloudron-all.md)
- [Cloudron LOB Bespoke](./services-cloudron-lob.md)
@@ -16,9 +17,10 @@
# Standard legal terms and conditions
# Contract Parties/Terms/Signature
- [Dispute Resolution, Governing Law, and Waivers](./legal-dispute-resolution.md)
- [General Terms and Conditions](./legal-general-terms.md)
# Contract Parties/Execution
- [Contract Parties](./parties.md)
- [Contract Length](./terms-length.md)
- [Payment](./terms-payment.md)
- [SLA/SLO](./terms-slaslo.md)
- [Execution / Signatures](./signatures.md)
+32
View File
@@ -0,0 +1,32 @@
## Introduction
- This contract is a public document showing the full terms and conditions of a proposed contract between:
- (Party 1) Known Element Enterprises LLC (as the management company of Turnkey Network Systems LLC)
- (Party 2) TSYS Group Component
for the provision of needed support services by Known Element Enterprises LLC for TSYS Group Component to conduct its front/middle/back office IT/business operations functions as a TSYS Group component.
- This contract is licensed under the AGPL v3.0 only, with a small amount of proprietary scoped components (listed below). This repository is meant to be forked to a private, proprietary / confidential repository for execution with the only permitted proprietary alterations being:
- TSYS Group Component officer name/contact details
- Entity in scope
- Execution date
- Payment terms
- Length of contract term
- Renewal / extension options
- If any other modifications to this contract are needed (other than those listed above), they must be done in this repository and placed under AGPL v3.0 only.
- TSYS Group Component may elect to have the forked repository be public/read only as they wish. Known Element Enterprises LLC hereby agrees to that option automatically upon TSYS Group Component election to do so.
- This contract is governed solely and entirely by the laws of the State of Texas, without regard to its conflict-of-laws rules.
- TSYS Group Component hereby certifies it has conducted extensive due diligence on Known Element Enterprises LLC and its officers, including any public material and private material that may have been provided by the officers of Known Element Enterprises LLC, and is entering into this agreement having fully read and understood it.
This contract documents the:
- Applications
- Systems
- Services
offered to all TSYS Group components.
+14
View File
@@ -0,0 +1,14 @@
## Definitions
For purposes of this contract:
- **"Known Element Enterprises LLC"** ("**Party 1**", "**Provider**") means Known Element Enterprises LLC, the management company of Turnkey Network Systems LLC.
- **"TSYS Group Component"** ("**Party 2**", "**Recipient**") means the TSYS Group component entity identified in the Parties section of this contract.
- **"TSYS Group"** means Turnkey Network Systems LLC and all component/series LLCs under it.
- **"Services"** means the applications, systems, and services listed in the sections titled "Services Offered by Known Element Enterprises LLC", as amended from time to time by mutual written agreement.
- **"Group-wide Service"** means a Service offered to all TSYS Group components (the "All TSYS Group" catalogs).
- **"LOB Bespoke Service"** means a Service offered only to a specific line of business ("**LOB**") of Party 2 (the "LOB Bespoke" catalogs).
- **"SLA"** (Service Level Agreement) means the minimum availability commitment stated in the SLA/SLO section.
- **"SLO"** (Service Level Objective) means the internal availability target stated in the SLA/SLO section, which is aspirational and non-binding.
- **"Monthly Uptime"** means, for a given calendar month, the percentage of minutes in which the Service was reachable and responding, measured by Known Element Enterprises LLC's monitoring platform, excluding scheduled maintenance windows noticed at least 48 hours in advance.
- **"Confidential Information"** means non-public information disclosed by one party to the other that is marked confidential or that a reasonable person would understand to be confidential, including business, financial, and technical information.
+20
View File
@@ -0,0 +1,20 @@
## Dispute Resolution, Governing Law, and Waivers
### Governing law and venue
- This contract is governed solely and entirely by the laws of the State of Texas, without regard to its conflict-of-laws rules.
- The exclusive venue for any action arising out of or relating to this contract is the state or federal courts located in Collin County, Texas, and each party consents to personal jurisdiction and venue in those courts.
### Informal resolution first
- Before commencing any court or arbitration proceeding, the parties will attempt in good faith to resolve the dispute by direct negotiation between the officers identified in the Notices section, escalating to the chief executives of both parties if not resolved within 30 days of written notice of the dispute.
### Jury trial waiver
- TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, EACH PARTY KNOWINGLY, VOLUNTARILY, AND IRREVOCABLY WAIVES ITS RIGHT TO A TRIAL BY JURY IN ANY ACTION OR PROCEEDING ARISING OUT OF OR RELATING TO THIS CONTRACT.
- This waiver is mutual, is given in exchange for the other party's waiver, and does not waive either party's right to seek any remedy otherwise available at law or in equity, including injunctive and other equitable relief.
- Nothing in this contract limits either party's right to bring claims arising from the other party's fraud, willful misconduct, gross negligence, or violation of criminal law, or any claim that cannot be waived as a matter of law.
### Severability of waivers
- If any waiver or limitation in this section is held unenforceable, it will be enforced to the maximum extent permissible, and the remainder of this contract remains in full force and effect.
+53
View File
@@ -0,0 +1,53 @@
## General Terms and Conditions
### Term, renewal, and termination
- Initial term: 99 years, commencing on the Effective Date (the date of last signature below).
- Renewal: this contract automatically renews for successive one-year terms unless either party gives at least 90 days' written notice of non-renewal.
- Termination for convenience: either party may terminate this contract on 180 days' written notice.
- Termination for cause: either party may terminate on 30 days' written notice if the other party materially breaches this contract and fails to cure within that period.
- Effect of termination: termination does not relieve Party 2 of the obligation to pay amounts already accrued, and Party 1 will provide reasonable transition assistance (including data export in open formats) for up to 60 days at then-standard rates.
### Payment
- The Services are offered for an all-inclusive delivered price of 100.00 USD per TSYS Group component per month.
- Invoices are issued monthly and are due within 30 days of receipt.
- Late amounts accrue interest at the lesser of 1.5% per month or the maximum rate permitted by law.
### SLA / SLO
- Group-wide and LOB Bespoke Services are provided with the following service levels, measured as Monthly Uptime:
- Service Level Agreement (SLA — contractual minimum): 95%
- Service Level Objective (SLO — internal target, aspirational and non-binding): 99%
- The SLO is a target only; only the SLA creates contractual obligations.
- Remedies for missing the SLA: none. For the avoidance of doubt, where the SLA penalty is "none", the SLA is enforced through the termination rights above and no service credits or damages are available for SLA misses.
### Liability
- To the maximum extent permitted by law, each party's aggregate liability arising out of or relating to this contract is capped at the total fees paid or payable under this contract in the 12 months preceding the event giving rise to the claim.
- Neither party is liable for indirect, incidental, special, consequential, or punitive damages, or for lost profits, even if advised of their possibility.
- Nothing in this contract limits liability for a party's fraud, willful misconduct, or gross negligence, or any liability that cannot be limited as a matter of law.
### Confidentiality
- Each party will protect the other's Confidential Information with at least the same care it uses for its own, use it only to perform this contract, and return or destroy it on written request. These obligations survive termination for 3 years.
### Intellectual property
- The contract text is licensed AGPL v3.0 only (see Introduction). Each party retains ownership of its pre-existing intellectual property. Deliverables and configurations created by Party 1 specifically for Party 2 under a LOB Bespoke Service are licensed to Party 2 for the term of this contract; Group-wide Services and the underlying platforms remain the property of Party 1.
### Force majeure
- Neither party is liable for delays or failures in performance caused by events beyond its reasonable control (natural disasters, war, civil unrest, labor disputes not involving that party, utility or internet backbone failures), provided the affected party gives prompt notice and resumes performance as soon as practicable.
### Assignment
- Neither party may assign this contract without the other's prior written consent, except to an affiliate or in connection with a merger or sale of substantially all assets, with notice to the other party.
### Notices
- Notices must be in writing and delivered by email with confirmation, or by certified mail, to the officers identified in the Parties section. Notice is effective on receipt.
### Electronic signature
- The parties agree that this contract may be executed by electronic signature (including via the KNEL DocuSeal e-signature platform), and that such electronic signatures have the same force and effect as original ink signatures.
+5
View File
@@ -0,0 +1,5 @@
# Services hosted in KNEL Coolify R&D Instance, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|coming soon|coming soon|coming soon|
+5
View File
@@ -0,0 +1,5 @@
# Services hosted in KNEL Coolify Techops Instance, offered to all TSYS Group components
|Function|Vendor|Instance|
|---|---|---|
|LLC Governance|TBD|TBD|
+2 -4
View File
@@ -2,11 +2,9 @@
|Function|Vendor|Instance|
|---|---|---|
|Soverign Hosting|[Umbrel](https://umbrel.com/)|N/A(KNEL DC VPN no external access) |
|Value4Value|[Helipad](https://tryhelipad.com/)|N/A(KNEL DC VPN no external access) |
|Sovereign Hosting|[Umbrel](https://umbrel.com/)|N/A(KNEL DC VPN no external access) |
|Bitcoin Node|details coming soon|N/A(KNEL DC VPN no external access)|
|Etherum Node|details coming soon|N/A (KNEL DC VPN no external access)|
|Ethereum Node|details coming soon|N/A (KNEL DC VPN no external access)|
|Bitcoin Payment Processing|details coming soon|N/A (KNEL DC VPN no external access)|
|NFS/SMB Fileserver|details coming soon|N/A (KNEL DC VPN no external access)|
|VOIP (inbound)|details coming soon|N/A (KNEL DC VPN no external access)|
|Certificate Authority|details coming soon|N/A (KNEL DC VPN no external access)|
+5 -2
View File
@@ -2,5 +2,8 @@
|Function|Vendor|Instance|
|---|---|---|
|Storage/Compute/Network HPC Runtime Resources| SLURM| TBD|
|Electronic Design Automation|[EzEDA](https://ezeda.org)| TBD|
|SLURM/BOINC Managed Electronic design automation/RF lab/environmental lab/network interop lab/General Storage Compute Network Capacity| Dell/Nvidia/Netapp/other| N/A|
|Production Big data/ETL etc processing|details coming soon| N/A (KNEL DC VPN no external access)|
|R&D Big data/ETL etc processing|details coming soon| N/A (KNEL DC VPN no external access)|
|NFS/SMB Fileserver|details coming soon|N/A (KNEL DC VPN no external access)|
|Value4Value|[Helipad](https://tryhelipad.com/)|N/A(KNEL DC VPN no external access) |
+55
View File
@@ -0,0 +1,55 @@
---
title: 'Sign Electronically'
visible: true
---
## Sign this contract electronically
This contract can be executed electronically via the KNEL DocuSeal e-signature platform, reached through the KNEL APISIX API gateway. Enter the signer's details below; DocuSeal will email a signing link.
<form id="esign-form" onsubmit="return esignSubmit(event)">
<label for="esign-name">Full name</label>
<input type="text" id="esign-name" name="name" required style="display:block;margin-bottom:8px;min-width:280px;padding:6px;">
<label for="esign-email">Email address</label>
<input type="email" id="esign-email" name="email" required style="display:block;margin-bottom:12px;min-width:280px;padding:6px;">
<label for="esign-entity">Entity (Party 2)</label>
<input type="text" id="esign-entity" name="entity" required style="display:block;margin-bottom:12px;min-width:280px;padding:6px;">
<button type="submit" style="padding:8px 16px;">Request signature link</button>
</form>
<p id="esign-status" style="margin-top:12px;"></p>
<script>
function esignSubmit(ev) {
ev.preventDefault();
var status = document.getElementById('esign-status');
status.textContent = 'Requesting signing link…';
var name = document.getElementById('esign-name').value;
var email = document.getElementById('esign-email').value;
var entity = document.getElementById('esign-entity').value;
fetch('https://apigw.knownelement.com/contract-sign/api/v1/submissions', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: Number(''),
submitters: [
{email: email, name: name, role: 'First Party'},
{email: email, name: name + ' (' + entity + ')', role: 'Second Party', is_invited: false}
]
})
}).then(function (r) {
if (!r.ok) throw new Error('gateway returned ' + r.status);
return r.json();
}).then(function (data) {
var slug = data.submitters && data.submitters[0] && data.submitters[0].slug;
if (slug) {
window.location.href = 'https://esign.knownelement.com/s/' + slug;
} else {
status.textContent = 'Signing request created. Check ' + email + ' for the signing link.';
}
}).catch(function (e) {
status.textContent = 'Could not create the signing request (' + e.message + '). Contact KNEL helpdesk.';
});
return false;
}
</script>
+23
View File
@@ -0,0 +1,23 @@
## Execution
IN WITNESS WHEREOF, the parties have executed this contract as of the Effective Date.
### For Known Element Enterprises LLC
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### For TSYS Group Component
- Name: ______________________________
- Title: ______________________________
- Signature: ______________________________
- Date: ______________________________
### Electronic execution
This contract may be executed electronically via the KNEL e-signature platform:
[Sign this contract electronically](https://contract.knownelement.com/sign)
-4
View File
@@ -1,4 +0,0 @@
## Contract Length
- Contract Length : 99 years
-4
View File
@@ -1,4 +0,0 @@
## Payment Terms
- The services are offered for an all inclusive delivered price of 100.00 which must be paid Monthly
-11
View File
@@ -1,11 +0,0 @@
## SLA/SLO
- The services listed in the section titled "Services Offered by Known Element Enterprises LLC " are provided with the following SLA/SLO:
- Service Level Agreement (SLA): 95%
- Service Level Objective (SLO): 99%
- Penalities to Known Element Enterprises LLC for not hitting the SLA/SLO
- Penalty for missing the SLA: none
- Penalty for missing the SLO: none
-168
View File
@@ -1,168 +0,0 @@
parserOptions:
ecmaVersion: latest
sourceType: module
env:
es6: true
jasmine: true
node: true
extends: eslint:recommended
rules:
accessor-pairs: error
array-bracket-spacing:
- error
- never
array-callback-return: error
block-spacing:
- error
- never
brace-style: error
comma-dangle: error
comma-spacing: error
comma-style: error
complexity:
- error
- 10
computed-property-spacing: error
consistent-return: error
consistent-this: error
constructor-super: error
curly: error
default-case: error
dot-notation: error
eol-last: error
eqeqeq: error
generator-star-spacing: error
global-require: off
guard-for-in: error
jsx-quotes: error
key-spacing: error
keyword-spacing: error
linebreak-style: error
lines-around-comment:
- error
-
allowBlockStart: true
allowObjectStart: true
allowArrayStart: true
max-statements-per-line: error
new-cap: error
new-parens: error
no-array-constructor: error
no-bitwise: error
no-caller: error
no-case-declarations: error
no-catch-shadow: error
no-class-assign: error
no-cond-assign: error
no-confusing-arrow: error
no-console: off
no-const-assign: error
no-constant-condition: error
no-continue: error
no-delete-var: error
no-dupe-args: error
no-dupe-class-members: error
no-dupe-keys: error
no-duplicate-case: error
no-duplicate-imports: error
no-empty: off
no-empty-character-class: error
no-empty-pattern: error
no-eq-null: error
no-eval: error
no-extend-native: error
no-extra-bind: error
no-extra-boolean-cast: error
no-extra-label: error
no-extra-semi: error
no-fallthrough: error
no-func-assign: error
no-implied-eval: error
no-inner-declarations: error
no-invalid-this: error
no-invalid-regexp: error
no-irregular-whitespace: error
no-iterator: error
no-label-var: error
no-labels: error
no-lone-blocks: error
no-lonely-if: error
no-loop-func: error
no-mixed-spaces-and-tabs: error
no-multi-spaces: error
no-multi-str: error
no-multiple-empty-lines:
- error
-
max: 2
no-native-reassign: error
no-negated-condition: error
no-nested-ternary: error
no-new: error
no-new-func: error
no-new-object: error
no-new-symbol: error
no-new-wrappers: error
no-obj-calls: error
no-octal: error
no-octal-escape: error
no-path-concat: error
no-plusplus: error
no-proto: error
no-redeclare: error
no-regex-spaces: error
no-restricted-globals: error
no-return-assign: error
no-script-url: error
no-self-assign: error
no-self-compare: error
no-sequences: error
no-shadow: error
no-shadow-restricted-names: error
no-spaced-func: error
no-sparse-arrays: error
no-this-before-super: error
no-throw-literal: error
no-trailing-spaces: error
no-undef: error
no-undef-init: error
no-unexpected-multiline: error
no-unmodified-loop-condition: error
no-unneeded-ternary: error
no-unreachable: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-unused-vars: error
no-useless-call: error
no-useless-computed-key: error
no-useless-concat: error
no-useless-constructor: error
no-useless-escape: error
no-void: error
no-warning-comments: warn
no-whitespace-before-property: error
no-with: error
operator-assignment: error
padded-blocks:
- error
- never
prefer-const: error
quote-props:
- error
- as-needed
radix: error
require-yield: error
semi: error
semi-spacing: error
space-before-blocks: error
space-in-parens: error
space-infix-ops:
- error
-
int32Hint: false
space-unary-ops: error
spaced-comment: error
use-isnan: error
valid-typeof: error
yield-star-spacing: error
@@ -1,13 +0,0 @@
name: CI
on: [push]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: Run tests
run: ./run-tests
- name: Run against spec
run: ./run-spec
@@ -1,45 +0,0 @@
name: docker push
on: [push]
jobs:
push_to_registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Docker meta
if: startsWith(github.ref, 'refs/tags/')
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ghcr.io/${{ github.repository }}
tag-match: v(.*)
- name: Set up QEMU
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
if: startsWith(github.ref, 'refs/tags/')
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: true
@@ -1,9 +0,0 @@
*.swp
diagnostic.partial
diagnostic.test
tests/*.diff
spec/
spec-runner/
node_modules/
package.json
package-lock.json
-616
View File
@@ -1,616 +0,0 @@
API / Function Documentation
============================
This documentation is generated automatically from the source of [mo] thanks to [tomdoc.sh].
`mo()`
------
Public: Template parser function. Writes templates to stdout.
* $0 - Name of the mo file, used for getting the help message.
* $@ - Filenames to parse.
Returns nothing.
`mo::debug()`
-------------
Internal: Show a debug message
* $1 - The debug message to show
Returns nothing.
`mo::debugShowState()`
----------------------
Internal: Show a debug message and internal state information
No arguments
Returns nothing.
`mo::error()`
-------------
Internal: Show an error message and exit
* $1 - The error message to show
* $2 - Error code
Returns nothing. Exits the program.
`mo::errorNear()`
-----------------
Internal: Show an error message with a snippet of context and exit
* $1 - The error message to show
* $2 - The starting point
* $3 - Error code
Returns nothing. Exits the program.
`mo::usage()`
-------------
Internal: Displays the usage for mo. Pulls this from the file that contained the `mo` function. Can only work when the right filename comes is the one argument, and that only happens when `mo` is called with `$0` set to this file.
* $1 - Filename that has the help message
Returns nothing.
`mo::content()`
---------------
Internal: Fetches the content to parse into MO_UNPARSED. Can be a list of partials for files or the content from stdin.
* $1 - Destination variable name
* $2-@ - File names (optional), read from stdin otherwise
Returns nothing.
`mo::contentFile()`
-------------------
Internal: Read a file into MO_UNPARSED.
* $1 - Destination variable name.
* $2 - Filename to load - if empty, defaults to /dev/stdin
Returns nothing.
`mo::indirect()`
----------------
Internal: Send a variable up to the parent of the caller of this function.
* $1 - Variable name
* $2 - Value
Examples
callFunc () {
local "$1" && mo::indirect "$1" "the value"
}
callFunc dest
echo "$dest" # writes "the value"
Returns nothing.
`mo::indirectArray()`
---------------------
Internal: Send an array as a variable up to caller of a function
* $1 - Variable name
* $2-@ - Array elements
Examples
callFunc () {
local myArray=(one two three)
local "$1" && mo::indirectArray "$1" "${myArray[@]}"
}
callFunc dest
echo "${dest[@]}" # writes "one two three"
Returns nothing.
`mo::trimUnparsed()`
--------------------
Internal: Trim leading characters from MO_UNPARSED
Returns nothing.
`mo::chomp()`
-------------
Internal: Remove whitespace and content after whitespace
* $1 - Name of the destination variable
* $2 - The string to chomp
Returns nothing.
`mo::parse()`
-------------
Public: Parses text, interpolates mustache tags. Utilizes the current value of MO_OPEN_DELIMITER, MO_CLOSE_DELIMITER, and MO_STANDALONE_CONTENT. Those three variables shouldn't be changed by user-defined functions.
* $1 - Destination variable name - where to store the finished content
* $2 - Content to parse
* $3 - Preserve standalone status/content - truthy if not empty. When set to a value, that becomes the standalone content value
Returns nothing.
`mo::parseInternal()`
---------------------
Internal: Parse MO_UNPARSED, writing content to MO_PARSED. Interpolates mustache tags.
No arguments
Returns nothing.
`mo::parseBlock()`
------------------
Internal: Handle parsing a block
* $1 - Invert condition ("true" or "false")
Returns nothing
`mo::parseBlockFunction()`
--------------------------
Internal: Handle parsing a block whose first argument is a function
* $1 - Invert condition ("true" or "false")
* $2-@ - The parsed tokens from inside the block tags
Returns nothing
`mo::parseBlockArray()`
-----------------------
Internal: Handle parsing a block whose first argument is an array
* $1 - Invert condition ("true" or "false")
* $2-@ - The parsed tokens from inside the block tags
Returns nothing
`mo::parseBlockValue()`
-----------------------
Internal: Handle parsing a block whose first argument is a value
* $1 - Invert condition ("true" or "false")
* $2-@ - The parsed tokens from inside the block tags
Returns nothing
`mo::parsePartial()`
--------------------
Internal: Handle parsing a partial
No arguments.
Indentation will be applied to the entire partial's contents before parsing. This indentation is based on the whitespace that ends the previously parsed content.
Returns nothing
`mo::parseComment()`
--------------------
Internal: Handle parsing a comment
No arguments.
Returns nothing
`mo::parseDelimiter()`
----------------------
Internal: Handle parsing the change of delimiters
No arguments.
Returns nothing
`mo::parseValue()`
------------------
Internal: Handle parsing value or function call
No arguments.
Returns nothing
`mo::isFunction()`
------------------
Internal: Determine if the given name is a defined function.
* $1 - Function name to check
Be extremely careful. Even if strict mode is enabled, it is not honored in newer versions of Bash. Any errors that crop up here will not be caught automatically.
Examples
moo () {
echo "This is a function"
}
if mo::isFunction moo; then
echo "moo is a defined function"
fi
Returns 0 if the name is a function, 1 otherwise.
`mo::isArray()`
---------------
Internal: Determine if a given environment variable exists and if it is an array.
* $1 - Name of environment variable
Be extremely careful. Even if strict mode is enabled, it is not honored in newer versions of Bash. Any errors that crop up here will not be caught automatically.
Examples
var=(abc)
if moIsArray var; then
echo "This is an array"
echo "Make sure you don't accidentally use \$var"
fi
Returns 0 if the name is not empty, 1 otherwise.
`mo::isArrayIndexValid()`
-------------------------
Internal: Determine if an array index exists.
* $1 - Variable name to check
* $2 - The index to check
Has to check if the variable is an array and if the index is valid for that type of array.
Returns true (0) if everything was ok, 1 if there's any condition that fails.
`mo::isVarSet()`
----------------
Internal: Determine if a variable is assigned, even if it is assigned an empty value.
* $1 - Variable name to check.
Can not use logic like this in case invalid variable names are passed. [[ "${!1-a}" == "${!1-b}" ]]
Returns true (0) if the variable is set, 1 if the variable is unset.
`mo::isTruthy()`
----------------
Internal: Determine if a value is considered truthy.
* $1 - The value to test
* $2 - Invert the value, either "true" or "false"
Returns true (0) if truthy, 1 otherwise.
`mo::evaluate()`
----------------
Internal: Convert token list to values
* $1 - Destination variable name
* $2-@ - Tokens to convert
Sample call:
mo::evaluate dest NAME username VALUE abc123 PAREN 2
Returns nothing.
`mo::evaluateListOfSingles()`
-----------------------------
Internal: Convert an argument list to individual values.
* $1 - Destination variable name
* $2-@ - A list of argument types and argument name/value.
This assumes each value is separate from the rest. In contrast, mo::evaluate will pass all arguments to a function if the first value is a function.
Sample call:
mo::evaluateListOfSingles dest NAME username VALUE abc123
Returns nothing.
`mo::evaluateSingle()`
----------------------
Internal: Evaluate a single argument
* $1 - Name of variable for result
* $2 - Type of argument, either NAME or VALUE
* $3 - Argument
Returns nothing
`mo::evaluateKey()`
-------------------
Internal: Return the value for @key based on current's name
* $1 - Name of variable for result
Returns nothing
`mo::evaluateVariable()`
------------------------
Internal: Handle a variable name
* $1 - Destination variable name
* $2 - Variable name
Returns nothing.
`mo::findVariableName()`
------------------------
Internal: Find the name of a variable to use
* $1 - Destination variable name, receives an array
* $2 - Variable name from the template
The array contains the following values
* [0] - Variable name
* [1] - Array index, or empty string
Example variables a="a"
b="b"
c=("c.0" "c.1")
d=([b]="d.b" [d]="d.d")
Given these inputs (function input, current value), produce these outputs a c => a
a c.0 => a
b d => d.b
b d.d => d.b
a d => d.a
a d.d => d.a
c.0 d => c.0
d.b d => d.b
'' c => c
'' c.0 => c.0
Returns nothing.
`mo::join()`
------------
Internal: Join / implode an array
* $1 - Variable name to receive the joined content
* $2 - Joiner
* $3-@ - Elements to join
Returns nothing.
`mo::evaluateFunction()`
------------------------
Internal: Call a function.
* $1 - Variable for output
* $2 - Content to pass
* $3 - Function to call
* $4-@ - Additional arguments as list of type, value/name
Returns nothing.
`mo::standaloneCheck()`
-----------------------
Internal: Check if a tag appears to have only whitespace before it and after it on a line. There must be a new line before and there must be a newline after or the end of a string
No arguments.
Returns 0 if this is a standalone tag, 1 otherwise.
`mo::standaloneProcess()`
-------------------------
Internal: Process content before and after a tag. Remove prior whitespace up to the previous newline. Remove following whitespace up to and including the next newline.
No arguments.
Returns nothing.
`mo::indentLines()`
-------------------
Internal: Apply indentation before any line that has content in MO_UNPARSED.
* $1 - Destination variable name.
* $2 - The indentation string.
* $3 - The content that needs the indentation string prepended on each line.
Returns nothing.
`mo::escape()`
--------------
Internal: Escape a value
* $1 - Destination variable name
* $2 - Value to escape
Returns nothing
`mo::getContentUntilClose()`
----------------------------
Internal: Get the content up to the end of the block by minimally parsing and balancing blocks. Returns the content before the end tag to the caller and removes the content + the end tag from MO_UNPARSED. This can change the delimiters, adjusting MO_OPEN_DELIMITER and MO_CLOSE_DELIMITER.
* $1 - Destination variable name
* $2 - Token string to match for a closing tag
Returns nothing.
`mo::tokensToString()`
----------------------
Internal: Convert a list of tokens to a string
* $1 - Destination variable for the string
* $2-$@ - Token list
Returns nothing.
`mo::getContentTrim()`
----------------------
Internal: Trims content from MO_UNPARSED, returns trimmed content.
* $1 - Destination variable
Returns nothing.
`mo::getContentComment()`
-------------------------
Get the content up to and including a close tag
* $1 - Destination variable
Returns nothing.
`mo::getContentDelimiter()`
---------------------------
Get the content up to and including a close tag. First two non-whitespace tokens become the new open and close tag.
* $1 - Destination variable
Returns nothing.
`mo::getContentWithinTag()`
---------------------------
Get the content up to and including a close tag. First two non-whitespace tokens become the new open and close tag.
* $1 - Destination variable, an array
* $2 - Terminator string
The array contents: [0] The raw content within the tag
[1] The parsed tokens as a single string
Returns nothing.
`mo::tokenizeTagContents()`
---------------------------
Internal: Parse MO_UNPARSED and retrieve the content within the tag delimiters. Converts everything into an array of string values.
* $1 - Destination variable for the array of contents.
* $2 - Stop processing when this content is found.
The list of tokens are in RPN form. The first item in the resulting array is the number of actual tokens (after combining command tokens) in the list.
Given: a 'bc' "de\"\n" (f {g 'h'}) Result: ([0]=4 [1]=NAME [2]=a [3]=VALUE [4]=bc [5]=VALUE [6]=$'de\"\n' [7]=NAME [8]=f [9]=NAME [10]=g [11]=VALUE [12]=h [13]=BRACE [14]=2 [15]=PAREN [16]=2
Returns nothing
`mo::tokenizeTagContentsName()`
-------------------------------
Internal: Get the contents of a variable name.
* $1 - Destination variable name for the token list (array of strings)
Returns nothing
`mo::tokenizeTagContentsDoubleQuote()`
--------------------------------------
Internal: Get the contents of a tag in double quotes. Parses the backslash sequences.
* $1 - Destination variable name for the token list (array of strings)
Returns nothing.
`mo::tokenizeTagContentsSingleQuote()`
--------------------------------------
Internal: Get the contents of a tag in single quotes. Only gets the raw value.
* $1 - Destination variable name for the token list (array of strings)
Returns nothing.
`MO_ORIGINAL_COMMAND`
---------------------
Save the original command's path for usage later
[mo]: ./mo
[tomdoc.sh]: https://github.com/tests-always-included/tomdoc.sh
-7
View File
@@ -1,7 +0,0 @@
FROM alpine
RUN apk add --no-cache bash
ADD mo /usr/local/bin/mo
RUN chmod +x /usr/local/bin/mo
ENTRYPOINT /usr/local/bin/mo
-7
View File
@@ -1,7 +0,0 @@
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by contributors", in the same place and form as other third-party acknowledgments. Alternately, this acknowledgment may appear in the software itself, in the same form and location as other such third-party acknowledgments.
-340
View File
@@ -1,340 +0,0 @@
Mo - Mustache Templates in Bash
===============================
[Mustache] templates are simple, logic-less templates. Because of their simplicity, they are able to be ported to many languages. The syntax is quite simple.
Hello, {{NAME}}.
I hope your {{TIME_PERIOD}} was fun.
The above file is [`demo/fun-trip.mo`](demo/fun-trip.mo). Let's try using this template some data from bash's environment. Go to your checked out copy of the project and run a command like this:
NAME=Tyler TIME_PERIOD=weekend ./mo demo/fun-trip.mo
Your result?
Hello, Tyler.
I hope your weekend was fun.
This bash version supports conditionals, functions (both as filters and as values), as well as indexed arrays (for iteration). You are able to leverage these additional features by adding more information into the environment. It is easiest to do this when you source `mo`. See the [demo scripts](demo/) for further examples.
Requirements
------------
* Bash 3.x (the aim is to make it work on Macs)
* The "coreutils" package (`basename` and `cat`)
* ... that's it. Why? Because bash **can**!
If you intend to develop this and run the official specs, you also need node.js.
Installation
------------
There are a few ways you can install this tool. How you install it depends on how you want to use it.
### Globally; For Everyone
You can install this file in `/usr/local/bin/` or `/usr/bin/` by simply downloading it, changing the permissions, then moving it to the right location. Double check that your system's PATH includes the destination folder, otherwise users may have a hard time starting the command.
# Download
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
# Make executable
chmod +x mo
# Move to the right folder
sudo mv mo /usr/local/bin/
# Test
echo "works" | mo
### Locally; For Yourself
This is very similar to installing it globally but it does not require root privileges. It is very important that your PATH includes the destination folder otherwise it won't work. Some local folders that are typically used are `~/bin/` and `~/.local/bin/`.
# Download
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
# Make executable
chmod +x mo
# Ensure destination folder exists
mkdir -p ~/.local/bin/
# Move to the right folder
mv mo ~/.local/bin/
# Test
echo "works" | mo
### As A Library; For A Tool
Bash scripts can source `mo` to include the functionality in their own routines. This usage typically would have `mo` saved to a `lib/` folder in an application and your other scripts would use `. lib/mo` to bring it into your project.
# Download
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
# Move into your project folder
mv mo ~/projects/amazing-things/lib/
To allow it to work this way, you either should source the file (`. "lib/mo"`) or make it executable (`chmod +x lib/mo`) and run it from your scripts.
How to Use
----------
If you only plan using strings and numbers, nothing could be simpler. In your shell script you can choose to export the variables. The below script is [`demo/using-strings`](demo/using-strings).
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
export TEST="This is a test"
echo "Your message: {{TEST}}" | ../mo
The result? "Your message: This is a test".
Using arrays adds a slight level of complexity. *You must source `mo`.* Look at [`demo/using-arrays`](demo/using-arrays).
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
export ARRAY=( one two "three three three" four five )
. ../mo # This loads the "mo" function
cat << EOF | mo
Here are the items in the array:
{{#ARRAY}}
* {{.}}
{{/ARRAY}}
EOF
The result? You get a list of the five elements in the array. It is vital that you source `mo` and run the function when you want arrays to work because you can not execute a command and have arrays passed to that command's environment. Instead, we first source the file to load the function and then run the function directly.
There are more scripts available in the [demos directory](demo/) that could help illustrate how you would use this program.
There are additional features that the program supports. Try using `mo --help` to see what is available.
Please note that this command is written in Bash and pulls data from either the environment or (when using `--source`) from a text file that will be sourced and loaded into the environment, which means you will need to have Bash-style variables defined. Please see the examples in `demo/` for different ways you can use `mo`.
Enhancements
------------
In addition to many of the features built-in to Mustache, `mo` includes a number of unique features that make it a bit more powerful.
### Loop @key
`mo` implements Handlebar's `@key` references for outputting the key inside of a loop:
Env:
```bash
myarr=( foo bar )
# Bash v4+
declare -A myassoc
myassoc[hello]="mo"
myassoc[world]="is great"
```
Template:
```handlebars
{{#myarr}}
- {{@key}} {{.}}
{{/myarr}}
{{#myassoc}}
* {{@key}} {{.}}
{{/myassoc}}
```
Output:
```markdown
- 0 foo
- 1 bar
* hello mo
* world is great
```
### Helpers / Function Arguments
Function Arguments are not a part of the official Mustache implementation, and are more often associated with Handlebar's Helper functionality.
`mo` allows for passing strings to functions.
```handlebars
{{myfunc foo bar}}
```
For security reasons, these arguments are not immediately available to function calls without a flag.
#### with `--allow-function-arguments`
```bash
myfunc() {
# Outputs "foo, bar"
echo "$1, $2";
}
```
#### Using `$MO_FUNCTION_ARGS`
```bash
myfunc() {
# Outputs "foo, bar"
echo "${MO_FUNCTION_ARGS[0]}, ${MO_FUNCTION_ARGS[1]}";
}
```
### Triple Mustache, Parenthesis, and Quotes
Normally, triple mustache syntax, such as `{{{var}}}` will avoid HTML escaping of the variable. Because HTML escaping is not supported in `mo`, this is now used differently. Anything within braces will be looked up and the values will be concatenated together and the result will be treated as a value. Anything in parenthesis will be looked up, concatenated, and treated as a name. Also, anything in single quotes is passed as a value; double quoted things first are unescaped and then passed as a value.
```
# Example input
var=abc
user=admin
admin=Administrator
u=user
abc=([0]=zero [1]=one [2]=two)
```
| Mustache syntax | Resulting output | Notes |
|-----------------|------------------|-------|
| `{{var}}` | `abc` | Normal behavior |
| `{{var us}}` | `abcus` | Concatenation |
| `{{'var'}}` | `var` | Passing as a value |
| `{{"a\tb"}}` | `a b` | There was an escaped tab in the value |
| `{{u}}` | `user` | Normal behavior |
| `{{{u}}}` | `user` | Look up "$u", treat as the value `{{'user'}}` |
| `{{(u)}}` | `admin` | Look up "$u", treat as the name `{{user}}` |
| `{{var user}}` | `abcuser` | Concatenation |
| `{{(var '.1')}}` | `one` | Look up "$var", treat as "abc", then concatenate ".1" and look up `{{abc.1}}` |
In double-quoted strings, the following escape sequences are defined.
* `\"` - Quote
* `\b` - Bell
* `\e` - Escape (note that Bash typically uses $'\E' for the same thing)
* `\f` - Form feed
* `\n` - Newline
* `\r` - Carriage return
* `\t` - Tab
* `\v` - Vertical tab
* Anything else will skip the `\` and place the next character. However, this implementation is allowed to change in the future if a different escape character mapping becomes commonplace.
Environment Variables and Functions
-----------------------------------
There are several functions and variables used to process templates. `mo` reserves variables that start with `MO_` for variables exposing data or configuration, functions starting with `mo::`, and local variables starting with `mo[A-Z]`. You are welcome to use internal functions, though only ones that are marked as "Public" should not change their interface. Scripts may also read any of the variables.
Functions are all executed in a subshell, with another subshell for lambdas. Thus, your lambda can't affect the parsing of a template. There's more information about lambdas when talking about tests that fail.
* `MO_ALLOW_FUNCTION_ARGUMENTS` - When set to a non-empty value, this allows functions referenced in templates to receive additional options and arguments.
* `MO_CLOSE_DELIMITER` - The string used when closing a tag. Defaults to "}}". Used internally.
* `MO_CLOSE_DELIMITER_DEFAULT` - The default value of `MO_CLOSE_DELIMITER`. Used when resetting the close delimiter, such as when parsing a partial.
* `MO_CURRENT` - Variable name to use for ".".
* `MO_DEBUG` - When set to a non-empty value, additional debug information is written to stderr.
* `MO_FUNCTION_ARGS` - Arguments passed to the function.
* `MO_FAIL_ON_FILE` - If a filename from the command-line is missing or a partial does not exist, abort with an error.
* `MO_FAIL_ON_FUNCTION` - If a function returns a non-zero status code, abort with an error.
* `MO_FAIL_ON_UNSET` - When set to a non-empty value, expansion of an unset env variable will be aborted with an error.
* `MO_FALSE_IS_EMPTY` - When set to a non-empty value, the string "false" will be treated as an empty value for the purposes of conditionals.
* `MO_OPEN_DELIMITER` - The string used when opening a tag. Defaults to "{{". Used internally.
* `MO_OPEN_DELIMITER_DEFAULT` - The default value of MO_OPEN_DELIMITER. Used when resetting the open delimiter, such as when parsing a partial.
* `MO_ORIGINAL_COMMAND` - Used to find the `mo` program in order to generate a help message.
* `MO_PARSED` - Content that has made it through the template engine.
* `MO_STANDALONE_CONTENT` - The unparsed content that preceeded the current tag. When a standalone tag is encountered, this is checked to see if it only contains whitespace. If this and the whitespace condition after a tag is met, then this will be reset to $'\n'.
* `MO_UNPARSED` - Template content yet to make it through the parser.
Concessions
-----------
I admit that implementing everything in bash just doesn't make a lot of sense. For example, the following things just don't work because they don't really mesh with the "bash way".
Pull requests to solve the following issues would be helpful.
### Mustache Syntax
* Dotted names are supported but only for associative arrays (Bash 4). See [`demo/associative-arrays`](demo/associative-arrays) for an example.
* There's no "top level" object, so `echo '{{.}}' | ./mo` does not do anything useful. In other languages you can say the data for the template is a string and in `mo` the data is always the environment. Luckily this type of usage is rare and `{{.}}` works great when iterating over an array.
* [Parents](https://mustache.github.io/mustache.5.html#Parents), where a template can override chunks of a partial, are not supported.
* HTML encoding is not built into `mo`. `{{{var}}}`, `{{&var}}` and `{{var}}` all do the same thing. `echo '{{TEST}}' | TEST='<b>' mo` will give you "`<b>`" instead of "`&gt;b&lt;`".
### General Scripting Issues
* Using binary files as templates is simply not allowed.
* Bash does not support anything more complex than strings/numbers inside of associative arrays. I'm not able to add objects nor nested arrays to bash - it's just a shell after all!
* You must make sure the data is in the environment when `mo` runs. The easiest way to do that is to source `mo` in your shell script after setting up lots of other environment variables / functions.
Developing
----------
Check out the code and hack away. Please add tests to show off bugs before fixing them. New functionality should also be covered by a test.
First, make sure you install Node.js. After that, run `npm run install-tests` to get the dependencies and the repository of YAML tests. Run `npm run test` to run the JavaScript tests. There's over 100 of them, which is great. Not all of them will pass, but that's discussed later.
When submitting patches, make sure to run them past [ShellCheck] and ensure no problems are found. Also please use Bash 3 syntax if you are manipulating arrays.
### Porting and Backporting
In case of problems, setting MO_DEBUG to a non-empty value will give you LOTS of output.
MO_DEBUG=1 ./mo my-template
### Failed Specs
It is acceptable for some of the official spec tests to fail. The spec runner has specific exclusions and overrides to test similar functionality that avoid the following issues.
* Using `{{.}}` outside of a loop - In order to access any variable, you must use its name. In a loop, `{{.}}` will refer to the current value, but outside the loop you are unable to use this dot notation because there is no current value.
* Deeply nested data - Bash doesn't support complex data structure. Basically, just strings and arrays of strings.
* Interpolation; Multiple Calls: This fails because lambdas execute in a subshell so their output can be captured. If you want state to be preserved, you will need to write it outside of the current environment and load it again later.
* HTML Escaping - Since bash is not often executed in a web server context, it makes no sense to have the output escaped as HTML. Performing shell escaping of variables may be an option in the future if there's a demand.
* Lambdas - Function results are *not* automatically interpreted again. If you want to parse the results as Mustache content, use `mo::parse`. When they use `mo::parse`, it will use the current delimiters.
For lambdas, these examples may help.
```bash
# Retrieve content into a variable.
content=$(cat)
# Retrieve all content and do not trim newlines at the end.
content=$(cat; echo -n '.')
content=${content%.}
# Parse content using the current delimiters
mo::parse results "This is my content. Hello, {{username}}"
echo -n "$results"
# Parse content using the default delimiters
MO_OPEN_DELIMITER=$MO_OPEN_DELIMITER_DEFAULT
MO_CLOSE_DELIMITER=$MO_CLOSE_DELIMITER_DEFAULT
mo::parse results "This is my content. Hello, {{username}}"
echo -n "$results"
```
### Future Enhancements
There's a few places in the code marked with `TODO` to signify areas that could use improvement. Care to help? Keep in mind that this uses bash exclusively, so it might not look the prettiest.
License
-------
This program is licensed under an MIT license with an additional non-advertising clause. See [LICENSE.md](LICENSE.md) for the full text.
[Mustache]: https://mustache.github.io/
[ShellCheck]: https://github.com/koalaman/shellcheck
@@ -1,19 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
declare -A DATA
export DATA=([one]=111 [two]=222)
. ../mo
cat <<EOF | mo
Accessing data directly:
DATA: {{DATA}}
One: {{DATA.one}}
Two: {{DATA.two}}
Things in DATA:
{{#DATA}}
Item: {{.}}
{{/DATA}}
EOF
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
#
# This embeds a template in the script without using strange `cat` syntax.
# shellcheck disable=SC1083 disable=SC1010 disable=SC1054 disable=SC1073 disable=SC1072 disable=SC1056 disable=SC1009
cd "$(dirname "$0")" # Go to the script's directory
export NAME="Tyler"
export VEHICLE="Ford Explorer"
export OVERDUE_LENGTH="2 months"
export OPTIONS=(
"Call a service representative at 1-800-000-0000 to discuss payment options"
"Return the vehicle immediately and pay a fine of 1 million dollars"
)
. ../mo
sed '0,/^# END/ d' "$(basename "$0")" | mo
exit
# END
Attention {{NAME}},
You need to pay for the {{VEHICLE}} you are leasing from us.
It has been {{OVERDUE_LENGTH}} since your last payment.
At this point you must do one of the following:
{{#OPTIONS}}
* {{.}}
{{/OPTIONS}}
-3
View File
@@ -1,3 +0,0 @@
Hello, {{NAME}}
I hope your {{TIME_PERIOD}} was fun.
-31
View File
@@ -1,31 +0,0 @@
#!/usr/bin/env bash
#
# This sources a simple script with the env. variables needed for the template.
cd "$(dirname "$0")" # Go to the script's directory
source ../mo
export NAME="Alex"
export ARRAY=( AAA BBB CCC )
# Include an external template
INCLUDE() {
# shellcheck disable=SC2031
cat "${MO_FUNCTION_ARGS[0]}"
}
# Print section title
TITLE() {
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
# shellcheck disable=SC2031
echo "${MO_FUNCTION_ARGS[0]}"
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
}
cat <<EOF | mo -u
{{TITLE 'Part 1'}}
{{INCLUDE 'function-args-part1'}}
{{TITLE 'Part 2'}}
{{INCLUDE 'function-args-part2'}}
EOF
@@ -1 +0,0 @@
Hello, my name is {{NAME}}.
@@ -1,3 +0,0 @@
{{#ARRAY}}
* {{.}}
{{/ARRAY}}
@@ -1,42 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
EVERY_REPO() {
# The block contents come in through standard input. Capture it here.
content=$(cat)
echo "# Starting EVERY_REPO"
# Get list of repos
for REPO in "${REPOS[@]}"; do
echo "## Looping one time for repo: $REPO"
# String replace REPO_ with the name
# This changes everything in the content block of the template.
# It rewrites {{__REPO__.name}} into {{resque.name}}, for instance.
# You can prefix your environment variables and do other things as well.
echo "$content" | sed "s/__REPO__/${REPO}/"
echo "## Looped one time for repo: $REPO"
done
echo "# Finished EVERY_REPO"
}
REPOS=(resque hub rip)
declare -A resque hub rip
resque=([name]=Resque [url]=http://example.com/resque)
hub=([name]=Hub [url]=http://example.com/hub)
rip=([name]=Rip [url]=http://example.com/rip)
. ../mo
cat <<EOF | mo
{{#EVERY_REPO}}
The repo is __REPO__
Name: {{__REPO__.name}}
URL: {{__REPO__.url}}
{{/EVERY_REPO}}
EOF
@@ -1,39 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
# Detect if this is the first item and write a comma if it is.
# Normally, I would track this using a variable, like so:
#
# COMMA_IF_NOT_FIRST_FLAG=false
# COMMA_IF_NOT_FIRST() {
# $COMMA_IF_NOT_FIRST || echo ","
# COMMA_IF_NOT_FIRST_FLAG=true
# }
#
# Since this function executes in a subshell, that approach will not work.
# Instead, we peek inside mo and see what is being processed. If the variable
# name in moParse() changes, this will need to get updated as well. An
# alternate variable that is usable is context, but that is in moLoop() and is
# two levels levels deep instead of just one.
COMMA_IF_NOT_FIRST() {
[[ "${moCurrent#*.}" != "0" ]] && echo ","
}
# Create an array that will be embedded into the JSON. If you are manipulating
# JSON, might I suggest you look at using jq? It's really good at processing
# JSON.
items=(
'{"position":"one","url":"1"}'
'{"position":"two","url":"2"}'
'{"position":"three","url":"3"}'
)
. ../mo
cat <<EOF | mo
{
{{#items}}
{{COMMA_IF_NOT_FIRST}}
{{.}}
{{/items}}
}
EOF
@@ -1,50 +0,0 @@
#!/usr/bin/env bash
# Example for how #29 can get implemented.
cd "$(dirname "$0")" # Go to the script's directory
foreach() {
# Trying to use unique names
local foreachSourceName foreachIterator foreachEvalString foreachContent
foreachContent=$(cat)
local x
x=("${@}")
if [[ "$2" != "as" && "$2" != "in" ]]; then
echo "Invalid foreach - bad format."
elif [[ "$(declare -p "$1")" != "declare -"[aA]* ]]; then
echo "$1 is not an array"
else
foreachSourceName="${1}[@]"
for foreachIterator in "${!foreachSourceName}"; do
foreachEvalString=$(declare -p "$foreachIterator")
foreachEvalString="declare -A $3=${foreachEvalString#*=}"
eval "$foreachEvalString"
echo "$foreachContent" | mo
done
fi
}
# The links are associative arrays
declare -A resque hub rip
resque=([name]=Resque [url]=http://example.com/resque)
hub=([name]=Hub [url]=http://example.com/hub)
rip=([name]=Rip [url]=http://example.com/rip)
# This is a list of the link arrays
links=(resque hub rip)
# Source mo in order to work with arrays
. ../mo
# Process the template
cat <<EOF | mo --allow-function-arguments
Here are your links:
{{#foreach 'links' 'as' 'link'}}
* [{{link.name}}]({{link.url}})
{{/foreach 'links' 'as' 'link'}}
EOF
-28
View File
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"/..
date-string() {
date
}
wrapper() {
echo -n "*** $(cat) ***"
}
export IP=127.0.0.1
export ALLOWED_HOSTS=( 192.168.0.1 192.168.0.2 192.168.0.3 )
. ./mo # Keep in mind this script is executing in the parent directory
cat <<EOF | mo
# {{#wrapper}}OH SO IMPORTANT{{/wrapper}}
# This file automatically generated at {{date-string}}
home_ip={{IP}}
# ALLOWED HOSTS
{{#ALLOWED_HOSTS}}allowed_host={{.}}
{{/ALLOWED_HOSTS}}{{^ALLOWED_HOSTS}}# No allowed hosts{{/ALLOWED_HOSTS}}
# DENIED HOSTS
{{#DENIED_HOSTS}}denied_host={{.}}
{{/DENIED_HOSTS}}{{^DENIED_HOSTS}}# No denied hosts{{/DENIED_HOSTS}}
EOF
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
export data=$'line 1\nline 2'
cat <<EOF | ../mo
Here is a partial without an indent:
{{> partial}}
And here's the same partial with a 4-space indent:
{{> partial}}
:-)
EOF
-1
View File
@@ -1 +0,0 @@
{{data}}
-13
View File
@@ -1,13 +0,0 @@
#!/usr/bin/env bash
#
# This sources a simple script with the env. variables needed for the template.
cd "$(dirname "$0")" # Go to the script's directory
cat <<EOF | ../mo --source=sourcing.vars
Hello, my name is {{NAME}}.
And this is ARRAY's conntents:
{{#ARRAY}}
* {{.}}
{{/ARRAY}}
EOF
-2
View File
@@ -1,2 +0,0 @@
export NAME="Alex"
export ARRAY=( AAA BBB CCC )
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
export ARRAY=( one two "three three three" four five )
. ../mo
cat << EOF | mo
Here are the items in the array:
{{#ARRAY}}
* {{.}}
{{/ARRAY}}
EOF
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/env bash
#
# This example does not source `mo` and is intentionally restricted to
# variables that are not arrays.
cd "$(dirname "$0")" # Go to the script's directory
export TEST="This is a test"
echo "Your message: {{TEST}}" | ../mo
@@ -1,12 +0,0 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" # Go to the script's directory
export OPEN="{{"
export CLOSE="}}"
cat <<'EOF' | mo
You can use environment variables to write output that has double braces.
{{OPEN}}sampleTag{{CLOSE}}
EOF
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env bash
#
# This requires tomdoc.sh to be in your PATH.
# https://github.com/tests-always-included/tomdoc.sh
cd "${0%/*}" || exit 1
cat <<'EOF'
API / Function Documentation
============================
This documentation is generated automatically from the source of [mo] thanks to [tomdoc.sh].
EOF
sed 's/# shellcheck.*//' mo | tomdoc.sh -m
cat <<'EOF'
[mo]: ./mo
[tomdoc.sh]: https://github.com/tests-always-included/tomdoc.sh
EOF
File diff suppressed because it is too large Load Diff
-22
View File
@@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Install or update the specs
if [[ ! -d spec ]]; then
git clone https://github.com/mustache/spec.git spec
else
(
cd spec
git pull
)
fi
if [[ "$BASH_VERSION" == 3.* ]]; then
echo "WARNING! Specs assume you are using a version of Bash with associative arrays!"
fi
# Actually run the specs
node run-spec.js spec/specs/*.json
if [[ "$BASH_VERSION" == 3.* ]]; then
echo "Some tests may have failed because they assume Bash supports associative arays"
fi
-512
View File
@@ -1,512 +0,0 @@
#!/usr/bin/env node
const exec = require("child_process").exec;
const fsPromises = require("fs").promises;
// Skip or override portions of tests. The goal is to still have as much
// coverage as possible, but skip things that Bash does not support.
//
// To skip a test, define a "skip" property and explain why the test is
// skipped.
//
// To override any test property, just define that property. It replaces the
// original property, not augmenting it.
const testOverrides = {
"Comments -> Variable Name Collision": {
// Can't use variables with exclamation points easily
data: {
comment: 4
}
},
"Interpolation -> Dotted Names - Arbitrary Depth": {
skip: "Not able to use more than one level of depth"
},
"Interpolation -> Dotted Names - Broken Chain Resolution": {
data: {
a: {
b: "wrong"
},
name: "Jim"
},
template: '"{{a.name}}" == ""'
},
"Interpolation -> Dotted Names - Initial Resolution": {
data: {
a: {
name: "Phil"
},
name: "Wrong"
},
template: "\"{{#a}}{{name}}{{/a}}\" == \"Phil\""
},
"Interpolation -> Implicit Iterators - Ampersand": {
skip: "HTML escaping is not supported"
},
"Interpolation -> Implicit Iterators - Basic Interpolation": {
skip: "Can not use {{.}} outside of a loop. Need to use a variable name."
},
"Interpolation -> Implicit Iterators - Basic Integer Interpolation": {
skip: "Can not use {{.}} outside of a loop. Need to use a variable name."
},
"Interpolation -> Implicit Iterators - Triple Mustache": {
skip: "Can not use {{.}} outside of a loop. Need to use a variable name."
},
"Interpolation -> HTML Escaping": {
skip: "HTML escaping is not supported"
},
"Interpolation -> Implicit Iterators - HTML Escaping": {
skip: "HTML escaping is not supported"
},
"Inverted -> Dotted Names - Falsey": {
data: {
a: {
b: ""
}
},
template: '"{{^a.b}}Not Here{{/a.b}}" == "Not Here"'
},
"Inverted -> Dotted Names - Truthy": {
data: {
a: {
b: "1"
}
},
template: '"{{^a.b}}Not Here{{/a.b}}" == ""'
},
"Lambdas -> Escaping": {
skip: "HTML escaping is not supported"
},
"Lambdas -> Interpolation - Alternate Delimiters": {
skip: "There is no difference between a lamba used as a value and a lambda used as a block. Both will parse using the current delimiters."
},
"Lambdas -> Inverted Section": {
// This one passed mostly by accident. Correcting so the test still
// tests what is was designed to illustrate.
data: {
static: "static",
lambda: {
__tag__: 'code',
bash: 'false'
}
}
},
"Lambdas -> Interpolation": {
data: {
lambda: {
__tag__: 'code',
bash: 'echo -n "world"'
}
}
},
"Lambdas -> Interpolation - Expansion": {
data: {
lambda: {
__tag__: 'code',
bash: 'mo::parse result "{{planet}}"; echo -n "$result"'
},
planet: 'world'
}
},
"Lambdas -> Interpolation - Multiple Calls": {
skip: "Calls are not cached, but they run in isolated environments, so saving a global variable does not work."
},
"Lambdas -> Section": {
data: {
lambda: {
__tag__: 'code',
bash: 'if [[ "$(cat)" == "{{x}}" ]]; then echo -n yes; else echo -n no; fi'
},
x: "Error!"
}
},
"Lambdas -> Section - Alternate Delimiters": {
data: {
lambda: {
__tag__: 'code',
bash: 'local content=$(cat); mo::parse content "$content{{planet}} => |planet|$content"; echo -n "$content"'
},
planet: 'Earth'
}
},
"Lambdas -> Section - Expansion": {
data: {
lambda: {
__tag__: 'code',
bash: 'local content=$(cat); mo::parse content "$content{{planet}}$content"; echo -n "$content"'
},
planet: "Earth"
}
},
"Lambdas -> Section - Multiple Calls": {
data: {
lambda: {
__tag__: 'code',
bash: 'echo -n "__$(cat)__"'
}
}
},
"Partials -> Recursion": {
skip: "Complex objects are not supported and context is reset to the global level, so the recursion will loop forever"
},
"Sections -> Deeply Nested Contexts": {
skip: "Nested objects are not supported"
},
"Sections -> Dotted Names - Broken Chains": {
// Complex objects are not supported
template: `"{{#a.b}}Here{{/a.b}}" == ""`
},
"Sections -> Dotted Names - Falsey": {
// Complex objects are not supported
data: { a: { b: false } },
template: `"{{#a.b}}Here{{/a.b}}" == ""`
},
"Sections -> Dotted Names - Truthy": {
// Complex objects are not supported
data: { a: { b: true } },
template: `"{{#a.b}}Here{{/a.b}}" == "Here"`
},
"Sections -> Implicit Iterator - Array": {
skip: "Nested arrays are not supported"
},
"Sections -> List": {
// Arrays of objects are not supported
data: { list: [1, 2, 3] },
template: `"{{#list}}{{.}}{{/list}}"`
},
"Sections -> List Context": {
skip: "Deeply nested objects are not supported"
},
"Sections -> List Contexts": {
skip: "Deeply nested objects are not supported"
}
};
function specFileToName(file) {
return file
.replace(/.*\//, "")
.replace(".json", "")
.replace("~", "")
.replace(/(^|-)[a-z]/g, function (match) {
return match.toUpperCase();
});
}
function processArraySequentially(array, callback) {
function processCopy() {
if (arrayCopy.length) {
const item = arrayCopy.shift();
return Promise.resolve(item)
.then(callback)
.then((singleResult) => {
result.push(singleResult);
return processCopy();
});
} else {
return Promise.resolve(result);
}
}
const result = [];
const arrayCopy = array.slice();
return processCopy();
}
function debug(...args) {
if (process.env.DEBUG) {
console.debug(...args);
}
}
function makeShellString(value) {
if (typeof value === "boolean") {
return value ? '"true"' : '""';
}
if (typeof value === "string") {
// Newlines are tricky
return value
.split(/\n/)
.map(function (chunk) {
return JSON.stringify(chunk);
})
.join('"\n"');
}
if (typeof value === "number") {
return value;
}
return "ERR_CONVERTING";
}
function addToEnvironmentArray(name, value) {
const result = ["("];
value.forEach(function (subValue) {
result.push(makeShellString(subValue));
});
result.push(")");
return name + "=" + result.join(" ");
}
function addToEnvironmentObjectConvertedToAssociativeArray(name, value) {
const values = [];
for (const [k, v] of Object.entries(value)) {
if (typeof v === "object") {
if (v) {
// An object - abort
return `# ${name}.${k} is an object that can not be converted to an associative array`;
}
// null
values.push(`[${k}]=`);
} else {
values.push(`[${k}]=${makeShellString(v)}`);
}
}
return `declare -A ${name}\n${name}=(${values.join(" ")})`;
}
function addToEnvironmentObject(name, value) {
if (!value) {
// null
return `#${name} is null`;
}
if (value.__tag__ === "code") {
return `${name}() { ${value.bash || 'echo "NO BASH VERSION OF CODE"'}; }`;
}
return addToEnvironmentObjectConvertedToAssociativeArray(name, value);
}
function addToEnvironment(name, value) {
if (Array.isArray(value)) {
return addToEnvironmentArray(name, value);
}
if (typeof value === "object") {
return addToEnvironmentObject(name, value);
}
return `${name}=${makeShellString(value)}`;
}
function buildScript(test) {
const script = ["#!/usr/bin/env bash"];
Object.keys(test.data).forEach(function (name) {
script.push(addToEnvironment(name, test.data[name]));
});
script.push(". ./mo");
script.push("mo spec-runner/spec-template");
script.push("");
return script.join("\n");
}
function writePartials(test) {
return processArraySequentially(
Object.keys(test.partials),
(partialName) => {
debug("Writing partial:", partialName);
return fsPromises.writeFile(
"spec-runner/" + partialName,
test.partials[partialName]
);
}
);
}
function setupEnvironment(test) {
return cleanup()
.then(() => fsPromises.mkdir("spec-runner/"))
.then(() =>
fsPromises.writeFile("spec-runner/spec-script", test.script)
)
.then(() =>
fsPromises.writeFile("spec-runner/spec-template", test.template)
)
.then(() => writePartials(test));
}
function executeScript(test) {
return new Promise((resolve) => {
exec(
"bash spec-runner/spec-script 2>&1",
{
timeout: 2000
},
(err, stdout) => {
if (err) {
test.scriptError = err.toString();
}
test.output = stdout;
resolve();
}
);
});
}
function cleanup() {
return fsPromises.rm("spec-runner/", { force: true, recursive: true });
}
function detectFailure(test) {
if (test.scriptError) {
return true;
}
if (test.output !== test.expected) {
return true;
}
return false;
}
function showFailureDetails(test) {
console.log(`FAILURE: ${test.fullName}`);
console.log("");
console.log(test.desc);
console.log("");
console.log(JSON.stringify(test, null, 4));
}
function applyTestOverrides(test) {
const overrides = testOverrides[test.fullName];
const originals = {};
if (!overrides) {
return;
}
for (const [key, value] of Object.entries(overrides)) {
originals[key] = test[key];
test[key] = value;
}
test.overridesApplied = true;
test.valuesBeforeOverride = originals;
}
function runTest(testSet, test) {
test.partials = test.partials || {};
test.fullName = `${testSet.name} -> ${test.name}`;
applyTestOverrides(test);
test.script = buildScript(test);
if (test.skip) {
debug("Skipping test:", test.fullName, `(${test.skip})`);
return Promise.resolve();
}
debug("Running test:", test.fullName);
return setupEnvironment(test)
.then(() => executeScript(test))
.then(cleanup)
.then(() => {
test.isFailure = detectFailure(test);
if (test.isFailure) {
showFailureDetails(test);
} else {
debug('Test pass:', test.fullName);
}
});
}
function processSpecFile(filename) {
debug("Read spec file:", filename);
return fsPromises.readFile(filename, "utf8").then((fileContents) => {
const testSet = JSON.parse(fileContents);
testSet.name = specFileToName(filename);
return processArraySequentially(testSet.tests, (test) =>
runTest(testSet, test)
).then(() => {
testSet.pass = 0;
testSet.fail = 0;
testSet.skip = 0;
testSet.passOverride = 0;
for (const test of testSet.tests) {
if (test.isFailure) {
testSet.fail += 1;
} else if (test.skip) {
testSet.skip += 1;
} else {
testSet.pass += 1;
if (test.overridesApplied) {
testSet.passOverride += 1;
}
}
}
console.log(
`### ${testSet.name} Results = ${testSet.pass} passed (with ${testSet.passOverride} overridden), ${testSet.fail} failed, ${testSet.skip} skipped`
);
return testSet;
});
});
}
// 0 = node, 1 = script, 2 = file
if (process.argv.length < 3) {
console.log("Specify one or more JSON spec files on the command line");
process.exit();
}
processArraySequentially(process.argv.slice(2), processSpecFile).then(
(result) => {
console.log("=========================================");
console.log("");
console.log("Failed Test Summary");
console.log("");
let pass = 0,
fail = 0,
skip = 0,
total = 0,
passOverride = 0;
for (const testSet of result) {
pass += testSet.pass;
fail += testSet.fail;
skip += testSet.skip;
total += testSet.tests.length;
passOverride += testSet.passOverride;
console.log(
`* ${testSet.name}: ${testSet.tests.length} total, ${testSet.pass} pass (with ${passOverride} overridden), ${testSet.fail} fail, ${testSet.skip} skip`
);
for (const test of testSet.tests) {
if (test.isFailure) {
console.log(` * Failure: ${test.name}`);
}
}
}
console.log("");
console.log(
`Final result: ${total} total, ${pass} pass (with ${passOverride} overridden), ${fail} fail, ${skip} skip`
);
if (fail) {
process.exit(1);
}
},
(err) => {
console.error(err);
console.error("FAILURE RUNNING SCRIPT");
console.error("Testing artifacts are left in script-runner/ folder");
}
);
-162
View File
@@ -1,162 +0,0 @@
#!/usr/bin/env bash
#
# Run one or more tests.
#
# Command-line usage to run all tests.
#
# ./run-tests
#
# To run only one test, run "tests/test-name".
#
# Usage within a test as a template. Source run-tests to get functions, export
# any necessary variables, then call runTest.
#
# #!/usr/bin/env bash
# cd "${0%/*}" || exit 1
# . ../run-tests
#
# export template="This is a template"
# export expected="This is a template"
# runTest
#
# When used within the test, you control various aspects with environment
# variables or functions.
#
# - The content passed into mo is either the variable "$template" or the output
# of the function called template.
# - The expected result is either "$expected" or the function called expected.
# - The expected return code is "$returnCode" and defaults to 0.
# - The arguments to pass to mo is the array "${arguments[@]}" and defaults to ().
#
# When $MO_DEBUG is set to a non-empty value, the test does not run, but mo is
# simply executed directly. This allows for calling mo in the same manner as
# the test but does not buffer output nor expect the output to match the
# expected.
#
# When $MO_DEBUG_TEST is set to a non-empty value, the expected and actual
# results are shown using "declare -p" to provide an easier time seeing the
# differences, especially with whitespace.
testCase() {
echo "Input: $1"
echo "Expected: $2"
}
indirect() {
unset -v "$1"
printf -v "$1" '%s' "$2"
}
getValue() {
local name temp len hardSpace
name=$2
hardSpace=" "
if declare -f "$name" &> /dev/null; then
temp=$("$name"; echo -n "$hardSpace")
len=$((${#temp} - 1))
if [[ "${temp:$len}" == "$hardSpace" ]]; then
temp=${temp:0:$len}
fi
else
temp=${!name}
fi
local "$1" && indirect "$1" "$temp"
}
runTest() (
local testTemplate testExpected testActual hardSpace len testReturnCode testFail
hardSpace=" "
. ../mo
getValue testTemplate template
getValue testExpected expected
if [[ -n "${MO_DEBUG:-}" ]]; then
echo -n "$testTemplate" | mo ${arguments[@]+"${arguments[@]}"} 2>&1
return $?
fi
testActual=$(echo -n "$testTemplate" | mo ${arguments[@]+"${arguments[@]}"} 2>&1; echo -n "$hardSpace$?")
testReturnCode=${testActual##*$hardSpace}
testActual=${testActual%$hardSpace*}
testFail=false
if [[ "$testActual" != "$testExpected" ]]; then
echo "Failure"
echo "Expected:"
echo "$testExpected"
echo "Actual:"
echo "$testActual"
if [[ -n "${MO_DEBUG_TEST-}" ]]; then
declare -p testExpected
# Align the two declare outputs
echo -n " "
declare -p testActual
fi
testFail=true
fi
if [[ "$testReturnCode" != "$returnCode" ]]; then
echo "Expected return code $returnCode, but got $testReturnCode"
testFail=true
fi
if [[ "$testFail" == "true" ]]; then
return 1
fi
return 0
)
runTestFile() (
local file=$1
echo "Test: $file"
"$file"
)
runTests() (
PASS=0
FAIL=0
if [[ $# -gt 0 ]]; then
for TEST in "$@"; do
runTestFile "$TEST" && PASS=$((PASS + 1)) || FAIL=$((FAIL + 1))
done
else
cd "${0%/*}"
for TEST in tests/*; do
if [[ -f "$TEST" ]]; then
runTestFile "$TEST" && PASS=$((PASS + 1)) || FAIL=$((FAIL + 1))
fi
done
fi
echo ""
echo "Pass: $PASS"
echo "Fail: $FAIL"
if [[ $FAIL -gt 0 ]]; then
exit 1
fi
)
# Clear test related variables
template="Template not defined"
expected="Expected not defined"
returnCode=0
arguments=()
# If sourced, load functions.
# If executed, perform the actions as expected.
if [[ "$0" == "${BASH_SOURCE[0]}" ]] || [[ -z "${BASH_SOURCE[0]}" ]]; then
runTests ${@+"${@}"}
fi
-9
View File
@@ -1,9 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export thing="Works"
export template="{{&thing}}"
export expected="Works"
runTest
-21
View File
@@ -1,21 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export repo=( "resque" "hub" "rip" )
template() {
cat <<EOF
{{#repo}}
<b>{{@key}} - {{.}}</b>
{{/repo}}
EOF
}
expected() {
cat <<EOF
<b>0 - resque</b>
<b>1 - hub</b>
<b>2 - rip</b>
EOF
}
runTest
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
declare -A repo
# The order of the array elements can be shuffled depending on the version of
# Bash. Keeping this to a minimal set and alphabetized seems to help.
repo[hub]="Hub"
repo[rip]="Rip"
export repo
template() {
cat <<EOF
{{#repo}}
<b>{{@key}} - {{.}}</b>
{{/repo}}
EOF
}
expected() {
cat <<EOF
<b>hub - Hub</b>
<b>rip - Rip</b>
EOF
}
runTest
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export template="Wor{{!comment}}ks"
export expected="Works"
runTest
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
template() {
cat <<EOF
<h1>Today{{! ignore me
and this can
run through multiple
lines}}.</h1>
EOF
}
export expected=$'<h1>Today.</h1>\n'
runTest
@@ -1,8 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export template="Wor{{! comment }}ks"
export expected="Works"
runTest
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export thing="Wor"
export thing2="ks"
export template="{{thing thing2}}"
export expected="Works"
runTest
-9
View File
@@ -1,9 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export thing="Works"
export template="{{=| |=}}|thing|"
export expected="Works"
runTest
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export arguments=(--fail-on-file -- --help)
export returnCode=1
export template=""
export expected=$'ERROR: No such file: --help\n'
runTest
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export template='{{"Works"}}'
export expected="Works"
runTest
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
unset __NO_SUCH_VAR
export POPULATED="words"
export EMPTY=""
export arguments=(--fail-not-set)
export returnCode=1
template() {
cat <<EOF
Populated: {{POPULATED}};
Empty: {{EMPTY}};
Unset: {{__NO_SUCH_VAR}};
EOF
}
export expected=$'ERROR: Environment variable not set: __NO_SUCH_VAR\n'
runTest
@@ -1,13 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
failFunction() {
false
}
export arguments=(--fail-on-function)
export returnCode=1
export template="Fail on function? {{failFunction}}"
export expected=$'ERROR: Function failed with status code 1: "failFunction"\n'
runTest
@@ -1,18 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export USER=j.doe
export ADMIN=false
export arguments=(--false)
template() {
cat <<EOF
The user {{USER}} exists.
{{#ADMIN}}
WRONG - should not be an admin.
{{/ADMIN}}
EOF
}
export expected=$'The user j.doe exists.\n'
runTest
@@ -1,18 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export USER=j.doe
export ADMIN=false
MO_FALSE_IS_EMPTY=yeppers
template() {
cat <<EOF
The user {{USER}} exists.
{{#ADMIN}}
WRONG - should not be an admin.
{{/ADMIN}}
EOF
}
export expected=$'The user j.doe exists.\n'
runTest
-16
View File
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export person=""
template() {
cat <<EOF
Shown.
{{#person}}
Never shown!
{{/person}}
EOF
}
export expected=$'Shown.\n'
runTest
@@ -1,2 +0,0 @@
first line
second line
@@ -1,2 +0,0 @@
>
>
@@ -1 +0,0 @@
{{multilineData}}
@@ -1 +0,0 @@
<strong>{{.}}</strong>
@@ -1,2 +0,0 @@
export A=from1
export B=from1
@@ -1,2 +0,0 @@
export B=from2
export C=from2
@@ -1,5 +0,0 @@
export VAR=value
export ARR=(1 2 3)
declare -A ASSOC_ARR
# Can not export associative arrays, otherwise they turn into indexed arrays
ASSOC_ARR=([a]=AAA [b]=BBB)
@@ -1,3 +0,0 @@
|
{{content}}
|
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export name=Willy
wrapped() {
# Wrapping 'cat' in a subshell eats the trailing whitespace
# The echo adds a newline, which is preserved.
echo "<b>$(cat)</b>"
}
template() {
cat <<EOF
{{#wrapped}}
{{name}} is awesome.
{{/wrapped}}
... this is the last line.
EOF
}
# We don't expect {{name}} to be changed. The function returns whatever content
# that should be the result. There is a separate test where the function handles
# parsing mustache tags.
export expected=$'<b> {{name}} is awesome.</b>\n... this is the last line.\n'
runTest
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export planet=Earth
lambda() {
local content
content=$(cat)
mo::parse content "$content{{planet}} => |planet|$content"
echo -n "$content"
}
export template="{{= | | =}}<|#lambda|-|/lambda|>"
export expected="<-{{planet}} => Earth->"
runTest
-35
View File
@@ -1,35 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export name=Willy
MO_ALLOW_FUNCTION_ARGUMENTS=true
pipeTo() {
cat | "$1"
}
testArgs() {
printf "%d" "$#"
# Display all arguments
printf " %q" ${@+"$@"}
}
template() {
cat <<EOF
No args: {{testArgs}} - done
One arg: {{testArgs 'one'}} - done
Getting name in a string: {{testArgs {"The name is " name}}} - done
Reverse this: {{#pipeTo "rev"}}abcde{{/pipeTo "rev"}}
EOF
}
expected() {
cat <<EOF
No args: 0 '' - done
One arg: 1 one - done
Getting name in a string: 1 The\ name\ is\ Willy - done
Reverse this: edcba
EOF
}
runTest
@@ -1,42 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
testArgs() {
local args
# shellcheck disable=SC2031
args=$(declare -p MO_FUNCTION_ARGS)
# The output from declare -p could look like these
# declare -a MO_FUNCTION_ARGS=([0]="one")
# declare -ax MO_FUNCTION_ARGS='([0]="one")'
# Trim leading declare statement and variable name
args="${args#*=}"
# If there are any quotes, remove them. The function arguments will always
# be an array.
if [[ "${args:0:1}" == "'" ]]; then
args=${args#\'}
args=${args%\'}
fi
echo -n "$args"
}
template() {
cat <<EOF
No args: {{testArgs}} - done
One arg: {{testArgs 'one'}} - done
Multiple arguments: {{testArgs 'aa' 'bb' 'cc' 'x' "" '!' '{[_.|' }} - done
Evil: {{testArgs bla; cat /etc/issue}} - done
EOF
}
expected() {
cat <<EOF
No args: () - done
One arg: ([0]="one") - done
Multiple arguments: ([0]="aa" [1]="bb" [2]="cc" [3]="x" [4]="" [5]="!" [6]="{[_.|") - done
Evil: ([0]="" [1]="" [2]="") - done
EOF
}
runTest
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export name=Willy
wrapped() {
local content
# Wrapping 'cat' in a subshell eats the trailing whitespace
content="<b>$(cat)</b>"
# Parse the content using mustache
mo::parse content "$content"
# The echo adds a newline, which is preserved.
echo "$content"
}
template() {
cat <<EOF
{{#wrapped}}
{{name}} is awesome.
{{/wrapped}}
... this is the last line.
EOF
}
export expected=$'<b> Willy is awesome.</b>\n... this is the last line.\n'
runTest
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export STR=abc
export DATA=(111 222)
template() {
cat <<EOF
Issue #7
{{STR}}
{{#DATA}}
Item: {{.}}
String: {{STR}}
{{/DATA}}
EOF
}
expected() {
cat <<EOF
Issue #7
abc
Item: 111
String: abc
Item: 222
String: abc
EOF
}
runTest
-101
View File
@@ -1,101 +0,0 @@
#!/usr/bin/env bash
cd "${0%/*}" || exit 1
. ../run-tests
export arguments=(--help)
expected() {
cat <<'EOF'
Mo is a mustache template rendering software written in bash. It inserts
environment variables into templates.
Simply put, mo will change {{VARIABLE}} into the value of that
environment variable. You can use {{#VARIABLE}}content{{/VARIABLE}} to
conditionally display content or iterate over the values of an array.
Learn more about mustache templates at https://mustache.github.io/
Simple usage:
mo [OPTIONS] filenames...
Options:
--allow-function-arguments
Permit functions to be called with additional arguments. Otherwise,
the only way to get access to the arguments is to use the
MO_FUNCTION_ARGS environment variable.
-d, --debug
Enable debug logging to stderr.
-u, --fail-not-set
Fail upon expansion of an unset variable. Will silently ignore by
default. Alternately, set MO_FAIL_ON_UNSET to a non-empty value.
-x, --fail-on-function
Fail when a function returns a non-zero status code instead of
silently ignoring it. Alternately, set MO_FAIL_ON_FUNCTION to a
non-empty value.
-f, --fail-on-file
Fail when a file (from command-line or partial) does not exist.
Alternately, set MO_FAIL_ON_FILE to a non-empty value.
-e, --false
Treat the string "false" as empty for conditionals. Alternately,
set MO_FALSE_IS_EMPTY to a non-empty value.
-h, --help
This message.
-s=FILE, --source=FILE
Load FILE into the environment before processing templates.
Can be used multiple times. The file must be a valid shell script
and should only contain variable assignments.
-o=DELIM, --open=DELIM
Set the opening delimiter. Default is "{{".
-c=DELIM, --close=DELIM
Set the closing delimiter. Default is "}}".
-- Indicate the end of options. All arguments after this will be
treated as filenames only. Use when filenames may start with
hyphens.
Mo uses the following environment variables:
MO_ALLOW_FUNCTION_ARGUMENTS - When set to a non-empty value, this allows
functions referenced in templates to receive additional options and
arguments.
MO_CLOSE_DELIMITER - The string used when closing a tag. Defaults to "}}".
Used internally.
MO_CLOSE_DELIMITER_DEFAULT - The default value of MO_CLOSE_DELIMITER. Used
when resetting the close delimiter, such as when parsing a partial.
MO_CURRENT - Variable name to use for ".".
MO_DEBUG - When set to a non-empty value, additional debug information is
written to stderr.
MO_FUNCTION_ARGS - Arguments passed to the function.
MO_FAIL_ON_FILE - If a filename from the command-line is missing or a
partial does not exist, abort with an error.
MO_FAIL_ON_FUNCTION - If a function returns a non-zero status code, abort
with an error.
MO_FAIL_ON_UNSET - When set to a non-empty value, expansion of an unset env
variable will be aborted with an error.
MO_FALSE_IS_EMPTY - When set to a non-empty value, the string "false" will
be treated as an empty value for the purposes of conditionals.
MO_OPEN_DELIMITER - The string used when opening a tag. Defaults to "{{".
Used internally.
MO_OPEN_DELIMITER_DEFAULT - The default value of MO_OPEN_DELIMITER. Used
when resetting the open delimiter, such as when parsing a partial.
MO_ORIGINAL_COMMAND - Used to find the `mo` program in order to generate a
help message.
MO_PARSED - Content that has made it through the template engine.
MO_STANDALONE_CONTENT - The unparsed content that preceeded the current tag.
When a standalone tag is encountered, this is checked to see if it only
contains whitespace. If this and the whitespace condition after a tag is
met, then this will be reset to $'\n'.
MO_UNPARSED - Template content yet to make it through the parser.
Mo is under a MIT style licence with an additional non-advertising clause.
See LICENSE.md for the full text.
This is open source! Please feel free to contribute.
https://github.com/tests-always-included/mo
MO_VERSION=3.0.7
EOF
}
runTest

Some files were not shown because too many files have changed in this diff Show More