move the rest inside app

This commit is contained in:
Nikita Galaiko 2023-05-07 17:37:30 +02:00
parent 942b48914c
commit 8b0da72931
16 changed files with 26 additions and 23 deletions

View File

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

View File

@ -3,7 +3,9 @@ pub mod deltas;
pub mod gb_repository;
pub mod project_repository;
pub mod projects;
pub mod pty;
pub mod reader;
pub mod search;
pub mod sessions;
pub mod users;
pub mod watcher;

View File

@ -0,0 +1,6 @@
pub mod activity;
#[cfg(test)]
mod activity_tests;
mod repository;
pub use repository::{FileStatus, Repository};

View File

@ -4,9 +4,10 @@ use anyhow::{Context, Result};
use serde::Serialize;
use walkdir::WalkDir;
use crate::{git::activity, projects};
use super::reader;
use crate::{
app::{project_repository::activity, reader},
projects,
};
pub struct Repository<'repository> {
pub(crate) git_repository: git2::Repository,
@ -53,7 +54,10 @@ impl<'repository> Repository<'repository> {
self.git_repository.path().parent().unwrap()
}
pub fn git_activity(&self, start_time_ms: Option<u128>) -> Result<Vec<activity::Activity>> {
pub fn git_activity(
&self,
start_time_ms: Option<u128>,
) -> Result<Vec<activity::Activity>> {
let head_logs_path = self.git_repository.path().join("logs").join("HEAD");
if !head_logs_path.exists() {

View File

@ -13,7 +13,9 @@ use tokio_tungstenite::{
tungstenite::handshake::server::{Request, Response},
};
use crate::{app, pty::recorder};
use crate::app;
use super::recorder;
const TERM: &str = "xterm-256color";

View File

@ -2,13 +2,10 @@ use std::time;
use anyhow::{anyhow, Context, Result};
use crate::{
app::{
deltas, gb_repository,
reader::{self, Reader},
writer::{self, Writer},
},
pty,
use crate::app::{
deltas, gb_repository, pty,
reader::{self, Reader},
writer::{self, Writer},
};
use super::Session;

View File

@ -1,4 +0,0 @@
pub mod activity;
#[cfg(test)]
mod activity_tests;

View File

@ -6,16 +6,12 @@ extern crate lazy_static;
mod app;
mod events;
mod fs;
mod git;
mod pty;
mod search;
mod storage;
#[macro_use]
extern crate log;
use anyhow::{Context, Result};
use git::activity;
use serde::{ser::SerializeMap, Serialize};
use std::{collections::HashMap, ops::Range};
use tauri::{generate_context, Manager};
@ -26,7 +22,7 @@ use tauri_plugin_log::{
use thiserror::Error;
use timed::timed;
use crate::app::{projects, deltas, sessions, users};
use crate::app::{project_repository::activity, search, projects, deltas, sessions, users};
#[derive(Debug, Error)]
pub enum Error {