~nytpu/dbc-scheme

76e749cad14afe5f584762e248916d5d1ef36125 — nytpu 2 years ago
initial commit
8 files changed, 168 insertions(+), 0 deletions(-)

A .editorconfig
A .gitignore
A README.md
A VERSION
A contracts-test.scm
A contracts.scm
A contracts.sld
A package.sh
A  => .editorconfig +16 -0
@@ 1,16 @@
# https://editorconfig-specification.readthedocs.io/
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2

[*.{md,yml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

A  => .gitignore +2 -0
@@ 1,2 @@
/nytpu-contracts-*.tgz
/contracts.log

A  => README.md +67 -0
@@ 1,67 @@
# `(nytpu contracts)` — Design by Contracts for R7RS Scheme

TODO


## Features

TODO


## Installing

Binaries can be downloaded from blah blah blah.


## Compiling
### Requirements

- POSIX-compatible sh(1).
- POSIX-compatible make(1).  Most makes (including GNU Make and BSD Make)
  support the POSIX standard.
- C compiler and libc supporting the C99 and POSIX.1-2001 standard.


### Building

    git clone https://git.sr.ht/~nytpu/dbc-scheme && cd dbc-scheme
    ./configure
    make
    sudo make install

See `./configure -h` for available options.


## Contributing

The upstream URL of this project is <https://git.sr.ht/~nytpu/dbc-scheme>.
Send suggestions, bugs, patches, and other contributions to
<~nytpu/public-inbox@lists.sr.ht>.  For help sending a patch through email, see
<https://git-send-email.io>.  You can browse the list archives at
<https://lists.sr.ht/~nytpu/public-inbox>.

If you have a very large set of changes, please use
[`git request-pull`](https://git-scm.com/docs/git-request-pull) rather than
sending a large patchset.


## See Also

- [dbc-scheme](dbc-scheme.1)


## Copyright

Copyright (C) 2022 nytpu <alex [at] nytpu.com>.

Licensed under the terms of the Mozilla Public License version 2.0.  You can view a copy of
the GNU AGPL in [LICENSE](LICENSE) or at <https://www.mozilla.org/en-US/MPL/2.0/>.


## Standards

The build system and source code all conform to IEEE Std 1003.1-2001
("POSIX.1") and ISO/IEC 9899:1999 ("ISO C99") in all cases where the said
standards are applicable.

The documentation conforms to CommonMark Version 0.30 or mandoc Version 1.14.

A  => VERSION +1 -0
@@ 1,1 @@
0.0.1

A  => contracts-test.scm +12 -0
@@ 1,12 @@
#!/usr/bin/env chibi-scheme
;;; dbc-test.scm --- tests for (nytpu contracts)
;;;
;;; Copyright (c) 2022 nytpu <alex [at] nytpu.com>
;;; SPDX-License-Identifier: MPL-2.0
;;; Home Page: <https://git.sr.ht/~nytpu/dbc-scheme>

(import (scheme base)
        (srfi 64)
        (nytpu contracts))

;; TODO

A  => contracts.scm +7 -0
@@ 1,7 @@
;;; contracts.scm --- R7RS Design by Contracts
;;;
;;; Copyright (c) 2022 nytpu <alex [at] nytpu.com>
;;; SPDX-License-Identifier: MPL-2.0
;;; Home Page: <https://git.sr.ht/~nytpu/dbc-scheme>

;; TODO

A  => contracts.sld +11 -0
@@ 1,11 @@
;;; contracts.sld --- R7RS Design by Contracts
;;;
;;; Copyright (c) 2022 nytpu <alex [at] nytpu.com>
;;; SPDX-License-Identifier: MPL-2.0
;;; Home Page: <https://git.sr.ht/~nytpu/dbc-scheme>

;;> TODO
(define-library (nytpu contracts)
  #;(export)
  #;(import)
  (include "contracts.scm"))

A  => package.sh +52 -0
@@ 1,52 @@
#!/bin/sh
# package.sh --- workaround for snow-chibi's docs generator being broken
#
# Copyright (c) 2021-2022 nytpu <alex [at] nytpu.com>
# SPDX-License-Identifier: MPL-2.0
# Home Page: <https://git.sr.ht/~nytpu/dbc-scheme>
set -eu

## change these
libname="nytpu.contracts"
author="nytpu <alex@nytpu.com>"
libfile="contracts.sld"
license="MPL-2.0"
test_file="contracts-test.scm"
description="Design by Contracts for R7RS"
log_file="contracts.log"

# this first build will NOT have documentation built for some reason!
printf "Building broken package\n"
snow-chibi package --license="${license}" --test="${test_file}" \
  --description="${description}" --authors="${author}" \
  --version-file="VERSION" "${libfile}"
packagename="$(echo "${libname}" | tr '.' '-')-"$(cat VERSION)".tgz"
# once it's installed, then repackaging will properly generate documentation
printf "Installing broken package\n"
snow-chibi install "${packagename}"

# remove the broken package
rm "${packagename}"

# generate proper documenation
docname="$(echo "${libname}" | tr '.' '/').html"
mkdir -p "$(dirname "${docname}")"
chibi-doc -h "${libname}" > "${docname}"

printf "Building proper package\n"
snow-chibi package --license="${license}" --test="${test_file}" \
  --description="${description}" --authors="${author}" --doc="${docname}" \
  --version-file="VERSION" "${libfile}"

# remove generated cruft
rm "${docname}"
rmdir -p "$(dirname "${docname}")"
rm "${log_file}"

# remove broken old package
printf "Removing broken package\n"
snow-chibi remove "${libname}"

printf "Upload package to Snow (y/N)? "
read answer
[ "$answer" != "${answer#[Yy]}" ] && snow-chibi upload "${packagename}"