-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ink0rr/dev
rgl v0.6.0
- Loading branch information
Showing
29 changed files
with
535 additions
and
376 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
[package] | ||
name = "rgl" | ||
version = "0.5.2" | ||
version = "0.6.0" | ||
edition = "2021" | ||
|
||
[[bin]] | ||
name = "rgl" | ||
|
||
[dependencies] | ||
anyhow = "1.0.79" | ||
clap = { version = "4.4.18", features = ["cargo"] } | ||
anyhow = "1.0.80" | ||
clap = { version = "4.5.2", features = ["cargo"] } | ||
dialoguer = "0.11.0" | ||
dunce = "1.0.4" | ||
enum_dispatch = "0.3.12" | ||
fslock = "0.2.1" | ||
indexmap = { version = "2.2.0", features = ["serde"] } | ||
indexmap = { version = "2.2.5", features = ["serde"] } | ||
md5 = "0.7.0" | ||
notify = "6.1.1" | ||
notify-debouncer-mini = "0.4.1" | ||
paris = { version = "1.5.15", features = ["macros"] } | ||
rayon = "1.8.1" | ||
semver = "1.0.21" | ||
serde = { version = "1.0.196", features = ["derive"] } | ||
serde_json = "1.0.112" | ||
tempfile = "3.9.0" | ||
ureq = "2.9.1" | ||
rayon = "1.9.0" | ||
semver = "1.0.22" | ||
serde = { version = "1.0.197", features = ["derive"] } | ||
serde_json = "1.0.114" | ||
tempfile = "3.10.1" | ||
ureq = "2.9.6" | ||
uuid = { version = "1.7.0", features = ["v4"] } | ||
walkdir = "2.4.0" | ||
walkdir = "2.5.0" | ||
which = "6.0.0" | ||
zip = "0.6.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::fs::{empty_dir, try_symlink}; | ||
use crate::info; | ||
use crate::rgl::{Config, Filter, FilterContext, Session}; | ||
use anyhow::Result; | ||
use std::path::Path; | ||
|
||
pub fn apply(filter_name: &str, run_args: Vec<String>) -> Result<()> { | ||
let config = Config::load()?; | ||
let mut session = Session::lock()?; | ||
|
||
let temp = Path::new(".regolith").join("tmp"); | ||
let temp_bp = temp.join("BP"); | ||
let temp_rp = temp.join("RP"); | ||
|
||
empty_dir(&temp)?; | ||
try_symlink(config.get_behavior_pack(), temp_bp)?; | ||
try_symlink(config.get_resource_pack(), temp_rp)?; | ||
try_symlink(config.get_data_path(), temp.join("data"))?; | ||
|
||
let filter = config.get_filter(filter_name)?; | ||
let context = FilterContext::new(filter.get_type(), filter_name)?; | ||
filter.run(&context, &temp, &run_args)?; | ||
info!("Successfully applied filter <b>{filter_name}</>"); | ||
|
||
session.unlock() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::info; | ||
use crate::rgl::{FilterInstaller, FilterType}; | ||
use anyhow::Result; | ||
|
||
pub fn install_tools(tools: Vec<&String>, force: bool) -> Result<()> { | ||
for arg in tools { | ||
info!("Installing tool <b>{}</>...", arg); | ||
let tool = FilterInstaller::from_arg(arg)?; | ||
if tool.install(FilterType::Tool, None, force)? { | ||
info!("Tool <b>{}</> successfully installed", tool.name); | ||
} | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
mod add; | ||
mod apply; | ||
mod clean; | ||
mod get; | ||
mod init; | ||
mod install; | ||
mod list; | ||
mod remove; | ||
mod run; | ||
mod tool; | ||
mod uninstall; | ||
mod update; | ||
|
||
pub use self::add::*; | ||
pub use self::apply::*; | ||
pub use self::clean::*; | ||
pub use self::get::*; | ||
pub use self::init::*; | ||
pub use self::install::*; | ||
pub use self::list::*; | ||
pub use self::remove::*; | ||
pub use self::run::*; | ||
pub use self::tool::*; | ||
pub use self::uninstall::*; | ||
pub use self::update::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::fs::{empty_dir, read_json, try_symlink}; | ||
use crate::rgl::{Config, Filter, FilterContext, FilterType, RemoteFilterConfig, Session}; | ||
use anyhow::{Context, Result}; | ||
use std::path::Path; | ||
|
||
pub fn tool(tool_name: &str, run_args: Vec<String>) -> Result<()> { | ||
let config = Config::load()?; | ||
let mut session = Session::lock()?; | ||
|
||
let temp = Path::new(".regolith").join("tmp"); | ||
let temp_bp = temp.join("BP"); | ||
let temp_rp = temp.join("RP"); | ||
|
||
empty_dir(&temp)?; | ||
try_symlink(config.get_behavior_pack(), temp_bp)?; | ||
try_symlink(config.get_resource_pack(), temp_rp)?; | ||
try_symlink(config.get_data_path(), temp.join("data"))?; | ||
|
||
let context = FilterContext::new(FilterType::Tool, tool_name)?; | ||
let config_path = context.filter_dir.join("filter.json"); | ||
let config = read_json::<RemoteFilterConfig>(config_path) | ||
.context(format!("Failed to load config for tool <b>{tool_name}</>"))?; | ||
|
||
for filter in config.filters { | ||
filter.run(&context, &temp, &run_args)?; | ||
} | ||
|
||
session.unlock() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::fs::rimraf; | ||
use crate::rgl::FilterType; | ||
use crate::{info, warn}; | ||
use anyhow::Result; | ||
|
||
pub fn uninstall_tools(tools: Vec<&String>) -> Result<()> { | ||
for name in tools { | ||
let filter_dir = FilterType::Tool.cache_dir(name)?; | ||
if filter_dir.exists() { | ||
rimraf(filter_dir)?; | ||
info!("Uninstalled tool <b>{name}</>"); | ||
} else { | ||
warn!("Tool <b>{name}</> not found"); | ||
} | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.