rm app/ dir

This commit is contained in:
Nikita Galaiko 2023-05-19 12:53:04 +02:00
parent 6c24282dcc
commit 45efa9e10e
64 changed files with 48 additions and 76 deletions

View File

@ -3,9 +3,7 @@ use std::{collections::HashMap, sync, ops};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crossbeam_channel::{bounded, Sender}; use crossbeam_channel::{bounded, Sender};
use crate::{events, projects, search, storage, users, database}; use crate::{events, projects, search, storage, users, database, watcher, sessions, deltas, pty, project_repository::{self, activity}, files, bookmarks, gb_repository};
use super::{gb_repository, watcher, sessions, deltas, pty, project_repository::{self, activity}, files, bookmarks};
#[derive(Clone)] #[derive(Clone)]
pub struct App { pub struct App {

View File

@ -1,15 +0,0 @@
mod app;
pub mod bookmarks;
pub mod deltas;
pub mod files;
pub mod gb_repository;
pub mod project_repository;
pub mod projects;
pub mod pty;
pub mod search;
pub mod sessions;
pub mod users;
pub mod watcher;
pub use app::{AddProjectError, App};
pub use project_repository::FileStatus;

View File

@ -2,8 +2,8 @@ use anyhow::{Context, Result};
use serde_jsonlines::JsonLinesReader; use serde_jsonlines::JsonLinesReader;
use crate::{ use crate::{
app::sessions,
reader::{self, Reader}, reader::{self, Reader},
sessions,
}; };
use super::Bookmark; use super::Bookmark;

View File

@ -3,8 +3,8 @@ use std::{collections::HashMap, path};
use anyhow::Result; use anyhow::Result;
use crate::{ use crate::{
app::sessions,
reader::{self, Reader}, reader::{self, Reader},
sessions,
}; };
use super::Delta; use super::Delta;

View File

@ -1,7 +1,7 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use tauri::Manager; use tauri::Manager;
use crate::app::{deltas, sessions}; use crate::{deltas, sessions};
#[derive(Clone)] #[derive(Clone)]
pub struct Sender { pub struct Sender {

View File

@ -14,8 +14,9 @@ use uuid::Uuid;
use crate::{fs, projects, users}; use crate::{fs, projects, users};
use crate::{ use crate::{
app::{project_repository, sessions}, project_repository,
reader::{self, Reader}, reader::{self, Reader},
sessions,
}; };
pub struct Repository { pub struct Repository {

View File

@ -3,10 +3,7 @@ use std::{thread, time};
use anyhow::Result; use anyhow::Result;
use tempfile::tempdir; use tempfile::tempdir;
use crate::{ use crate::{deltas, gb_repository, projects, sessions, storage, users};
app::{deltas, gb_repository, sessions},
projects, storage, users,
};
fn remote_repository() -> Result<git2::Repository> { fn remote_repository() -> Result<git2::Repository> {
let path = tempdir()?.path().to_str().unwrap().to_string(); let path = tempdir()?.path().to_str().unwrap().to_string();

View File

@ -2,7 +2,18 @@
extern crate scopeguard; extern crate scopeguard;
mod app; mod app;
mod bookmarks;
mod database; mod database;
mod deltas;
mod sessions;
mod files;
mod gb_repository;
mod project_repository;
mod projects;
mod pty;
mod search;
mod users;
mod watcher;
mod reader; mod reader;
mod writer; mod writer;
mod zip; mod zip;
@ -14,7 +25,6 @@ mod storage;
extern crate log; extern crate log;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use app::bookmarks;
use serde::{ser::SerializeMap, Serialize}; use serde::{ser::SerializeMap, Serialize};
use std::{collections::HashMap, ops}; use std::{collections::HashMap, ops};
use tauri::{generate_context, Manager}; use tauri::{generate_context, Manager};
@ -25,7 +35,7 @@ use tauri_plugin_log::{
use thiserror::Error; use thiserror::Error;
use timed::timed; use timed::timed;
use crate::app::{project_repository::activity, search, projects, deltas, sessions, users}; use crate::project_repository::activity;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
@ -349,7 +359,7 @@ async fn git_activity(
async fn git_status( async fn git_status(
handle: tauri::AppHandle, handle: tauri::AppHandle,
project_id: &str, project_id: &str,
) -> Result<HashMap<String, app::FileStatus>, Error> { ) -> Result<HashMap<String, project_repository::FileStatus>, Error> {
let app = handle.state::<app::App>(); let app = handle.state::<app::App>();
let status = app let status = app
.git_status(project_id) .git_status(project_id)

View File

@ -4,7 +4,7 @@ use anyhow::{Context, Result};
use serde::Serialize; use serde::Serialize;
use walkdir::WalkDir; use walkdir::WalkDir;
use crate::{app::project_repository::activity, projects, reader}; use crate::{project_repository::activity, projects, reader};
pub struct Repository<'repository> { pub struct Repository<'repository> {
pub(crate) git_repository: git2::Repository, pub(crate) git_repository: git2::Repository,

View File

@ -11,10 +11,7 @@ use serde::Serialize;
use similar::{ChangeTag, TextDiff}; use similar::{ChangeTag, TextDiff};
use tantivy::{collector, directory::MmapDirectory, schema, IndexWriter}; use tantivy::{collector, directory::MmapDirectory, schema, IndexWriter};
use crate::{ use crate::{deltas, gb_repository, sessions, storage};
app::{self, deltas, sessions},
storage,
};
const CURRENT_VERSION: u64 = 4; // should not decrease const CURRENT_VERSION: u64 = 4; // should not decrease
@ -123,7 +120,7 @@ impl Deltas {
pub fn index_session( pub fn index_session(
&self, &self,
repository: &app::gb_repository::Repository, repository: &gb_repository::Repository,
session: &sessions::Session, session: &sessions::Session,
) -> Result<()> { ) -> Result<()> {
// TODO: maybe we should index current sessions? // TODO: maybe we should index current sessions?
@ -196,7 +193,7 @@ fn index_session(
index: &tantivy::Index, index: &tantivy::Index,
writer: &mut IndexWriter, writer: &mut IndexWriter,
session: &sessions::Session, session: &sessions::Session,
repository: &app::gb_repository::Repository, repository: &gb_repository::Repository,
) -> Result<()> { ) -> Result<()> {
let session_reader = sessions::Reader::open(&repository, &session) let session_reader = sessions::Reader::open(&repository, &session)
.with_context(|| "could not get session reader")?; .with_context(|| "could not get session reader")?;

View File

@ -4,10 +4,7 @@ use std::path::Path;
use anyhow::Result; use anyhow::Result;
use tempfile::tempdir; use tempfile::tempdir;
use crate::{ use crate::{deltas, gb_repository, projects, sessions, storage, users};
app::{self, deltas, sessions},
projects, storage, users,
};
fn test_repository() -> Result<git2::Repository> { fn test_repository() -> Result<git2::Repository> {
let path = tempdir()?.path().to_str().unwrap().to_string(); let path = tempdir()?.path().to_str().unwrap().to_string();
@ -48,7 +45,7 @@ fn test_filter_by_timestamp() -> Result<()> {
let project_store = projects::Storage::new(storage.clone()); let project_store = projects::Storage::new(storage.clone());
project_store.add_project(&project)?; project_store.add_project(&project)?;
let user_store = users::Storage::new(storage); let user_store = users::Storage::new(storage);
let gb_repo = app::gb_repository::Repository::open( let gb_repo = gb_repository::Repository::open(
gb_repo_path, gb_repo_path,
project.id.clone(), project.id.clone(),
project_store.clone(), project_store.clone(),
@ -124,7 +121,7 @@ fn test_sorted_by_timestamp() -> Result<()> {
let project_store = projects::Storage::new(storage.clone()); let project_store = projects::Storage::new(storage.clone());
project_store.add_project(&project)?; project_store.add_project(&project)?;
let user_store = users::Storage::new(storage); let user_store = users::Storage::new(storage);
let gb_repo = app::gb_repository::Repository::open( let gb_repo = gb_repository::Repository::open(
gb_repo_path, gb_repo_path,
project.id.clone(), project.id.clone(),
project_store.clone(), project_store.clone(),
@ -180,7 +177,7 @@ fn test_simple() -> Result<()> {
let project_store = projects::Storage::new(storage.clone()); let project_store = projects::Storage::new(storage.clone());
project_store.add_project(&project)?; project_store.add_project(&project)?;
let user_store = users::Storage::new(storage); let user_store = users::Storage::new(storage);
let gb_repo = app::gb_repository::Repository::open( let gb_repo = gb_repository::Repository::open(
gb_repo_path, gb_repo_path,
project.id.clone(), project.id.clone(),
project_store.clone(), project_store.clone(),
@ -299,7 +296,7 @@ fn test_delete_all() -> Result<()> {
let project_store = projects::Storage::new(storage.clone()); let project_store = projects::Storage::new(storage.clone());
project_store.add_project(&project)?; project_store.add_project(&project)?;
let user_store = users::Storage::new(storage); let user_store = users::Storage::new(storage);
let gb_repo = app::gb_repository::Repository::open( let gb_repo = gb_repository::Repository::open(
gb_repo_path, gb_repo_path,
project.id.clone(), project.id.clone(),
project_store.clone(), project_store.clone(),

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use crate::{ use crate::{
app::gb_repository, gb_repository,
reader::{self, CommitReader, Reader}, reader::{self, CommitReader, Reader},
}; };

View File

@ -1,10 +1,7 @@
use anyhow::Result; use anyhow::Result;
use tempfile::tempdir; use tempfile::tempdir;
use crate::{ use crate::{gb_repository, projects, sessions, storage, users};
app::{gb_repository, sessions},
projects, storage, users,
};
use super::Writer; use super::Writer;

View File

@ -3,7 +3,7 @@ use std::time;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use crate::{ use crate::{
app::{bookmarks, deltas, gb_repository, pty}, bookmarks, deltas, gb_repository, pty,
reader::{self, Reader}, reader::{self, Reader},
writer::{self, Writer}, writer::{self, Writer},
}; };

View File

@ -1,7 +1,7 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crossbeam_channel::{bounded, Receiver, Sender}; use crossbeam_channel::{bounded, Receiver, Sender};
use crate::app::{deltas, files, sessions, watcher::events}; use crate::{deltas, files, sessions, watcher::events};
#[derive(Clone)] #[derive(Clone)]
pub struct Dispatcher { pub struct Dispatcher {

View File

@ -7,7 +7,7 @@ use std::{path, time};
use anyhow::Result; use anyhow::Result;
use crossbeam_channel::{bounded, select, unbounded, Sender}; use crossbeam_channel::{bounded, select, unbounded, Sender};
use crate::app::{deltas, files, sessions}; use crate::{deltas, files, sessions};
use super::events; use super::events;

View File

@ -1,6 +1,6 @@
use std::{path, time}; use std::{path, time};
use crate::app::{deltas, sessions}; use crate::{deltas, sessions};
pub enum Event { pub enum Event {
Tick(time::SystemTime), Tick(time::SystemTime),

View File

@ -2,7 +2,7 @@ use std::{sync, time};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::app::{gb_repository, sessions}; use crate::{gb_repository, sessions};
use super::events; use super::events;

View File

@ -2,7 +2,7 @@ use std::time;
use anyhow::Result; use anyhow::Result;
use crate::app::sessions; use crate::sessions;
use super::check_current_session::should_flush; use super::check_current_session::should_flush;

View File

@ -2,7 +2,7 @@ use std::time;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::app::projects; use crate::projects;
use super::events; use super::events;

View File

@ -2,7 +2,7 @@ use std::time;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::{app::gb_repository, projects}; use crate::{gb_repository, projects};
use super::events; use super::events;

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use crate::app::watcher::events; use crate::watcher::events;
pub struct Handler {} pub struct Handler {}

View File

@ -1,9 +1,6 @@
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use crate::{ use crate::{gb_repository, project_repository, projects, sessions};
app::{gb_repository, project_repository, sessions},
projects,
};
use super::events; use super::events;

View File

@ -1,6 +1,6 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::{app::project_repository, projects}; use crate::{project_repository, projects};
use super::events; use super::events;

View File

@ -1,6 +1,6 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::app::{bookmarks, deltas, files, gb_repository, search, sessions}; use crate::{bookmarks, deltas, files, gb_repository, search, sessions};
use super::events; use super::events;

View File

@ -15,8 +15,7 @@ mod project_file_change_tests;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::{ use crate::{
app::{deltas, files, gb_repository, sessions, bookmarks}, bookmarks, deltas, events as app_events, files, gb_repository, projects, search, sessions,
events as app_events, projects, search,
}; };
use super::events; use super::events;

View File

@ -3,9 +3,9 @@ use std::vec;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use crate::{ use crate::{
app::{deltas, gb_repository, project_repository, sessions}, deltas, gb_repository, project_repository, projects,
projects,
reader::{self, Reader}, reader::{self, Reader},
sessions,
}; };
use super::events; use super::events;

View File

@ -1,10 +1,7 @@
use anyhow::Result; use anyhow::Result;
use tempfile::tempdir; use tempfile::tempdir;
use crate::{ use crate::{deltas, gb_repository, project_repository, projects, sessions, storage, users};
app::{deltas, gb_repository, project_repository, sessions},
projects, storage, users,
};
use super::project_file_change::Handler; use super::project_file_change::Handler;

View File

@ -1,10 +1,7 @@
use anyhow::Result; use anyhow::Result;
use crossbeam_channel::{select, unbounded}; use crossbeam_channel::{select, unbounded};
use crate::{ use crate::{bookmarks, deltas, events, files, gb_repository, projects, search, sessions};
app::{deltas, files, gb_repository, sessions, bookmarks},
events, projects, search,
};
use super::{dispatchers, handlers}; use super::{dispatchers, handlers};