From 72d49c5a107efdd6a2900183939935f0f6d13d5b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Jul 2018 22:17:33 +0300 Subject: cmd to install code extension --- .cargo/config | 2 ++ tools/Cargo.toml | 1 + tools/src/main.rs | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/.cargo/config b/.cargo/config index 7903b919c..0e9e0f387 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,5 +1,7 @@ [alias] gen-kinds = "run --package tools -- gen-kinds" gen-tests = "run --package tools -- gen-tests" +install-code = "run --package tools -- install-code" + render-test = "run --package cli -- render-test" parse = "run --package cli -- parse" diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 4fcddebf0..f9fee16f9 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -11,3 +11,4 @@ itertools = "0.7.8" tera = "0.11" clap = "2.32.0" failure = "0.1.1" +commandspec = "0.10" diff --git a/tools/src/main.rs b/tools/src/main.rs index 7d7b2afc0..84a0cf1b6 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs @@ -5,6 +5,8 @@ extern crate ron; extern crate tera; extern crate walkdir; extern crate tools; +#[macro_use] +extern crate commandspec; use std::{collections::{HashSet, HashMap}, fs, path::Path}; use clap::{App, Arg, SubCommand}; @@ -29,8 +31,10 @@ fn main() -> Result<()> { ) .subcommand(SubCommand::with_name("gen-kinds")) .subcommand(SubCommand::with_name("gen-tests")) + .subcommand(SubCommand::with_name("install-code")) .get_matches(); match matches.subcommand() { + ("install-code", _) => install_code_extension()?, (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?, _ => unreachable!(), } @@ -149,3 +153,19 @@ fn existing_tests(dir: &Path) -> Result> { } Ok(res) } + +fn install_code_extension() -> Result<()> { + execute!(r" +cd code +npm install + ")?; + execute!(r" +cd code +./node_modules/vsce/out/vsce package + ")?; + execute!(r" +cd code +code --install-extension ./libsyntax-rust-0.0.1.vsix + ")?; + Ok(()) +} -- cgit v1.2.3