34fffefe4a4eaf865100c3d4539f3c0476e21fa8 — dieggsy 3 years ago b8cbfdb 0.3.3
Change program license options and license location

- Also, a bit of code cleanup
- Update docs
3 files changed, 48 insertions(+), 43 deletions(-)

M chalk-bin.scm
M chalk.release-info
M chalk.svnwiki
M chalk-bin.scm => chalk-bin.scm +42 -41
@@ 57,10 57,13 @@
          (required #f)
          (single-char #\T)
          (value (required FILE)))
    (license "Whether to insert a license"
    (no-license "Don't insert a license file"
                (required #f)
                (single-char #\L))
    (license "File to use as license (defaults to LICENSE if unspecified)"
             (required #f)
             (single-char #\L)
             (value (optional FILE)))
             (single-char #\l)
             (value (required FILE)))
    (module-headers "Create === Module-name headers"
                    (required #f)
                    (single-char #\m))))

@@ 282,6 285,7 @@
(define outfile (alist-ref 'output pargs))
(define license (alist-ref 'license pargs))
(define no-license (alist-ref 'no-license pargs))
(define head (alist-ref 'head pargs))
(define tail (alist-ref 'tail pargs))
(define prologue (alist-ref 'prologue pargs))

@@ 290,6 294,7 @@
                         (equal? (pathname-extension f) "egg"))
(define egg-name (if egg-file (pathname-file egg-file) #f))
(define egg-values (if egg-file (call-with-input-file egg-file (cut read <>)) '()))
(define release-file (if egg-name (make-pathname #f egg-name "release-info")))
(define ignore-egg (alist-ref 'ignore-egg pargs))
(define no-toc (alist-ref 'no-toc pargs))

@@ 312,12 317,8 @@
  (unless no-toc
    (printf "[[toc:]]\n"))
  (printf "== ~a\n" egg-name)
  (call-with-input-file egg-file
    (lambda (in)
      (let* ((values (read in))
             (synopsis (alist-ref 'synopsis values)))
        (when synopsis
          (printf "~a\n\n" (car synopsis)))))))
  (and-let* ((synopsis (alist-ref 'synopsis egg-values)))
    (printf "~a\n\n" (car synopsis))))

(when prologue
  (if (file-exists? prologue)

@@ 338,36 339,17 @@
      (warning "Epilogue file not found, skipping...")))

(unless (or ignore-egg (not egg-file))
  (call-with-input-file egg-file
    (lambda (in)
      (let* ((values (read in))
             (author (alist-ref 'author values))
             (maintainer (alist-ref 'maintainer values)))
        (when maintainer
          (printf "=== Maintainer\n")
          (printf "~a\n" (car maintainer)))
        (when author
          (printf "=== Author\n")
          (printf "~a\n" (car author))
          (when email
            (printf "~a\n" email))

(when license
  (let ((license-file (or (and (string? license)
    (if (file-exists? license-file)
          (printf "=== License\n")
          (call-with-input-file license-file
            (lambda (in)
              (let ((str (read-string #f in)))
                (printf str)
        (warning "License file not found, skipping..."))))
  (and-let* ((maintainer (alist-ref 'maintainer egg-values)))
    (printf "=== Maintainer\n")
    (printf "~a\n" (car maintainer)))
  (and-let* ((author (alist-ref 'author egg-values)))
    (printf "=== Author\n")
    (printf "~a\n" (car author))
    (when email
      (printf "~a\n" email)))

(unless (or ignore-egg ignore-release)
(unless (or ignore-egg (not egg-file) ignore-release)
  (if (file-exists? release-file)
        (printf "=== Version History\n")

@@ 392,11 374,30 @@
                                       (lambda (c)
                                         (or (char-whitespace? c)
                                             (char=? c #\;)))))))
                (loop (read-line in)))))))
                                             (char=? c #\;))))))))))))
                (loop (read-line in))))))
      (warning "release-info file not found, skipping...")))

(let* ((egg-license (alist-ref 'license egg-values))
       (license-file (or license "LICENSE"))
       (license-exists (file-exists? license-file)))
  (when (or (and (not ignore-egg) egg-license)
            (and (not no-license) license-exists))
    (printf "=== License\n"))
  (unless (or ignore-egg (not egg-file) (not egg-license))
    (printf "~a\n\n" (car egg-license)))
  (unless no-license
    (if license-exists
          (call-with-input-file license-file
            (lambda (in)
              (let loop ((line (read-line in)))
                (unless (eof-object? line)
                  (printf " ~a\n" line)
                  (loop (read-line in)))))))
        (warning "License file not found, skipping..."))))

(when tail
  (if (file-exists? tail)
      (call-with-input-file tail

M chalk.release-info => chalk.release-info +1 -0
@@ 1,5 1,6 @@
;; -*- mode: scheme -*-
(uri targz "https://code.dieggsy.com/chicken-{egg-name}/snapshot/chicken-{egg-name}-{egg-release}.tar.gz")
(release "0.3.3")
(release "0.3.2")
(release "0.3.1")
(release "0.3.0")

M chalk.svnwiki => chalk.svnwiki +5 -2
@@ 238,7 238,8 @@ Usage: chalk [OPTION]... [FILE]...
 -P, --prologue=FILE      File to add after synopsis
 -E, --epilogue=FILE      File to add before maintainer info
 -T, --tail=FILE          File to add to end of documentation
 -L, --license[=FILE]     Whether to insert a license
 -L, --no-license         Don't insert a license file
 -l, --license=FILE       File to use as license (defaults to LICENSE if unspecified)
 -m, --module-headers     Create === Module-name headers

@@ 256,7 257,9 @@ generating a version history section of the documentation, for example:

=== Full Example

Coming soon
See the [[https://code.dieggsy.com/icu/tree/|ICU egg source code]] and
[[https://wiki.call-cc.org/eggref/5/icu|documentation]] for a full example of a
project using chalk.

=== Author
Diego A. Mundo