diff --git a/README.md b/README.md index f74d711..38c4cdd 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Stelae is a system for distributing, preserving, and authenticating laws. - `format`: Format code - `lint`: Format code and run strict clippy - `test`: Run all tests + - Install nextest with command `cargo install cargo-nextest` - On windows, especially, you may wish to run just through the nu shell, which can be done by calling all commands with the `--shell` command, e.g. `just --shell nu lint`. ## Logging diff --git a/src/db/init.rs b/src/db/init.rs index 6219d72..11d2511 100644 --- a/src/db/init.rs +++ b/src/db/init.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; /// Connections can fail if the database is not running, or if the database URL is invalid. pub async fn connect(archive_path: &Path) -> anyhow::Result { let db_url = env::var("DATABASE_URL").unwrap_or_else(|_| { - let sqlite_db_path = &archive_path.join(PathBuf::from(".stelae/db.sqlite3")); + let sqlite_db_path = &archive_path.join(PathBuf::from(".taf/db.sqlite3")); format!("sqlite:///{}?mode=rwc", sqlite_db_path.to_string_lossy()) }); let connection = DatabaseConnection::connect(&db_url).await?; diff --git a/src/history/changes.rs b/src/history/changes.rs index d73fad2..dccedcc 100644 --- a/src/history/changes.rs +++ b/src/history/changes.rs @@ -56,7 +56,7 @@ pub async fn insert(raw_archive_path: &str, archive_path: PathBuf) -> Result<(), Err(err) => { tracing::error!( "error: could not connect to database. - Confirm that `db.sqlite3` exists in `.stelae` dir or that DATABASE_URL env var is set correctly." + Confirm that `db.sqlite3` exists in `.taf` dir or that DATABASE_URL env var is set correctly." ); tracing::error!("Error: {err:?}"); return Err(CliError::DatabaseConnectionError); diff --git a/src/stelae/archive.rs b/src/stelae/archive.rs index 4867084..50b6a66 100644 --- a/src/stelae/archive.rs +++ b/src/stelae/archive.rs @@ -22,9 +22,9 @@ pub struct Archive { impl Archive { /// Get an archive's config object. /// # Errors - /// Will error if unable to find or parse config file at `.stelae/config.toml` + /// Will error if unable to find or parse config file at `.taf/config.toml` pub fn get_config(&self) -> anyhow::Result { - let config_path = &self.path.join(PathBuf::from(".stelae/config.toml")); + let config_path = &self.path.join(PathBuf::from(".taf/config.toml")); let config_str = read_to_string(config_path)?; let conf: Config = toml::from_str(&config_str)?; Ok(conf) @@ -180,7 +180,7 @@ pub fn init( headers: Option, ) -> anyhow::Result> { raise_error_if_in_existing_archive(&path)?; - let stelae_dir = path.join(PathBuf::from("./.stelae")); + let stelae_dir = path.join(PathBuf::from("./.taf")); create_dir_all(&stelae_dir)?; let config_path = stelae_dir.join(PathBuf::from("./config.toml")); let conf = Config { diff --git a/src/utils/archive.rs b/src/utils/archive.rs index 1e82f42..653193f 100644 --- a/src/utils/archive.rs +++ b/src/utils/archive.rs @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf}; pub fn find_archive_path(path: &Path) -> anyhow::Result { let abs_path = fix_unc_path(&path.canonicalize()?); for working_path in abs_path.ancestors() { - if working_path.join(".stelae").exists() { + if working_path.join(".taf").exists() { return Ok(working_path.to_owned()); } } diff --git a/src/utils/cli.rs b/src/utils/cli.rs index 46dc153..e1fae7a 100644 --- a/src/utils/cli.rs +++ b/src/utils/cli.rs @@ -65,18 +65,18 @@ enum Subcommands { /// Place to initialize tracing /// -/// We create `debug` and `error` log files in `.stelae` dir. +/// We create `debug` and `error` log files in `.taf` dir. /// `debug` log file contains all logs, `error` log file contains only `warn` and `error` /// NOTE: once `https://github.com/tokio-rs/tracing/pull/2497` is merged, /// update `init_tracing` to rotate log files based on size. #[allow(clippy::expect_used)] fn init_tracing(archive_path: &Path) { - let stelae_dir = archive_path.join(PathBuf::from("./.stelae")); + let taf_dir = archive_path.join(PathBuf::from("./.taf")); let debug_file_appender = - rolling::never(&stelae_dir, "stelae-debug.log").with_max_level(Level::DEBUG); + rolling::never(&taf_dir, "stelae-debug.log").with_max_level(Level::DEBUG); let error_file_appender = - rolling::never(&stelae_dir, "stelae-error.log").with_max_level(Level::WARN); + rolling::never(&taf_dir, "stelae-error.log").with_max_level(Level::WARN); let mut debug_layer = fmt::layer().with_writer(debug_file_appender); let mut error_layer = fmt::layer().with_writer(error_file_appender); @@ -126,7 +126,7 @@ pub fn run() { let archive_path_wd = Path::new(&cli.archive_path); let Ok(archive_path) = find_archive_path(archive_path_wd) else { tracing::error!( - "error: could not find `.stelae` folder in `{}` or any parent directory", + "error: could not find `.taf` folder in `{}` or any parent directory", &cli.archive_path ); process::exit(1); diff --git a/tests/fixtures/basic/archive/.stelae/.keep b/tests/fixtures/basic/archive/.taf/.keep similarity index 100% rename from tests/fixtures/basic/archive/.stelae/.keep rename to tests/fixtures/basic/archive/.taf/.keep