https://github.com/caltechlibrary/codemeta-pandoc-examples

This repository describes how to generate a CITATION.cff, about.md and installer.sh from a codemeta.json file using Pandoc.

https://github.com/caltechlibrary/codemeta-pandoc-examples

Science Score: 52.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
    Organization caltechlibrary has institutional domain (www.library.caltech.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary

Keywords

citation-cff codemeta installer-automation installer-script pandoc pandoc-templates
Last synced: 5 months ago · JSON representation ·

Repository

This repository describes how to generate a CITATION.cff, about.md and installer.sh from a codemeta.json file using Pandoc.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 5
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Archived
Topics
citation-cff codemeta installer-automation installer-script pandoc pandoc-templates
Created almost 3 years ago · Last pushed 11 months ago
Metadata Files
Readme License Citation Codemeta

README.md

Codemeta + Pandoc Examples

This has been replaced by https://github.com/SciCodes/somef-core

In this repository you see three examples of using Pandoc, Pandoc templates and codemeta.json to create an about page, a CITATION.cff and an installer.sh file.

Generating a CITATION.cff

The codemeta.json file can be use to generate a CITATION.cff file using the Pandoc template codemeta-cff.tmpl.

~~~shell echo '' | pandoc -s --metadata title='Citation' \ --metadata-file codemeta.json \ --template codemeta-cff.tmpl \ >CITATION.cff ~~~

Generating an about page

Like CITATION.cff we can generate a standard about page, about.md from our codemeta.json using the Pandoc template codemeta-about.tmpl.

~~~shell echo '' | pandoc -s --metadata title='About' \ --metadata-file codemeta.json \ --template codemeta-about.tmpl \ >about.md ~~~

Generating version.sql

If you're building a Postgres+PostgREST application it is nice to have an end point the shows the name and version of the web application you are building. This can be done with the codemeta-version-sql.tmpl Pandoc template.

~~~shell echo '' | pandoc -s metadata title='Version Info' \ --metadata-file codemeta.json \ --template codemete-version-sql.tmpl \ >version.sql ~~~

Generating an installer.sh

The nice thing about the Pandoc approach is you can also use it as a shell script generator. Today (2023) many software tools[1] developers use have installation instructions like

~~~shell curl https://caltechlibrary.github.io/datatools/installer.sh | sh ~~~

With a single POSIX shell installer script you easily install your tools on macOS and Linux.

The codemeta.json file provides much of what is needed to generate the installer script from codemeta-installer.tmpl. There are three addition Pandoc metadata variables needed not explicitly found in the codemeta.json. The installer script expects to use a Zip file as an q0Additionally you need to name the zip archive of the content to be installed needs to be predictably named.

To have Pandoc generate a workable installer script requires to parts. First the name of your installation zip files need to be predictable.

Secondly the codemeta-installer.tmpl file needs to know some metadata inorder for the generated script to be runable.

The [codemeta.json] file provides much of the information needed to render our installer.sh. Our template, does make some specific assumptions

  • You've installation files are in a zip archive
  • There hosted under the GitHub in the releases directory for your repository
  • The name of the zip file is in the form of <PACKAGE>-v<VERSION>-<OS_NAME>-<ARCHITECTURE>.zip
  • The version number in the codemeta.json file does NOT have a leading 'v'
  • curl is available on the machine where you want to install the software and it has a network connection

PACKAGE : This would be the name of your Git repository, e.g. datatools

VERSION : This would be the version number without the leading "v", e.g. "0.0.1"

OS_NAME : would be "macOS", "Linux" or "Windows"

MACHINE-TYPE : This would be what is reported by the command uname -m

Rendering the installer.sh file can be done with the following Pandoc command.

~~~ echo '' | pandoc -s --metadata title='Installer' \ --metadata-file codemeta.json \ --template installer.sh ~~~

If you host this installer script can then be uploaded to your website. The curl command would be of the form

~~~ curl /installer.sh | sh ~~~

[1]: Examples Rust with Rustup and Haskell's GHCup

Owner

  • Name: Caltech Library
  • Login: caltechlibrary
  • Kind: organization
  • Email: helpdesk@library.caltech.edu
  • Location: Pasadena, CA 91125

We manage the physical and digital holdings of the California Institute of Technology, provide services and training, and develop open-source software.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
type: software
title: "codemeta-pandoc-examples"
abstract: "This repository describes how to generate a CITATION.cff,
about.md and installer.sh from a codemeta.json file using Pandoc."
authors:
  - family-names: Doiel
    given-names: R. S.
    orcid: "https://orcid.org/0000-0003-0900-6903"



repository-code: "git+https://github.com/caltechlibrary/codemeta-pandoc-examples"
version: 0.0.4
license-url: "https://caltechlibrary.github.io/codemeta-pandoc-examples/LICENSE"
keywords: [ "codemeta", "pandoc", "templates" ]

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "license": "https://caltechlibrary.github.io/codemeta-pandoc-examples/LICENSE",
  "codeRepository": "git+https://github.com/caltechlibrary/codemeta-pandoc-examples",
  "dateCreated": "2023-07-24",
  "issueTracker": "https://github.com/caltechlibrary/codemeta-pandoc-examples/issues",
  "name": "codemeta-pandoc-examples",
  "version": "0.0.4",
  "description": "This repository describes how to generate a CITATION.cff, about.md and installer.sh from a codemeta.json file using Pandoc.",
  "applicationCategory": "application installer",
  "developmentStatus": "concept",
  "funder": {
    "@type": "Organization",
    "name": "Caltech Library"
  },
  "keywords": [
    "codemeta",
    "pandoc",
    "templates"
  ],
  "programmingLanguage": [
    "pandoc templates"
  ],
  "operatingSystem": [
    "Linux",
    "macOS",
    "Windows"
  ],
  "softwareRequirements": [
    "Pandoc >= 3",
    "GNU Make"
  ],
  "relatedLink": [
    "https://codemeta.github.io/",
    "https://codemeta.github.io/codemeta-generator/"
  ],
  "author": [
    {
      "@type": "Person",
      "@id": "https://orcid.org/0000-0003-0900-6903",
      "givenName": "R. S.",
      "familyName": "Doiel",
      "email": "rsdoiel@caltech.edu",
      "affiliation": {
        "@type": "Organization",
        "name": "Caltech Library"
      }
    }
  ]
}

GitHub Events

Total
  • Watch event: 1
  • Push event: 1
Last Year
  • Watch event: 1
  • Push event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels