chore: initial commit of ideas
This commit is contained in:
commit
5e095c9627
14 changed files with 2025 additions and 0 deletions
28
.editorconfig
Normal file
28
.editorconfig
Normal file
|
@ -0,0 +1,28 @@
|
|||
root = true
|
||||
["*"]
|
||||
charset = "utf-8"
|
||||
curly_bracket_next_line = true
|
||||
end_of_line = "lf"
|
||||
indent_brace_style = "K&R"
|
||||
indent_size = 4
|
||||
indent_style = "space"
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
["*.md"]
|
||||
max_line_length = "off"
|
||||
|
||||
["package.json"]
|
||||
indent_size = 2
|
||||
indent_style = "space"
|
||||
tab_width = 2
|
||||
|
||||
["{LICENSES/**,LICENSE}"]
|
||||
charset = "unset"
|
||||
end_of_line = "unset"
|
||||
indent_size = "unset"
|
||||
indent_style = "unset"
|
||||
insert_final_newline = "unset"
|
||||
trim_trailing_whitespace = "unset"
|
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake || use nix
|
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
.idea/
|
||||
|
||||
# nixago: ignore-linked-files
|
||||
/rustfmt.toml
|
||||
/treefmt.toml
|
||||
/.prettierrc.json
|
||||
/lefthook.yml
|
||||
/.conform.yaml
|
||||
# mfgames-project-setup: ignore-files
|
||||
/.direnv/
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
4
.prettierignore
Normal file
4
.prettierignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
# mfgames-project-setup: ignore-files
|
||||
/LICENSE.md
|
||||
/DCO.md
|
133
CODE_OF_CONDUCT.md
Normal file
133
CODE_OF_CONDUCT.md
Normal file
|
@ -0,0 +1,133 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact@mfgames.com.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
1049
Cargo.lock
generated
Normal file
1049
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
18
Cargo.toml
Normal file
18
Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "mfgames-conventional-commit"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
clap = { version = "4.4.10", features = ["derive"] }
|
||||
conventional-commit = "0.1.0"
|
||||
git2 = "0.18.2"
|
||||
glob = "0.3.1"
|
||||
log = "0.4.20"
|
||||
semver = "1.0.22"
|
||||
semver-bump-trait = "0.1.0"
|
||||
slog = "2.7.0"
|
||||
slog-stdlog = "4.1.1"
|
||||
slog-term = "2.9.0"
|
||||
tokio = { version="1.34.0", features = ["full"] }
|
34
DCO.md
Normal file
34
DCO.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
418
flake.lock
Normal file
418
flake.lock
Normal file
|
@ -0,0 +1,418 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_4": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_5": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_6": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_7": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_8": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_9": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mfgames-project-setup": {
|
||||
"inputs": {
|
||||
"nixago": "nixago",
|
||||
"nixago-exts": "nixago-exts_3",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709861835,
|
||||
"narHash": "sha256-vXuOnCnpm3ii728s9KyNrAwH0wZ6RvQwmN53H55GtdE=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "6ba1a8e9755ae03287457d5fe9bb3565f7421c4b",
|
||||
"revCount": 17,
|
||||
"type": "git",
|
||||
"url": "https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git"
|
||||
}
|
||||
},
|
||||
"nixago": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixago-exts": "nixago-exts",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1687381756,
|
||||
"narHash": "sha256-IUMIlYfrvj7Yli4H2vvyig8HEPpfCeMaE6+kBGPzFyk=",
|
||||
"owner": "jmgilman",
|
||||
"repo": "nixago",
|
||||
"rev": "dacceb10cace103b3e66552ec9719fa0d33c0dc9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jmgilman",
|
||||
"repo": "nixago",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago-exts": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixago": "nixago_2",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676070308,
|
||||
"narHash": "sha256-QaJ65oc2l8iwQIGWUJ0EKjCeSuuCM/LqR8RauxZUUkc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"rev": "e5380cb0456f4ea3c86cf94e3039eb856bf07d0b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago-exts_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixago": "nixago_3",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago",
|
||||
"nixago-exts",
|
||||
"nixago",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1655508669,
|
||||
"narHash": "sha256-BDDdo5dZQMmwNH/GNacy33nPBnCpSIydWFPZs0kkj/g=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"rev": "3022a932ce109258482ecc6568c163e8d0b426aa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago-exts_3": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_6",
|
||||
"nixago": "nixago_4",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676070308,
|
||||
"narHash": "sha256-QaJ65oc2l8iwQIGWUJ0EKjCeSuuCM/LqR8RauxZUUkc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"rev": "e5380cb0456f4ea3c86cf94e3039eb856bf07d0b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago-exts_4": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_8",
|
||||
"nixago": "nixago_5",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago-exts",
|
||||
"nixago",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1655508669,
|
||||
"narHash": "sha256-BDDdo5dZQMmwNH/GNacy33nPBnCpSIydWFPZs0kkj/g=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"rev": "3022a932ce109258482ecc6568c163e8d0b426aa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago-extensions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixago-exts": "nixago-exts_2",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago",
|
||||
"nixago-exts",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676070010,
|
||||
"narHash": "sha256-iYzJIWptE1EUD8VINAg66AAMUajizg8JUYN3oBmb8no=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"rev": "d480ba6c0c16e2c5c0bd2122852d6a0c9ad1ed0e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "rename-config-data",
|
||||
"repo": "nixago",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago_3": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago",
|
||||
"nixago-exts",
|
||||
"nixago",
|
||||
"nixago-exts",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1655405483,
|
||||
"narHash": "sha256-Crd49aZWNrpczlRTOwWGfwBMsTUoG9vlHDKQC7cx264=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"rev": "e6a9566c18063db5b120e69e048d3627414e327d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago_4": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_7",
|
||||
"nixago-exts": "nixago-exts_4",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago-exts",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676070010,
|
||||
"narHash": "sha256-iYzJIWptE1EUD8VINAg66AAMUajizg8JUYN3oBmb8no=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"rev": "d480ba6c0c16e2c5c0bd2122852d6a0c9ad1ed0e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "rename-config-data",
|
||||
"repo": "nixago",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixago_5": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_9",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago-exts",
|
||||
"nixago",
|
||||
"nixago-exts",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1655405483,
|
||||
"narHash": "sha256-Crd49aZWNrpczlRTOwWGfwBMsTUoG9vlHDKQC7cx264=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"rev": "e6a9566c18063db5b120e69e048d3627414e327d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixago",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1706098335,
|
||||
"narHash": "sha256-r3dWjT8P9/Ah5m5ul4WqIWD8muj5F+/gbCdjiNVBKmU=",
|
||||
"rev": "a77ab169a83a4175169d78684ddd2e54486ac651",
|
||||
"revCount": 554858,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.554858%2Brev-a77ab169a83a4175169d78684ddd2e54486ac651/018d46f0-798f-71dc-a8c5-4689c46f7d12/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1709884566,
|
||||
"narHash": "sha256-NSYJg2sfdO/XS3L8XN/59Zhzn0dqWm7XtVnKI2mHq3w=",
|
||||
"rev": "2be119add7b37dc535da2dd4cba68e2cf8d1517e",
|
||||
"revCount": 556557,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.556557%2Brev-2be119add7b37dc535da2dd4cba68e2cf8d1517e/018e2117-9198-79f3-9df4-4997fc00989b/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"mfgames-project-setup": "mfgames-project-setup",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
49
flake.nix
Normal file
49
flake.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||
mfgames-project-setup.url = "git+https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git";
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, mfgames-project-setup, ... }:
|
||||
let
|
||||
# Helpers for producing system-specific outputs
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
inherit system;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
in
|
||||
rec
|
||||
{
|
||||
# Set up the developer shell.
|
||||
devShells = forEachSupportedSystem ({ system, pkgs }:
|
||||
let
|
||||
project-config = mfgames-project-setup.lib.mkConfig {
|
||||
inherit system pkgs;
|
||||
contributorCovenant.enable = true;
|
||||
contributorCovenant.contact = "contact@mfgames.com";
|
||||
developerCertificateOfOrigin.enable = true;
|
||||
rust.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
# Shell
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
# Rust
|
||||
pkgs.rustup
|
||||
|
||||
# git2 crate
|
||||
pkgs.pkg-config
|
||||
pkgs.openssl
|
||||
]
|
||||
++ project-config.packages;
|
||||
|
||||
shellHook = project-config.shellHook;
|
||||
};
|
||||
});
|
||||
|
||||
# Formatting for the Nix files
|
||||
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
|
||||
};
|
||||
}
|
5
rust-toolchain.toml
Normal file
5
rust-toolchain.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[toolchain]
|
||||
channel = "1.76.0"
|
||||
components = [ "rustfmt" ]
|
||||
targets = [ "x86_64-unknown-linux-gnu" ]
|
||||
profile = "minimal"
|
204
src/commands/get.rs
Normal file
204
src/commands/get.rs
Normal file
|
@ -0,0 +1,204 @@
|
|||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use conventional_commit::ConventionalCommit;
|
||||
use git2::{string_array::StringArray, Oid, Repository};
|
||||
use semver::Version;
|
||||
use semver_bump_trait::SemverBump;
|
||||
use slog::{info, warn};
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
|
||||
/// Gets the current version based on commits.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct GetCommand {}
|
||||
|
||||
#[derive(Debug, Clone, PartialOrd, PartialEq)]
|
||||
enum VersionBump {
|
||||
None = 0,
|
||||
Patch = 1,
|
||||
Minor = 2,
|
||||
Major = 3,
|
||||
}
|
||||
|
||||
impl GetCommand {
|
||||
pub async fn run(&self, log: slog::Logger) -> Result<()> {
|
||||
// Figure out the path we are loading.
|
||||
let current_dir =
|
||||
"/home/dmoonfire/src/mfgames/mfgames-cil/src/MfGames.Nitride";
|
||||
info!(log, "using current directory {:?}", current_dir);
|
||||
|
||||
// Load the repository so we can walk through it.
|
||||
let repo = Repository::discover(current_dir)?;
|
||||
|
||||
// Load a map of all commits that are pointed to by a tag.
|
||||
let tag_prefix = "MfGames.Nitride-*";
|
||||
let tag_name_list = &repo.tag_names(Some(tag_prefix))?;
|
||||
let tag_map: HashMap<Oid, Version> =
|
||||
self.get_tag_map(&log, &repo, &tag_prefix, tag_name_list)?;
|
||||
|
||||
// Figure out the head.
|
||||
let head = repo.head()?;
|
||||
let head = head.resolve()?;
|
||||
let commit = head.peel_to_commit()?;
|
||||
|
||||
// We have to walk back through the revisions until we find a proper
|
||||
// commit. If we encounter a merge commit, then we split our search to
|
||||
// look down both parents until we find the commit or we reach the end.
|
||||
//
|
||||
// While we're collecting it, we figure out what is the proper operation
|
||||
// to perform once we do find it.
|
||||
//
|
||||
// Failing everything, we use our fallback.
|
||||
let mut version = Version::parse("0.0.1").unwrap();
|
||||
let mut check_list = vec![(commit.id(), VersionBump::None)];
|
||||
|
||||
while !&check_list.is_empty() {
|
||||
info!(log, "checking {:?} entries", &check_list.len());
|
||||
|
||||
let old_list = check_list.clone();
|
||||
check_list.clear();
|
||||
|
||||
for (oid, bump) in old_list {
|
||||
// First check to see if we have a version for this commit.
|
||||
info!(log, "checking oid {:?}, currently {:?}", oid, bump);
|
||||
|
||||
if let Some(tag_version) = &tag_map.get(&oid) {
|
||||
// We have a tag, so use our gathered operation to figure
|
||||
// out the new version since we don't have to continue this.
|
||||
let mut bump_version: Version =
|
||||
tag_version.to_owned().clone();
|
||||
|
||||
match &bump {
|
||||
VersionBump::Major => {
|
||||
bump_version.mut_increment_major()
|
||||
}
|
||||
VersionBump::Minor => {
|
||||
bump_version.mut_increment_minor()
|
||||
}
|
||||
VersionBump::Patch => {
|
||||
bump_version.mut_increment_patch()
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
info!(
|
||||
log,
|
||||
"found tag {} + {:?} -> {}",
|
||||
&tag_version,
|
||||
&bump,
|
||||
&bump_version
|
||||
);
|
||||
|
||||
if &bump_version.cmp(&version) == &Ordering::Greater {
|
||||
version = bump_version;
|
||||
}
|
||||
|
||||
// We can skip this one.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse the message to see if we need to modify the bump.
|
||||
let message = commit.message().unwrap_or("");
|
||||
let conv = ConventionalCommit::from_str(message)?;
|
||||
let commit_bump = self.get_version_bump(&conv);
|
||||
let new_bump = match &bump > &commit_bump {
|
||||
true => bump.clone(),
|
||||
false => commit_bump.clone(),
|
||||
};
|
||||
|
||||
let commit = &repo.find_commit(oid)?;
|
||||
let parent_count = commit.parent_count();
|
||||
|
||||
info!(log, "something {:?}", commit.id());
|
||||
info!(log, " message {:?}", message);
|
||||
info!(log, " type {:?}", conv.type_());
|
||||
info!(
|
||||
log,
|
||||
" bump {:?} + {:?} -> {:?}", &bump, &commit_bump, new_bump
|
||||
);
|
||||
info!(log, " parent_count {:?}", parent_count);
|
||||
|
||||
// Since we haven't found a tag, insert the entry into the new
|
||||
// list.
|
||||
for parent in commit.parent_ids() {
|
||||
check_list.push((parent, new_bump.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Report the final version.
|
||||
info!(log, "final version {}", version);
|
||||
|
||||
// while &commit_id.is_some() == &true {
|
||||
// // Process the commit.
|
||||
// let commit = commit.unwrap();
|
||||
|
||||
// break;
|
||||
// }
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_version_bump(&self, commit: &ConventionalCommit) -> VersionBump {
|
||||
if commit.breaking_change().is_some() {
|
||||
return VersionBump::Major;
|
||||
}
|
||||
|
||||
return match commit.type_() {
|
||||
"feat" => VersionBump::Minor,
|
||||
"fix" => VersionBump::Patch,
|
||||
_ => VersionBump::None,
|
||||
};
|
||||
}
|
||||
|
||||
fn get_tag_map<'a>(
|
||||
&'a self,
|
||||
log: &slog::Logger,
|
||||
repo: &Repository,
|
||||
tag_prefix: &str,
|
||||
tag_name_list: &'a StringArray,
|
||||
) -> Result<HashMap<Oid, Version>> {
|
||||
let mut tag_map: HashMap<Oid, Version> = HashMap::new();
|
||||
|
||||
info!(log, "looking for {}", tag_prefix);
|
||||
|
||||
for name in tag_name_list.into_iter() {
|
||||
// Get the object that we're pointing to.
|
||||
let name = name.unwrap();
|
||||
let obj = repo.revparse_single(&name)?;
|
||||
|
||||
if let Some(_tag) = obj.as_tag() {
|
||||
warn!(log, "cannot handle a tag pointing to another tag");
|
||||
} else if let Some(commit) = obj.as_commit() {
|
||||
// Keep the OID since that is how we will look up the commits.
|
||||
let oid = commit.id();
|
||||
|
||||
// Strip off the version and convert it into a semver.
|
||||
let version = name.chars();
|
||||
let version = version.skip(tag_prefix.len() - 1);
|
||||
let version: String = version.collect();
|
||||
let version = Version::parse(&version).unwrap();
|
||||
|
||||
if let Some(old_version) = tag_map.get(&oid) {
|
||||
if version.cmp(old_version) == Ordering::Greater {
|
||||
tag_map.insert(oid, version);
|
||||
}
|
||||
} else {
|
||||
tag_map.insert(oid, version);
|
||||
}
|
||||
} else {
|
||||
warn!(log, "cannot handle a tag pointing to something other than a commit");
|
||||
}
|
||||
}
|
||||
|
||||
let tag_map_len = &tag_map.len();
|
||||
|
||||
info!(
|
||||
log,
|
||||
"loaded in {:?} tags matching {:?}", tag_map_len, tag_prefix
|
||||
);
|
||||
|
||||
Ok(tag_map)
|
||||
}
|
||||
}
|
30
src/commands/mod.rs
Normal file
30
src/commands/mod.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
mod get;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(
|
||||
name = "mfgames-conventional-commit",
|
||||
about = "CLI for working with conventional commits"
|
||||
)]
|
||||
pub struct RootCommand {
|
||||
#[command(subcommand)]
|
||||
command: RootSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum RootSubcommands {
|
||||
/// Calculates the version based on the current commits.
|
||||
Get(get::GetCommand),
|
||||
}
|
||||
|
||||
impl RootCommand {
|
||||
pub async fn run(&self, log: slog::Logger) -> Result<()> {
|
||||
match &self.command {
|
||||
RootSubcommands::Get(cmd) => cmd.run(log).await?,
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
38
src/main.rs
Normal file
38
src/main.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#![allow(dead_code)]
|
||||
//#![allow(unused_imports)]
|
||||
//#![allow(unused_variables)]
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use slog::{o, Drain};
|
||||
|
||||
mod commands;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let result = run().await;
|
||||
|
||||
match result {
|
||||
Ok(exit_code) => std::process::exit(exit_code),
|
||||
Err(msg) => {
|
||||
log::error!("{:?}", msg);
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async fn run() -> Result<i32> {
|
||||
// Set up logging.
|
||||
let decorator = slog_term::TermDecorator::new().build();
|
||||
let drain = slog_term::FullFormat::new(decorator).build().fuse();
|
||||
let drain = std::sync::Mutex::new(drain).fuse();
|
||||
|
||||
let log = slog::Logger::root(drain, o!());
|
||||
let _log_guard = slog_stdlog::init().unwrap();
|
||||
|
||||
// Parse the command and process everything.
|
||||
let args = commands::RootCommand::parse();
|
||||
args.run(log).await?;
|
||||
|
||||
Ok(0)
|
||||
}
|
Loading…
Reference in a new issue