Skip to content

Commit

Permalink
Removes unused binaries, implements ArenaTree, commands rw
Browse files Browse the repository at this point in the history
  • Loading branch information
metakernel committed Jun 18, 2024
1 parent c02b9a0 commit fcc380c
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 37 deletions.
26 changes: 14 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
members = ["gawires-gist"]

[package]
name = "gawires"
version = "0.1.0"
Expand All @@ -13,22 +16,21 @@ name = "gaw"
path = "src/main.rs"

[lib]
name = "gawireslib"
name = "gawires"
path = "src/lib.rs"
crate-type = ["cdylib","rlib"]



[dependencies]
notify = "5.0.0"
libloading = "0.7.4"
clap = {version = "4.0.32", features = ["derive"]}
notify = "6.1.1"
libloading = "0.8.3"
clap = {version = "4.5.7", features = ["derive"]}
paw = "1.0.0"
interprocess = "1.2.1"
dirs = "4.0.0"
petgraph = "0.6.2"
interprocess = "2.2.0"
dirs = "5.0.1"
petgraph = "0.6.5"
blake2 = "0.10.6"
uuid = "1.2.2"
uuid = "1.8.0"

# Specific dependencies for the gawires kernel
gawires-diff = { git = "https://github.com/metakernel/gawires-diff"}
Expand All @@ -37,12 +39,12 @@ gawires-patch = { git = "https://github.com/metakernel/gawires-diff"}

[target.'cfg(unix)'.dependencies]
# Used for the filesystem in linux and macos
fuser = "0.12.0"
fuser = "0.14.0"

[target.'cfg(windows)'.dependencies]
# Used for the filesystem in windows
dokan = "0.3.1+dokan206"
windows = "0.43.0"
windows = "0.57.0"

[target.'cfg(windows)'.build-dependencies]
windows = "0.43.0"
windows = "0.57.0"
6 changes: 6 additions & 0 deletions gawires-gist/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "gawires-gist"
version = "0.1.0"
edition = "2021"

[dependencies]
3 changes: 3 additions & 0 deletions gawires-gist/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
9 changes: 0 additions & 9 deletions src/bin/central/main.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/bin/gist/main.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/bin/workspace_editor/main.rs

This file was deleted.

10 changes: 5 additions & 5 deletions src/cli/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ use clap::{Parser,Subcommand};
Rebase(Rebase), // Rebase a workspace branch on another branch
Merge(Merge), // Merge a workspace branch on another branch
Clean(Clean), // Clean the workspace
Project(Project),
Project(Project),
Install(Install),
Uninstall(Uninstall),
Asset(Asset),

}

///track new assets or changes, add tags and other operations.
///track new file, add tags and other operations.
#[derive(Debug, PartialEq, Parser)]
pub struct Add{
/// Stage assets changes in a given path
/// Tracks new file
pub path: Option<std::path::PathBuf>,
/// Stage all changes in workspace that are not ignored
#[arg(short = 'a', long = "all")]
Expand All @@ -47,7 +47,7 @@ use clap::{Parser,Subcommand};

/// Add a tag to the assets with the given name
#[arg(name = "Tag name",short = 't', long = "tag")]
pub tag_name: Option<String>,
pub tag_name: Option<Vec<String>>,
}

/// Checkout assets in local workspace from a source like . When assets are checkout, they are locked by default when in centralized mode.
Expand All @@ -66,7 +66,7 @@ use clap::{Parser,Subcommand};
#[derive(Debug, PartialEq, Parser)]
pub struct Release{
}
/// Initialize a new local workspace that can be connected to a central workspace
/// Initialize a new local workspace that can be connected to a project
#[derive(Debug, PartialEq, Parser)]
pub struct Init{
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/config/user_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl UserConfig{

/// Get the configuration root path.
pub fn get_gawires_configs_root() -> PathBuf {
home_dir().unwrap().join(".gawires/")
home_dir().unwrap().join(".gaw/")
}

// Get the user configuration default path.
Expand Down
36 changes: 35 additions & 1 deletion src/core/diff/difftree.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
use crate::core::tree::ArenaTree;
use crate::core::diff::Diff;
use std::cell::RefCell;
use std::process::Child;
use std::rc::Rc;

type DiffTreeNode = Rc<RefCell<DiffTree>>;

struct DiffTree{
internal_structure: ArenaTree<Diff>,
parent: Box<Option<DiffTree>>,
parent: Option<DiffTreeNode>,
children: Vec<DiffTreeNode>,
}

impl DiffTree{

pub fn new(internal_structure: ArenaTree<Diff>) -> DiffTreeNode{
Rc::new(RefCell::new(DiffTree {
internal_structure,
parent: None,
children: Vec::new(),
}
))}

pub fn add_child(parent: &DiffTreeNode, internal_structure: ArenaTree<Diff>) -> DiffTreeNode{
let child = DiffTree::new(internal_structure);
child.borrow_mut().parent = Some(Rc::clone(parent));
parent.borrow_mut().children.push(Rc::clone(&child));

child
}

pub fn display(node: &DiffTreeNode, depth: usize){
let indent = " ".repeat(depth*2);
println!("{}Node: {:?}",indent,node.borrow().internal_structure);

for child in &node.borrow().children {
DiffTree::display(child, depth + 1);
}
}
}
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(const_option)]

mod cli;
use paw::Args;
pub use clap::Parser;
Expand Down

0 comments on commit fcc380c

Please sign in to comment.