Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Install prerequisites
run: |
cargo install cargo-workspaces

sudo apt-get update
sudo apt-get install -y \
libudev-dev \
Expand Down
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ tarpaulin-report.html
# Jetbrain
.idea/

/docs/handbook/.obsidian/app.json
/docs/handbook/.obsidian/appearance.json
/docs/handbook/.obsidian/hotkeys.json
/docs/handbook/.obsidian/workspace.json
/docs/handbook/.obsidian/plugins
!/docs/handbook/.obsidian/plugins/obsidian-git/data.json
!/docs/handbook/.obsidian/plugins/obsidian-linter/data.json
.obsidian/app.json
.obsidian/appearance.json
.obsidian/hotkeys.json
.obsidian/workspace.json
.obsidian/plugins
!.obsidian/plugins/obsidian-git/data.json
!.obsidian/plugins/obsidian-linter/data.json

File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"plugins/bundle",
"plugins/core",
"plugins/macro",
"plugins/task",
Expand All @@ -23,18 +24,24 @@ keywords = ["declarative-ui", "ecs", "bevy", "dioxus", "cross-platform"]
anyhow = "1.0"
bevy = { version = "0.8", default-features = false }
bevy_ecs = "0.8"
cmd_lib = "1"
config = "0.13"
convert_case = "0.5"
dioxus = { version = "0.2", features = ["fermi"] }
dip = { version = "0.1", path = ".", features = ["desktop"] }
dip_bundle = { version = "0.1", path = "./plugins/bundle", features = ["full"] }
dip_core = { version = "0.1", path = "./plugins/core" }
dip_macro = { version = "0.1", path = "./plugins/macro" }
dip_task = { version = "0.1", path = "./plugins/task" }
dirs = "4.0"
pathdiff = "0.2"
reqwest = { version = "0.11", features = ["json", "blocking"] }
tokio = { version = "1.18", features = ["rt-multi-thread", "sync", "macros", "fs"], default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_repr = "0.1"
tempfile = "3"
walkdir = "2"

[package]
name = "dip"
Expand All @@ -57,6 +64,7 @@ bevy.workspace = true
clap = { version = "3.2", features = ["derive"], optional = true }
config.workspace = true
dioxus.workspace = true
dip_bundle.workspace = true
dip_cli = { version = "0.1", path = "./plugins/ui/cli", optional = true }
dip_core = { version = "0.1", path = "./plugins/core" }
dip_desktop = { version = "0.1", path = "./plugins/ui/desktop", optional = true }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<div align="center">
<h1>dip</h1>
<p align="center">
Expand Down
27 changes: 0 additions & 27 deletions docs/handbook/.obsidian/plugins/obsidian-git/data.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/handbook/Internal
1 change: 1 addition & 0 deletions docs/handbook/Product/Framework/CLI/Installation.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

## Installation

### From Crates.io
Expand Down
23 changes: 23 additions & 0 deletions plugins/bundle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "dip_bundle"
version.workspace = true
edition.workspace = true

[dependencies]
anyhow.workspace = true
bevy.workspace = true
dip_core.workspace = true
dirs.workspace = true
cmd_lib.workspace = true
convert_case.workspace = true
pathdiff.workspace = true
reqwest.workspace = true
tempfile.workspace = true
walkdir.workspace = true

[features]
# default = ["full"]
full = ["dotfiles", "brew", "tailwind"]
dotfiles = []
brew = []
tailwind = []
43 changes: 43 additions & 0 deletions plugins/bundle/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use bevy::app::{App, Plugin};
use std::{fs, path::PathBuf};

pub struct BundleConfigPlugin;

impl Plugin for BundleConfigPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<BundleConfig>();
}
}

pub struct BundleConfig {
app_path: PathBuf,
}

impl Default for BundleConfig {
fn default() -> Self {
Self {
app_path: dirs::home_dir().unwrap().join(".dip"),
}
}
}

impl BundleConfig {
pub fn app_path(&self) -> PathBuf {
Self::ensure_dir(&self.app_path);

self.app_path.clone()
}

pub fn install_path(&self) -> PathBuf {
let p = self.app_path().join("installs");
Self::ensure_dir(&p);

p
}

fn ensure_dir(p: &PathBuf) {
if !&p.is_dir() {
fs::create_dir_all(&p).unwrap();
}
}
}
48 changes: 48 additions & 0 deletions plugins/bundle/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// mod config;
mod schedule;
mod tool;

use bevy::{
app::{App, Plugin},
ecs::event::{EventReader, EventWriter},
};
// pub use config::BundleConfigPlugin;
pub use schedule::{BundleSchedulePlugin, BundleStage};
use std::path::PathBuf;
use tool::{InstallTools, ToolPlugin};

pub struct BundlePlugin;

impl Plugin for BundlePlugin {
fn build(&self, app: &mut App) {
app.add_plugin(BundleSchedulePlugin)
.add_event::<ApplyBundle>()
.add_event::<CleanBundle>()
// .add_plugin(BundleConfigPlugin)
.add_plugin(ToolPlugin)
.add_system_to_stage(BundleStage::First, apply_bundle);
}
}

// Events

#[derive(Clone)]
pub struct ApplyBundle {
pub path: PathBuf,
}

#[derive(Clone)]
pub struct CleanBundle {
pub path: PathBuf,
}

fn apply_bundle(
mut events: EventReader<ApplyBundle>,
mut install_tools: EventWriter<InstallTools>,
) {
events.iter().for_each(|e| {
install_tools.send(InstallTools {
path: e.path.clone(),
});
});
}
46 changes: 46 additions & 0 deletions plugins/bundle/src/schedule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use bevy::{
app::{App, Plugin},
ecs::schedule::{StageLabel, SystemStage},
};
use dip_core::schedule::DipStage;

pub struct BundleSchedulePlugin;

impl Plugin for BundleSchedulePlugin {
fn build(&self, app: &mut App) {
app.add_stage_after(
DipStage::Render,
BundleStage::First,
SystemStage::parallel(),
)
.add_stage_after(
BundleStage::First,
BundleStage::Clean,
SystemStage::parallel(),
)
.add_stage_after(
BundleStage::Clean,
BundleStage::Install,
SystemStage::parallel(),
)
.add_stage_after(
BundleStage::Install,
BundleStage::Apply,
SystemStage::parallel(),
)
.add_stage_after(
BundleStage::Apply,
BundleStage::Last,
SystemStage::parallel(),
);
}
}

#[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)]
pub enum BundleStage {
First,
Clean,
Install,
Apply,
Last,
}
Loading