Skip to content

Commit

Permalink
refactor: improve project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Nov 3, 2024
1 parent 49f285e commit 9ee4c9a
Show file tree
Hide file tree
Showing 39 changed files with 517 additions and 400 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/comments/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pub use self::get_comments::get_comments;
pub use self::identify_not_ignored_file::identify_not_ignored_file;
pub use self::identify_supported_file::identify_supported_file;
pub use self::identify_todo_comment::identify_todo_comment;
pub use self::prepare_blame_data::prepare_blame_data;

pub mod get_comments;
pub mod identify_not_ignored_file;
pub mod identify_supported_file;
pub mod identify_todo_comment;
pub mod prepare_blame_data;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::blame::BlameData;
use crate::git::get_blame_data::BlameData;
use chrono::{DateTime, Duration, Utc};
use serde::Serialize;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::env;
use std::path::PathBuf;
use std::{env, path::PathBuf};

pub fn get_current_directory() -> Option<PathBuf> {
match env::current_dir() {
Expand Down
4 changes: 1 addition & 3 deletions src/get_dist_path.rs → src/fs/get_dist_path.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::env;
use std::fs;
use std::path::PathBuf;
use std::{env, fs, path::PathBuf};

pub fn get_dist_path() -> Option<PathBuf> {
let exe_path = match env::current_exe() {
Expand Down
7 changes: 7 additions & 0 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub use self::copy_dir_recursive::copy_dir_recursive;
pub use self::get_current_directory::get_current_directory;
pub use self::get_dist_path::get_dist_path;

pub mod copy_dir_recursive;
pub mod get_current_directory;
pub mod get_dist_path;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/blame.rs → src/git/get_blame_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct BlameData {
pub author: String,
}

pub async fn blame(path: &str, line: u32) -> Option<BlameData> {
pub async fn get_blame_data(path: &str, line: u32) -> Option<BlameData> {
let result = match exec(&[
"git",
"blame",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions src/git/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pub use self::check_git_repository::check_git_repository;
pub use self::get_blame_data::get_blame_data;
pub use self::get_file_by_commit::get_file_by_commit;
pub use self::get_files_list::get_files_list;
pub use self::get_history::get_history;
pub use self::get_last_commit_hash::get_last_commit_hash;
pub use self::get_line_from_position::get_line_from_position;
pub use self::get_modified_files::get_modified_files;

pub mod check_git_repository;
pub mod get_blame_data;
pub mod get_file_by_commit;
pub mod get_files_list;
pub mod get_history;
pub mod get_last_commit_hash;
pub mod get_line_from_position;
pub mod get_modified_files;
27 changes: 5 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
pub mod add_missing_days;
pub mod blame;
pub mod check_git_repository;
pub mod copy_dir_recursive;
pub mod escape_html;
pub mod escape_json_values;
pub mod comments;
pub mod exec;
pub mod get_comments;
pub mod get_current_directory;
pub mod get_dist_path;
pub mod get_file_by_commit;
pub mod get_files_list;
pub mod get_history;
pub mod get_last_commit_hash;
pub mod get_line_from_position;
pub mod get_modified_files;
pub mod get_project_name;
pub mod get_todoctor_version;
pub mod identify_not_ignored_file;
pub mod identify_supported_file;
pub mod identify_todo_comment;
pub mod prepare_blame_data;
pub mod remove_duplicate_dates;
pub mod fs;
pub mod git;
pub mod project;
pub mod types;
pub mod utils;
Loading

0 comments on commit 9ee4c9a

Please sign in to comment.