Skip to content

Commit

Permalink
Do some housekeeping in preparation for release
Browse files Browse the repository at this point in the history
*   Increment version to v0.2.0.
*   Flesh out the Changelog.
*   Switch to the `theory/changelog-version-notes-action` to generate
    release notes.
*   Make the `meta` module public.
*   Make the `valid` module public and remove its importation from the
    crate root.
*   Move the validation example to the `valid` module.
*   Add docs and examples to the most important `try_from` functions in
    the `meta` module.
*   Create a first accessor, `license()`, used by one of the examples
    because none of the fields are public. Is this the way to expose
    them?
*
  • Loading branch information
theory committed Sep 10, 2024
1 parent 71afca0 commit 1827ecc
Show file tree
Hide file tree
Showing 11 changed files with 227 additions and 229 deletions.
174 changes: 0 additions & 174 deletions .ci/mknotes

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ jobs:
exit 1
fi
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
- name: Generate Release Changes
run: make target/release-notes.md
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
- name: Generate Release Notes
id: notes
uses: theory/changelog-version-notes-action@v0
with: { version: "v${{ env.VERSION }}" }
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
name: "Relelase ${{ env.VERSION }}"
files: "pgxn_meta-*"
body_path: target/release-notes.md
body_path: ${{ steps.notes.outputs.file }}
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,32 @@ All notable changes to this project will be documented in this file. It uses the
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
"Semantic Versioning 2.0.0"

## [Unreleased] — Date TBD
## [v0.2.0] — Date TBD

### ⚡ Improvements

* Added the [meta module], which loads v1 and v2 spec files, converts v1
metadata to v2, and merges multiple files.

### 🪲 Bug Fixes

* Changed the v1 validator to allow `http` as well as `https` in the
`meta-spec` object's `url` field, as a lot of older `META.json` files use
it.

### 📔 Notes

* Moved the validation functionality to the [valid module].

### 📚 Documentation

* Updated the `v2` link in all docs to point to the [pull request], since it
hasn't been merged and published yet.

[v0.2.0]: https://github.com/pgxn/meta/compare/v0.1.0...v0.2.0
[meta module]: https://docs.rs/pgxn_meta/meta/
[valid module]: https://docs.rs/pgxn_meta/meta/
[pull request]: https://github.com/pgxn/rfcs/pull/3 "pgxn/rfcs#3 Meta Spec v2"

## [v0.1.0] — 2024-08-08

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgxn_meta"
version = "0.1.0"
version = "0.2.0"
description = "The PGXN distribution metadata specification"
repository = "https://github.com/pgxn/pgxn-meta-spec"
documentation = "https://docs.rs/pgxn_meta/"
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ docs: target/doc/pgxn_meta/index.html
target/doc/pgxn_meta/index.html: $(shell find . -name \*.rs)
cargo doc

target/release-notes.md: CHANGELOG.md .ci/mknotes Cargo.toml
@./.ci/mknotes -f $< -r https://github.com/$(or $(GITHUB_REPOSITORY),pgxn/meta) -o $@
VERSION = $(shell perl -nE '/^version\s*=\s*"([^"]+)/ && do { say $$1; exit }' Cargo.toml)
.PHONY: release-notes # Show release notes for current version (must have `mknotes` in PATH).
release-notes: CHANGELOG.md
mknotes -v v$(VERSION) -f $< -r https://github.com/$(or $(GITHUB_REPOSITORY),pgxn/meta)
43 changes: 6 additions & 37 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,17 @@
/*!
PGXN Metadata validation.
This crate uses JSON Schema to validate PGXN Meta Spec `META.json` files.
It supports both the [v1] and [v2] specs.
# Example
``` rust
use std::{path::PathBuf, error::Error};
use serde_json::json;
use pgxn_meta::*;
let meta = json!({
"name": "pair",
"abstract": "A key/value pair data type",
"version": "0.1.8",
"maintainers": [{ "name": "theory", "email": "[email protected]" }],
"license": "PostgreSQL",
"contents": {
"extensions": {
"pair": {
"sql": "sql/pair.sql",
"control": "pair.control"
}
}
},
"meta-spec": { "version": "2.0.0" }
});
let mut validator = Validator::new();
assert!(validator.validate(&meta).is_ok());
# Ok::<(), Box<dyn Error>>(())
```
This crate uses JSON Schema to validate and inspect the PGXN `META.json`
files. It supports both the [v1] and [v2] specs.
[v1]: https://rfcs.pgxn.org/0001-meta-spec-v1.html
[v2]: https://rfcs.pgxn.org/0003-meta-spec-v2.html
[v2]: https://github.com/pgxn/rfcs/pull/3
*/

mod util;
mod valid;
pub use valid::{ValidationError, Validator};
mod meta;
// pub use meta::*;
pub mod meta;
mod util; // private utilities
pub mod valid;

#[cfg(test)]
mod tests;
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
process::ExitCode,
};

use pgxn_meta::Validator;
use pgxn_meta::valid::Validator;
use serde_json::Value;

// Minimal main function; logical is all in run.
Expand Down
Loading

0 comments on commit 1827ecc

Please sign in to comment.