Skip to content

Commit

Permalink
remove update because Gradle already has it
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason5Lee committed Jan 17, 2022
1 parent f947495 commit c64180a
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 275 deletions.
20 changes: 1 addition & 19 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gradle-util-rs"
version = "0.1.0-alpha.0"
version = "0.1.0-alpha.1"
edition = "2021"
description = "Gradle util written in Rust"
repository = "https://github.com/jason5lee/gradle-util-rs"
Expand All @@ -10,12 +10,9 @@ keywords = [ "gradle" ]

[dependencies]
log = "0.4"
home = "0.5"
notify = "4.0"
env_logger = "0.9"
clap = { version = "3.0", features = ["derive"] }
once_cell = "1.9"
regex = "1.5"
humantime = "2.1"

[[bin]]
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ This is made as a workaround of [IDEA-177325](https://youtrack.jetbrains.com/iss
Example:

`gur set-new --watch-dir path1 --watch-dir path2 --gradle-version 7.3` : watch the gradle project creation under `path1` and `path2` recursively, and create the gradle wrapper properties for the new projects using gradle version `7.3`.

### `update`

This command can update the gradle version in the gradle wrapper properties file. You can set one or multiple gradle versions. If your project gradle version is `a.b.c` or `a.b`, and one of the version you set is `a.b.d` where `d > c`, it will update the gradle version in the wrapper properties file to `a.b.d`.
14 changes: 2 additions & 12 deletions src/bin/gur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use gradle_util_rs::LoggedSideEffect;
use std::time::Duration;

#[derive(Parser)]
#[clap(name = "gur", version = "0.1.0", about = "A Gradle utility")]
#[clap(name = "gur", version = "0.1.0-alpha.1", about = "A Gradle utility")]
struct Cli {
#[clap(subcommand)]
command: Command,
Expand All @@ -23,16 +23,7 @@ enum Command {
watch_dir: Vec<String>,
#[clap(long, default_value = "1s", parse(try_from_str = humantime::parse_duration), help = "Duration of file watching delay. Default to 1 second.")]
watch_duration: Duration,
},
#[clap(about = "Update the Gradle version if it matches the major and the minor number")]
Update {
#[clap(
long,
required = true,
help = "Version that may be updated to. You can have multiple version parameters."
)]
version: Vec<String>,
},
}
}

fn main() {
Expand All @@ -49,7 +40,6 @@ fn main() {
watch_dir,
watch_duration,
} => gradle_util_rs::set_new::set_new(watch_dir, gradle_version, watch_duration),
Command::Update { version: versions } => gradle_util_rs::update::update(versions),
}
.ignore_logged_error()
}
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ impl LoggedSideEffect for Result<(), Logged> {
}

pub mod set_new;
pub mod update;
5 changes: 2 additions & 3 deletions src/set_new.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use notify::{DebouncedEvent, RecursiveMode, Watcher};
use std::ffi::OsStr;
use std::path::PathBuf;
use std::{ffi::OsStr, path::Path};
use std::sync::mpsc;
use std::time::Duration;

Expand Down Expand Up @@ -64,7 +63,7 @@ zipStorePath=wrapper/dists"#,
)
}

fn write_wrapper_properties(path: &PathBuf, version: &str) -> Result<(), Logged> {
fn write_wrapper_properties(path: &Path, version: &str) -> Result<(), Logged> {
std::fs::write(path, wrapper_properties_content(version)).map_err(|err| {
log_error!(
"Error while writing to gradle wrapper properties file. {}.",
Expand Down
61 changes: 0 additions & 61 deletions src/update.rs

This file was deleted.

90 changes: 0 additions & 90 deletions src/update/tests.rs

This file was deleted.

81 changes: 0 additions & 81 deletions src/update/version.rs

This file was deleted.

0 comments on commit c64180a

Please sign in to comment.