mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-19 22:54:18 +02:00
Remove cleanup code for old pages directory (#514)
In preparation for 1.9 release.
This commit is contained in:
parent
f9fab32812
commit
d07fb02e86
3 changed files with 1 additions and 35 deletions
|
|
@ -20,7 +20,6 @@ use crate::{
|
|||
};
|
||||
|
||||
pub static TLDR_PAGES_DIR: &str = "tldr-pages";
|
||||
pub static TLDR_OLD_PAGES_DIR: &str = "tldr-master";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CacheConfig<'a> {
|
||||
|
|
|
|||
12
src/main.rs
12
src/main.rs
|
|
@ -36,7 +36,7 @@ use std::{
|
|||
};
|
||||
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use cache::{CacheConfig, TLDR_OLD_PAGES_DIR};
|
||||
use cache::CacheConfig;
|
||||
use clap::Parser;
|
||||
use config::{ConfigLoader, Language, StyleConfig, TlsBackend};
|
||||
use log::debug;
|
||||
|
|
@ -301,16 +301,6 @@ fn try_main(args: Cli, enable_styles: bool) -> Result<ExitCode> {
|
|||
download_languages,
|
||||
};
|
||||
|
||||
// TODO: remove in tealdeer 1.9
|
||||
let old_config = CacheConfig {
|
||||
pages_directory: &config.directories.cache_dir.path().join(TLDR_OLD_PAGES_DIR),
|
||||
..cache_config
|
||||
};
|
||||
if let Ok(Some(old_cache)) = Cache::open(old_config) {
|
||||
old_cache.clear()?;
|
||||
eprintln!("Cleared pages from old cache location.");
|
||||
}
|
||||
|
||||
if args.clear_cache {
|
||||
if let Some(cache) = Cache::open(cache_config)? {
|
||||
clear_cache(cache, args.quiet)?;
|
||||
|
|
|
|||
23
tests/lib.rs
23
tests/lib.rs
|
|
@ -17,7 +17,6 @@ use predicates::{
|
|||
use tempfile::{Builder as TempfileBuilder, TempDir};
|
||||
|
||||
pub static TLDR_PAGES_DIR: &str = "tldr-pages";
|
||||
pub static TLDR_OLD_PAGES_DIR: &str = "tldr-master";
|
||||
|
||||
struct TestEnv {
|
||||
_test_dir: TempDir,
|
||||
|
|
@ -417,28 +416,6 @@ fn test_clear_only_pages_directory() {
|
|||
assert!(!testenv.cache_dir().join(TLDR_PAGES_DIR).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_always_delete_old_pages_directory() {
|
||||
let testenv = TestEnv::new().install_default_cache();
|
||||
fs::rename(
|
||||
testenv.cache_dir().join(TLDR_PAGES_DIR),
|
||||
testenv.cache_dir().join(TLDR_OLD_PAGES_DIR),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
testenv
|
||||
.command()
|
||||
.arg("--list")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(contains("Cleared pages from old cache location."))
|
||||
.stderr(contains("Page cache not found."));
|
||||
|
||||
assert!(testenv.cache_dir().is_dir());
|
||||
assert!(!testenv.cache_dir().join(TLDR_PAGES_DIR).exists());
|
||||
assert!(!testenv.cache_dir().join(TLDR_OLD_PAGES_DIR).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_warn_invalid_tls_backend() {
|
||||
let testenv = TestEnv::new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue