diff options
Diffstat (limited to 'crates/tools')
-rw-r--r-- | crates/tools/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/tools/src/main.rs | 42 |
2 files changed, 21 insertions, 22 deletions
diff --git a/crates/tools/Cargo.toml b/crates/tools/Cargo.toml index 32a6fbc91..d03910986 100644 --- a/crates/tools/Cargo.toml +++ b/crates/tools/Cargo.toml | |||
@@ -11,5 +11,4 @@ itertools = "0.7.8" | |||
11 | tera = "0.11" | 11 | tera = "0.11" |
12 | clap = "2.32.0" | 12 | clap = "2.32.0" |
13 | failure = "0.1.1" | 13 | failure = "0.1.1" |
14 | commandspec = "0.10" | ||
15 | heck = "0.3.0" | 14 | heck = "0.3.0" |
diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 5bfaf18f1..3f9caa4be 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs | |||
@@ -5,8 +5,6 @@ extern crate ron; | |||
5 | extern crate tera; | 5 | extern crate tera; |
6 | extern crate tools; | 6 | extern crate tools; |
7 | extern crate walkdir; | 7 | extern crate walkdir; |
8 | #[macro_use] | ||
9 | extern crate commandspec; | ||
10 | extern crate heck; | 8 | extern crate heck; |
11 | 9 | ||
12 | use clap::{App, Arg, SubCommand}; | 10 | use clap::{App, Arg, SubCommand}; |
@@ -15,6 +13,7 @@ use std::{ | |||
15 | collections::HashMap, | 13 | collections::HashMap, |
16 | fs, | 14 | fs, |
17 | path::{Path, PathBuf}, | 15 | path::{Path, PathBuf}, |
16 | process::Command, | ||
18 | }; | 17 | }; |
19 | use tools::{collect_tests, Test}; | 18 | use tools::{collect_tests, Test}; |
20 | 19 | ||
@@ -191,24 +190,25 @@ fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> { | |||
191 | } | 190 | } |
192 | 191 | ||
193 | fn install_code_extension() -> Result<()> { | 192 | fn install_code_extension() -> Result<()> { |
194 | execute!(r"cargo install --path crates/server --force")?; | 193 | run("cargo install --path crates/server --force", ".")?; |
195 | execute!( | 194 | run(r"npm install", "./code")?; |
196 | r" | 195 | run(r"./node_modules/vsce/out/vsce package", "./code")?; |
197 | cd code | 196 | run(r"code --install-extension ./rcf-lsp-0.0.1.vsix", "./code")?; |
198 | npm install | 197 | Ok(()) |
199 | " | 198 | } |
200 | )?; | 199 | |
201 | execute!( | 200 | fn run(cmdline: &'static str, dir: &str) -> Result<()> { |
202 | r" | 201 | eprintln!("\nwill run: {}", cmdline); |
203 | cd code | 202 | let manifest_dir = env!("CARGO_MANIFEST_DIR"); |
204 | ./node_modules/vsce/out/vsce package | 203 | let project_dir = Path::new(manifest_dir).ancestors().nth(2).unwrap().join(dir); |
205 | " | 204 | let mut args = cmdline.split_whitespace(); |
206 | )?; | 205 | let exec = args.next().unwrap(); |
207 | execute!( | 206 | let status = Command::new(exec) |
208 | r" | 207 | .args(args) |
209 | cd code | 208 | .current_dir(project_dir) |
210 | code --install-extension ./rcf-lsp-0.0.1.vsix | 209 | .status()?; |
211 | " | 210 | if !status.success() { |
212 | )?; | 211 | bail!("`{}` exited with {}", cmdline, status); |
212 | } | ||
213 | Ok(()) | 213 | Ok(()) |
214 | } | 214 | } |