chore(deps): update rust crate kxio to v4
Some checks failed
Rust / build (map[name:nightly]) (push) Waiting to run
Rust / build (map[name:stable]) (push) Waiting to run
ci/woodpecker/push/tag-created Pipeline is pending
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline failed
Some checks failed
Rust / build (map[name:nightly]) (push) Waiting to run
Rust / build (map[name:stable]) (push) Waiting to run
ci/woodpecker/push/tag-created Pipeline is pending
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline failed
This commit is contained in:
parent
9fb4b577a7
commit
85407936d4
6 changed files with 26 additions and 30 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -2755,10 +2755,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kxio"
|
name = "kxio"
|
||||||
version = "3.1.0"
|
version = "4.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d6fd1ff0b499ac9329ab39bdc334571c0c9488aec5cdc84b4463b7a65a9e276b"
|
checksum = "b711909378294af8b006b4df66e8b2de75fc0c2c98ff9ea7ef1422ae7c859a3d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
|
@ -2766,6 +2767,7 @@ dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ async-trait = "0.1"
|
||||||
git-url-parse = "0.4"
|
git-url-parse = "0.4"
|
||||||
|
|
||||||
# fs/network
|
# fs/network
|
||||||
kxio = "3.1"
|
kxio = "4.0"
|
||||||
|
|
||||||
# TOML parsing
|
# TOML parsing
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Leveraging the pre-built Docker images with
|
# Leveraging the pre-built Docker images with
|
||||||
# cargo-chef and the Rust toolchain
|
# cargo-chef and the Rust toolchain
|
||||||
FROM git.kemitix.net/kemitix/git-next-builder:2024.08.04 AS chef
|
FROM git.kemitix.net/kemitix/git-next-builder:2024.12.28 AS chef
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
FROM chef AS planner
|
FROM chef AS planner
|
||||||
|
|
|
@ -9,10 +9,18 @@ use tracing_subscriber::{self, layer::SubscriberExt, util::SubscriberInitExt, La
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase();
|
pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase();
|
||||||
pub static ref DATA_FOLDER: Option<PathBuf> =
|
pub static ref DATA_FOLDER: PathBuf = std::env::var(format!("{}_DATA", PROJECT_NAME.clone()))
|
||||||
std::env::var(format!("{}_DATA", PROJECT_NAME.clone()))
|
.ok()
|
||||||
.ok()
|
.map(PathBuf::from)
|
||||||
.map(PathBuf::from);
|
.map_or_else(
|
||||||
|
|| {
|
||||||
|
project_directory().map_or_else(
|
||||||
|
|| PathBuf::from(".").join(".data"),
|
||||||
|
|proj_dirs| proj_dirs.data_local_dir().to_path_buf(),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|data_folder| data_folder,
|
||||||
|
);
|
||||||
pub static ref LOG_ENV: String = format!("{}_LOGLEVEL", PROJECT_NAME.clone());
|
pub static ref LOG_ENV: String = format!("{}_LOGLEVEL", PROJECT_NAME.clone());
|
||||||
pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME"));
|
pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME"));
|
||||||
}
|
}
|
||||||
|
@ -21,23 +29,9 @@ fn project_directory() -> Option<ProjectDirs> {
|
||||||
ProjectDirs::from("net", "kemitix", env!("CARGO_PKG_NAME"))
|
ProjectDirs::from("net", "kemitix", env!("CARGO_PKG_NAME"))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_data_dir() -> PathBuf {
|
|
||||||
let directory = DATA_FOLDER.clone().map_or_else(
|
|
||||||
|| {
|
|
||||||
project_directory().map_or_else(
|
|
||||||
|| PathBuf::from(".").join(".data"),
|
|
||||||
|proj_dirs| proj_dirs.data_local_dir().to_path_buf(),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
|data_folder| data_folder,
|
|
||||||
);
|
|
||||||
directory
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn initialize_logging() -> Result<()> {
|
pub fn initialize_logging() -> Result<()> {
|
||||||
let directory = get_data_dir();
|
std::fs::create_dir_all(DATA_FOLDER.clone())?;
|
||||||
std::fs::create_dir_all(directory.clone())?;
|
let log_path = DATA_FOLDER.join(LOG_FILE.clone());
|
||||||
let log_path = directory.join(LOG_FILE.clone());
|
|
||||||
let log_file = std::fs::File::create(log_path)?;
|
let log_file = std::fs::File::create(log_path)?;
|
||||||
std::env::set_var(
|
std::env::set_var(
|
||||||
"RUST_LOG",
|
"RUST_LOG",
|
||||||
|
|
|
@ -145,7 +145,7 @@ impl RepoDetails {
|
||||||
let file = fs.file(config_filename);
|
let file = fs.file(config_filename);
|
||||||
let config_file = file.reader()?;
|
let config_file = file.reader()?;
|
||||||
let mut config_lines = config_file
|
let mut config_lines = config_file
|
||||||
.lines()
|
.lines()?
|
||||||
.map(ToOwned::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
tracing::debug!(?config_lines, "original file");
|
tracing::debug!(?config_lines, "original file");
|
||||||
|
|
|
@ -326,22 +326,22 @@ pub mod given {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::expect_used)]
|
||||||
pub fn a_bare_repo_with_url(path: &Path, url: &str, fs: &kxio::fs::FileSystem) {
|
pub fn a_bare_repo_with_url(path: &Path, url: &str, fs: &kxio::fs::FileSystem) {
|
||||||
// create a basic bare repo
|
// create a basic bare repo
|
||||||
let repo = gix::prepare_clone_bare(url, fs.base()).unwrap();
|
let repo = gix::prepare_clone_bare(url, fs.base()).expect("prepare_clone_bare");
|
||||||
repo.persist();
|
repo.persist();
|
||||||
// load config file
|
// load config file
|
||||||
let file = fs.file(&path.join("config"));
|
let file = fs.file(&path.join("config"));
|
||||||
let config_file = file.reader().unwrap();
|
let config_file = file.reader().expect("reader");
|
||||||
// add use are origin url
|
// add use are origin url
|
||||||
let mut config_lines = config_file.lines().collect::<Vec<_>>();
|
let mut config_lines = config_file.lines().expect("lines").collect::<Vec<_>>();
|
||||||
config_lines.push(r#"[remote "origin"]"#);
|
config_lines.push(r#"[remote "origin"]"#);
|
||||||
let url_line = format!(r#" url = "{url}""#);
|
let url_line = format!(r#" url = "{url}""#);
|
||||||
tracing::info!(?url, %url_line, "writing");
|
tracing::info!(?url, %url_line, "writing");
|
||||||
config_lines.push(&url_line);
|
config_lines.push(&url_line);
|
||||||
// write config file back out
|
// write config file back out
|
||||||
file.write(config_lines.join("\n").as_str()).unwrap();
|
file.write(config_lines.join("\n").as_str()).expect("write");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
|
|
Loading…
Reference in a new issue