Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to keep_a_changelog_file to avoid crate conflict #7

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.gitignore

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

12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
[package]
name = "keep_a_changelog"
name = "keep_a_changelog_file"
version = "0.1.0"
description = "Read and write changelog files using the Keep a Changelog format"
repository = "https://github.com/heroku/keep_a_changelog"
license = "Apache-2.0"
keywords = ["keep-a-changelog", "changelog", "serialize", "deserialize"]
categories = ["parser-implementations", "parsing"]
edition = "2021"
rust-version = "1.74"
exclude = [
".idea",
".github",
".editorconfig"
]

[dependencies]
chrono = "0.4"
Expand Down
79 changes: 48 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# Keep a Changelog Serializer/Deserializer
# Keep a Changelog File

[![Build Status]][ci] [![MSRV]][install-rust]

[Build Status]: https://img.shields.io/github/actions/workflow/status/heroku/keep_a_changelog/ci.yml?branch=main
[ci]: https://github.com/heroku/keep_a_changelog/actions/workflows/ci.yml?query=branch%3Amain
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install

A serializer and deserializer for changelogs written in [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
A serializer and deserializer for changelog files written in [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## Install

```sh
cargo add --git https://github.com/heroku/keep_a_changelog
cargo add keep_a_changelog_file
```

## Usage

```rust
use keep_a_changelog::{Changelog, ChangeGroup, PromoteOptions};
use keep_a_changelog_file::{Changelog, ChangeGroup, PromoteOptions, ReleaseLink, ReleaseVersion};

// parse a changelog
let mut changelog: Changelog = "\
fn example_usage() {
// parse a changelog
let mut changelog: Changelog = "\
# Changelog

All notable changes to this project will be documented in this file.
Expand All @@ -30,24 +27,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]"
.parse()
.unwrap();

// modify the unreleased section
changelog.unreleased.add(
ChangeGroup::Fixed,
"Fixed bug in feature X"
);
changelog.unreleased.add(
ChangeGroup::Deprecated,
"Feature Y will be removed from the next major release"
);

// promote the unreleased changes to a new release
let promote_options = PromoteOptions::new("0.0.1".parse().unwrap())
.with_link("https://github.com/my-org/my-project/releases/v0.0.1".parse().unwrap());
changelog.promote_unreleased(&promote_options).unwrap();

// output the changelog
println!("{}", changelog);
.parse()
.unwrap();

// modify the unreleased section
changelog
.unreleased
.add(ChangeGroup::Fixed, "Fixed bug in feature X");
changelog.unreleased.add(
ChangeGroup::Deprecated,
"Feature Y will be removed from the next major release",
);

// promote the unreleased changes to a new release
let release_version = "0.0.1".parse::<ReleaseVersion>().unwrap();
let release_link = "https://github.com/my-org/my-project/releases/v0.0.1"
.parse::<ReleaseLink>()
.unwrap();
changelog
.promote_unreleased(&PromoteOptions::new(release_version).with_link(release_link))
.unwrap();

// output the changelog
println!("{changelog}");
}
```

[Build Status]: https://img.shields.io/github/actions/workflow/status/heroku/keep_a_changelog/ci.yml?branch=main

[ci]: https://github.com/heroku/keep_a_changelog/actions/workflows/ci.yml?query=branch%3Amain

[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg

[install-rust]: https://www.rust-lang.org/tools/install

[Docs]: https://img.shields.io/docsrs/keep_a_changelog_file

[docs.rs]: https://docs.rs/keep_a_changelog/latest/keep_a_changelog_file/

[Latest Version]: https://img.shields.io/crates/v/keep_a_changelog_file.svg

[crates.io]: https://crates.io/crates/keep_a_changelog_file
2 changes: 1 addition & 1 deletion tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::unwrap_used)]
#![allow(unused_crate_dependencies)]

use keep_a_changelog::{ChangeGroup, Changelog, PromoteOptions};
use keep_a_changelog_file::{ChangeGroup, Changelog, PromoteOptions};

#[test]
fn adding_unreleased_changes() {
Expand Down