Packaging
Snowballs are created with the
(define-library (feeley earley) (export make-parser parse->parsed? parse->trees parse->nb-trees tree-display) (import (scheme r5rs)) (include "tree.scm") (include "earley.scm"))
This could then be packaged with:
snow-chibi package earley.sld
This will use your local username as the author, but provide no other information. We can add this with options:
snow-chibi package --version=1.0 --authors="Marc Feeley" \ --maintainers="Me <me@myself.com>" earley.sld
We don't know the license or we'd include that with the
snow-chibi package --version=1.0 --authors="Marc Feeley" \ --maintainers="Me <me@myself.com>" --doc=earley.ps \ --description="Earley Parser for Context-Free Grammars" \ earley.sld
Any format (ps, pdf, html) is fine, as we simply include this file in the snowball and provide a link to it, however for ease of browsing from the public repo html is preferred. If you want to embed the docs in the code in a literate-programming fashion, you can also use the --doc-from-scribble option, which treats any line beginning with ";;>"
as docs in scribble syntax, using backslash instead of @ as the escape character. In this case we can infer the description from the first sentence of documentation.
Finally, a well maintained library should provide tests. You can include these with the (append-to-last -test)
as the (feeley earley-test)
. This is especially handy when packaging multiple libraries together.
Putting all of this together we have:
snow-chibi package --version=1.0 --authors="Marc Feeley" \ --maintainers="Me <me@myself.com>" --doc=earley.ps \ --description="Earley Parser for Context-Free Grammars" \ --test=earley-test.scm earley.sld
The (chibi app)
to manage options and configuration, which means you can also specify defaults for any of these options in your "~/.snow/config.scm" file. If we put this all together, converting the docs to scribble, adding a VERSION file, and creating the (feeley earley-test)
library, with the following config.scm:
((command (package (authors "Me <me@myself.com>") (doc-from-scribble #t) (version-file "VERSION") (test-library (append-to-last -test)))))
then the command becomes simply:
snow-chibi package --authors="Marc Feeley" earley.sld
Publishing
Once we have a package the next step is to share it. First generate a key with:
snow-chibi gen-key
which will ask you for your email address and a password, then register it with:
snow-chibi reg-key
You should receive an email with a link to complete the registration, after which you're ready to upload. In this case we can upload our package with:
and we're done!snow-chibi upload feeley-earley-1.0.tgz