aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-30 20:17:33 +0100
committerAleksey Kladov <[email protected]>2018-07-30 20:17:33 +0100
commit72d49c5a107efdd6a2900183939935f0f6d13d5b (patch)
tree7d9a27b0e981d879e81faf4d042d2419625609dc
parentac0d8c48f7a277d4a43448fe7dd4279383bc53f0 (diff)
cmd to install code extension
-rw-r--r--.cargo/config2
-rw-r--r--tools/Cargo.toml1
-rw-r--r--tools/src/main.rs20
3 files changed, 23 insertions, 0 deletions
diff --git a/.cargo/config b/.cargo/config
index 7903b919c..0e9e0f387 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,5 +1,7 @@
1[alias] 1[alias]
2gen-kinds = "run --package tools -- gen-kinds" 2gen-kinds = "run --package tools -- gen-kinds"
3gen-tests = "run --package tools -- gen-tests" 3gen-tests = "run --package tools -- gen-tests"
4install-code = "run --package tools -- install-code"
5
4render-test = "run --package cli -- render-test" 6render-test = "run --package cli -- render-test"
5parse = "run --package cli -- parse" 7parse = "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"
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"
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;
5extern crate tera; 5extern crate tera;
6extern crate walkdir; 6extern crate walkdir;
7extern crate tools; 7extern crate tools;
8#[macro_use]
9extern crate commandspec;
8 10
9use std::{collections::{HashSet, HashMap}, fs, path::Path}; 11use std::{collections::{HashSet, HashMap}, fs, path::Path};
10use clap::{App, Arg, SubCommand}; 12use clap::{App, Arg, SubCommand};
@@ -29,8 +31,10 @@ fn main() -> Result<()> {
29 ) 31 )
30 .subcommand(SubCommand::with_name("gen-kinds")) 32 .subcommand(SubCommand::with_name("gen-kinds"))
31 .subcommand(SubCommand::with_name("gen-tests")) 33 .subcommand(SubCommand::with_name("gen-tests"))
34 .subcommand(SubCommand::with_name("install-code"))
32 .get_matches(); 35 .get_matches();
33 match matches.subcommand() { 36 match matches.subcommand() {
37 ("install-code", _) => install_code_extension()?,
34 (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?, 38 (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?,
35 _ => unreachable!(), 39 _ => unreachable!(),
36 } 40 }
@@ -149,3 +153,19 @@ fn existing_tests(dir: &Path) -> Result<HashSet<Test>> {
149 } 153 }
150 Ok(res) 154 Ok(res)
151} 155}
156
157fn install_code_extension() -> Result<()> {
158 execute!(r"
159cd code
160npm install
161 ")?;
162 execute!(r"
163cd code
164./node_modules/vsce/out/vsce package
165 ")?;
166 execute!(r"
167cd code
168code --install-extension ./libsyntax-rust-0.0.1.vsix
169 ")?;
170 Ok(())
171}