CodeMeta Tools provides a
simple command line tool called cmt
that can be used to
generate project files and artifacts. It also provides a tool called
cme
to edit and manage the CodeMeta file. The project
focuses on leveraging CodeMeta data, directory name and Git repo
information for building and release software written in Python, Go,
JavaScript or TypeScript. It was motivated by the practices in Caltech
Library’s Digital Development Group.
The tools are intended to be run from the project root directory.
cmt
expects the file path of your codemeta.json file as
well as one or more target files to be generated. The target file’s
extension determines the generated content. The tool can generate the
following project files based on the contents of the codemeta.json file.
cme
expects the file path of your codemeta.json file and
optionally the attributes of the CodeMeta object you wish to manage.
cme
is used to create and manage “codemeta.json”.
cmt
is used to generate the following.
cme
is for managing your “codemeta.json” file. If only
the “codemeta.json” file is provided then you’ll be in an “interactive”
mode. You will be prompted for each top level attribute. You either
press enter and accept the current value or replace the value. For
complex attributes like “author”, and “keywords”1 you
use YAML notation followed by a line containing only a period to
indicate completion. If you enter only the line with a period then the
current value remains. Here’s an example of setting up to use
cme
to create and edit the “codemeta.json” file.
cme codemeta.json
The will let you iterate over the top level CodeMeta object attributes. For multi line or list attributes your favorite editor will be used to create or update the values.
Here’s an example of updating the version and
.releaseNotes
attributes but instead of the direct input
you edit the value using the Micro Editor2.
cme codemeta.json version releaseNotes -e
Since the version is short you’ll just be prompted to type in a new version string. You release notes maybe longer so for that you’ll drop into your editor.
The cmt
command can render a version file suitable for
TypeScript, JavaScript, Go and Python projects. The version file will
contain version name, release hash, release date and license
information. Here’s an example of rendering a “version.ts” for the
CMTools project.
cmt codemeta.json version.ts
For Go you would do,
cmt codemeta.json version.go
and for Python.
cmt codemeta.json version.py
The codemeta file contains sufficient information to rendering an about page for your project. Rendering a Markdown document for that purpose can be done with the following.
cmt codemeta.json about.md
A handlebars template can be generated from the codemeta.json as well.
cmt codemeta.json page.hbs
This Handlebars template then can be used along with a handlebars template script to build the website from your repository.
A Pandoc template can be generated from the codemeta.json as well.
cmt codemeta.json page.tmpl
For a full list of complex fields see the user manual
for cme
.↩︎
You need to have Micro Editor installed for this to work.↩︎