Compare commits

...

2 Commits

Author SHA1 Message Date
cuddle-please
707f9cefed chore(release): 0.2.0
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2024-09-14 13:23:58 +00:00
1cc771be1e
feat: add settings config
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-09-14 15:22:35 +02:00
5 changed files with 75 additions and 3 deletions

View File

@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.0] - 2024-09-14
### Added
- add settings config
- add github fetch prs refactoring
- gitea able to pull repositories
- add config
### Docs
- add readme
### Fixed
- don't have to use user for basic auth
### Other
- removed unused code
- move projects list into separate file
- separate files
- move config out
- remove unused libraries
## [0.1.0] - 2024-09-12
### Added

23
Cargo.lock generated
View File

@ -260,6 +260,12 @@ dependencies = [
"powerfmt",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "dotenv"
version = "0.15.0"
@ -464,6 +470,7 @@ dependencies = [
"dotenv",
"gitea-rs",
"octocrab",
"pretty_assertions",
"serde",
"tokio",
"toml",
@ -1075,6 +1082,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "pretty_assertions"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66"
dependencies = [
"diff",
"yansi",
]
[[package]]
name = "proc-macro2"
version = "1.0.86"
@ -2151,6 +2168,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "yansi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "zeroize"
version = "1.8.1"

View File

@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.0"
version = "0.2.0"
[workspace.dependencies]
gitnow = { path = "crates/gitnow" }

View File

@ -20,3 +20,6 @@ toml = "0.8.19"
gitea-rs = { git = "https://git.front.kjuulh.io/kjuulh/gitea-rs", version = "1.22.1" }
url = "2.5.2"
octocrab = "0.39.0"
[dev-dependencies]
pretty_assertions = "1.4.0"

View File

@ -1,14 +1,28 @@
use std::path::Path;
use std::path::{Path, PathBuf};
use anyhow::Context;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct Config {
#[serde(default)]
pub settings: Settings,
#[serde(default)]
pub providers: Providers,
}
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct Settings {
#[serde(default)]
cache: Cache,
}
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct Cache {
location: Option<PathBuf>,
}
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct Providers {
#[serde(default)]
@ -149,10 +163,13 @@ mod test {
fn test_can_parse_config() -> anyhow::Result<()> {
let content = r#"
[[providers.github]]
current_user = "kjuulh"
access_token = "some-token"
users = ["kjuulh"]
organisations = ["lunarway"]
[[providers.github]]
access_token = { env = "something" }
users = ["other"]
organisations = ["org"]
@ -173,7 +190,7 @@ mod test {
let config = Config::from_string(content)?;
assert_eq!(
pretty_assertions::assert_eq!(
Config {
providers: Providers {
github: vec![
@ -217,6 +234,11 @@ mod test {
current_user: None
},
]
},
settings: Settings {
cache: Cache {
location: Some(PathBuf::from("$HOME/.cache/gitnow/"))
}
}
},
config
@ -238,6 +260,9 @@ mod test {
providers: Providers {
github: vec![],
gitea: vec![]
},
settings: Settings {
cache: Cache { location: None }
}
},
config