From ecb1327fed1ece4083aa09255dbd927c5df304ef Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 27 Jul 2019 14:35:18 +0300 Subject: Overhaul installation process The new commands are $ cargo install-ra --client-code $ cargo install-ra --server --jemalloc --- crates/ra_tools/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crates/ra_tools/src/lib.rs') diff --git a/crates/ra_tools/src/lib.rs b/crates/ra_tools/src/lib.rs index 79fbcd11d..bb7845f7d 100644 --- a/crates/ra_tools/src/lib.rs +++ b/crates/ra_tools/src/lib.rs @@ -79,6 +79,29 @@ pub fn project_root() -> PathBuf { Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf() } +pub struct Cmd { + pub unix: &'static str, + pub windows: &'static str, + pub work_dir: &'static str, +} + +impl Cmd { + pub fn run(self) -> Result<()> { + if cfg!(windows) { + run(self.windows, self.work_dir) + } else { + run(self.unix, self.work_dir) + } + } + pub fn run_with_output(self) -> Result { + if cfg!(windows) { + run_with_output(self.windows, self.work_dir) + } else { + run_with_output(self.unix, self.work_dir) + } + } +} + pub fn run(cmdline: &str, dir: &str) -> Result<()> { do_run(cmdline, dir, |c| { c.stdout(Stdio::inherit()); -- cgit v1.2.3