aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/tools/Cargo.toml1
-rw-r--r--crates/tools/src/main.rs42
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"
11tera = "0.11" 11tera = "0.11"
12clap = "2.32.0" 12clap = "2.32.0"
13failure = "0.1.1" 13failure = "0.1.1"
14commandspec = "0.10"
15heck = "0.3.0" 14heck = "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;
5extern crate tera; 5extern crate tera;
6extern crate tools; 6extern crate tools;
7extern crate walkdir; 7extern crate walkdir;
8#[macro_use]
9extern crate commandspec;
10extern crate heck; 8extern crate heck;
11 9
12use clap::{App, Arg, SubCommand}; 10use 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};
19use tools::{collect_tests, Test}; 18use tools::{collect_tests, Test};
20 19
@@ -191,24 +190,25 @@ fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> {
191} 190}
192 191
193fn install_code_extension() -> Result<()> { 192fn 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")?;
197cd code 196 run(r"code --install-extension ./rcf-lsp-0.0.1.vsix", "./code")?;
198npm install 197 Ok(())
199 " 198}
200 )?; 199
201 execute!( 200fn run(cmdline: &'static str, dir: &str) -> Result<()> {
202 r" 201 eprintln!("\nwill run: {}", cmdline);
203cd 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)
209cd code 208 .current_dir(project_dir)
210code --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}