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 crossbeam_channel::{bounded, Sender};
use crate::{events, projects, search, storage, users, database};
use super::{gb_repository, watcher, sessions, deltas, pty, project_repository::{self, activity}, files, bookmarks};
use crate::{events, projects, search, storage, users, database, watcher, sessions, deltas, pty, project_repository::{self, activity}, files, bookmarks, gb_repository};
#[derive(Clone)]
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 crate::{
app::sessions,
reader::{self, Reader},
sessions,
};
use super::Bookmark;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
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;

View File

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

View File

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

View File

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

View File

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