Compare commits

...

9 Commits

Author SHA1 Message Date
Adrian Malacoda
b948f685e4 add document-activate handler, this is fired when user switches over to a document 2019-04-26 23:27:35 -05:00
Adrian Malacoda
d550196ff7 add script for installing build-dependencies 2019-04-26 20:55:38 -05:00
Adrian Malacoda
7398c1fd56 figure out how to add signal callbacks 2019-04-22 03:05:43 -05:00
Adrian Malacoda
f94feb50f9 Add build/install/run commands to shenlong. 2019-02-19 01:11:43 -06:00
Adrian Malacoda
99d3e51e5d add install command 2019-02-19 00:59:08 -06:00
Adrian Malacoda
cc4e83ed53 Readme of Scouter 2019-02-19 00:47:06 -06:00
Adrian Malacoda
7edd1ca475 WIP of project commands. Not sure if this should be in scouter library or in main shenlong binary yet though. 2019-02-19 00:44:55 -06:00
Adrian Malacoda
c399677ab7 add support for parsing Maven project information (using effective pom) 2019-02-19 00:41:27 -06:00
Adrian Malacoda
dee9a61d87 set current_dir of the metadata command to project path 2019-02-18 22:41:38 -06:00
9 changed files with 435 additions and 13 deletions

129
Cargo.lock generated
View File

@@ -1,3 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.6.9" version = "0.6.9"
@@ -87,6 +89,18 @@ name = "c_str_macro"
version = "1.0.2" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cargo_metadata"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.28" version = "1.0.28"
@@ -141,6 +155,14 @@ dependencies = [
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "error-chain"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "failure" name = "failure"
version = "0.1.5" version = "0.1.5"
@@ -171,6 +193,11 @@ dependencies = [
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "itoa"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.2.0" version = "1.2.0"
@@ -221,6 +248,11 @@ name = "peeking_take_while"
version = "0.1.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "peresil"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.14" version = "0.3.14"
@@ -285,6 +317,11 @@ name = "rustc-demangle"
version = "0.1.13" version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ryu"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "0.3.3" version = "0.3.3"
@@ -293,6 +330,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "scouter" name = "scouter"
version = "0.0.1" version = "0.0.1"
dependencies = [
"cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-xpath 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_derive"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "shenlong" name = "shenlong"
@@ -321,6 +402,35 @@ name = "strsim"
version = "0.7.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "sxd-document"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sxd-xpath"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.0.4" version = "1.0.4"
@@ -355,6 +465,11 @@ dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "typed-arena"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "ucd-util" name = "ucd-util"
version = "0.1.3" version = "0.1.3"
@@ -441,16 +556,19 @@ dependencies = [
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
"checksum c_str_macro 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2e08268d37bbcbf98f70312c449a35763d3f85beafbedbb4e28b4c438e2b5bd" "checksum c_str_macro 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2e08268d37bbcbf98f70312c449a35763d3f85beafbedbb4e28b4c438e2b5bd"
"checksum cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "585784cac9b05c93a53b17a0b24a5cdd1dfdda5256f030e089b549d2390cc720"
"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
"checksum cexpr 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "644d693ecfa91955ed32dcc7eda4914e1be97a641fb6f0645a37348e20b230da" "checksum cexpr 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "644d693ecfa91955ed32dcc7eda4914e1be97a641fb6f0645a37348e20b230da"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"checksum clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef0c1bcf2e99c649104bd7a7012d8f8802684400e03db0ec0af48583c6fa0e4" "checksum clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef0c1bcf2e99c649104bd7a7012d8f8802684400e03db0ec0af48583c6fa0e4"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da"
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047"
"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2"
@@ -458,6 +576,7 @@ dependencies = [
"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8"
"checksum nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b30adc557058ce00c9d0d7cb3c6e0b5bc6f36e2e2eabe74b0ba726d194abd588" "checksum nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b30adc557058ce00c9d0d7cb3c6e0b5bc6f36e2e2eabe74b0ba726d194abd588"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
@@ -467,12 +586,22 @@ dependencies = [
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861"
"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "9f301d728f2b94c9a7691c90f07b0b4e8a4517181d9461be94c04bddeb4bd850"
"checksum serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "beed18e6f5175aef3ba670e57c60ef3b1b74d250d962a26604bff4c80e970dd4"
"checksum serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "27dce848e7467aa0e2fcaf0a413641499c0b745452aaca1194d24dedde9e13c9"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f9daa5f04135690dcb001fd5d4f1d536d62e988262954e68abb3ab7db36a4f9"
"checksum sxd-xpath 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea"
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6c06a92aef38bb4dc5b0df00d68496fc31307c5344c867bb61678c6e1671ec5"
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"

2
install_builddeps Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
sudo apt-get build-dep clang geany geany-plugins

41
scouter/Cargo.lock generated
View File

@@ -65,6 +65,11 @@ name = "libc"
version = "0.2.48" version = "0.2.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "peresil"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.27" version = "0.4.27"
@@ -73,6 +78,11 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "quick-error"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "quote" name = "quote"
version = "0.6.11" version = "0.6.11"
@@ -96,6 +106,8 @@ name = "scouter"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-xpath 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -137,6 +149,25 @@ dependencies = [
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "sxd-document"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sxd-xpath"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "0.15.26" version = "0.15.26"
@@ -147,6 +178,11 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "typed-arena"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.1.0" version = "0.1.0"
@@ -181,7 +217,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047"
"checksum peresil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
@@ -190,7 +228,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "9f301d728f2b94c9a7691c90f07b0b4e8a4517181d9461be94c04bddeb4bd850" "checksum serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "9f301d728f2b94c9a7691c90f07b0b4e8a4517181d9461be94c04bddeb4bd850"
"checksum serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "beed18e6f5175aef3ba670e57c60ef3b1b74d250d962a26604bff4c80e970dd4" "checksum serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "beed18e6f5175aef3ba670e57c60ef3b1b74d250d962a26604bff4c80e970dd4"
"checksum serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "27dce848e7467aa0e2fcaf0a413641499c0b745452aaca1194d24dedde9e13c9" "checksum serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "27dce848e7467aa0e2fcaf0a413641499c0b745452aaca1194d24dedde9e13c9"
"checksum sxd-document 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f9daa5f04135690dcb001fd5d4f1d536d62e988262954e68abb3ab7db36a4f9"
"checksum sxd-xpath 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea"
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6c06a92aef38bb4dc5b0df00d68496fc31307c5344c867bb61678c6e1671ec5"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

View File

@@ -6,3 +6,5 @@ edition = "2018"
[dependencies] [dependencies]
cargo_metadata = "0.7.1" cargo_metadata = "0.7.1"
sxd-xpath = "0.4.2"
sxd-document = "0.3.0"

5
scouter/README.md Normal file
View File

@@ -0,0 +1,5 @@
# Scouter
Small library for detecting and gathering information about projects.
## License
GNU AGPLv3 or later.

View File

@@ -1,4 +1,5 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum ProjectType { pub enum ProjectType {
@@ -20,6 +21,30 @@ impl ProjectType {
None None
} }
pub fn build_command(&self) -> Vec<String> {
match self {
ProjectType::Maven => vec!["mvn".to_owned(), "install".to_owned()],
ProjectType::Npm => vec!["npm".to_owned(), "build".to_owned()],
ProjectType::Cargo => vec!["cargo".to_owned(), "build".to_owned()]
}
}
pub fn run_command(&self) -> Vec<String> {
match self {
ProjectType::Maven => vec!["mvn".to_owned(), "exec".to_owned()],
ProjectType::Npm => vec!["npm".to_owned(), "start".to_owned()],
ProjectType::Cargo => vec!["cargo".to_owned(), "run".to_owned()]
}
}
pub fn install_command(&self) -> Vec<String> {
match self {
ProjectType::Maven => vec!["mvn".to_owned(), "install".to_owned()],
ProjectType::Npm => vec!["npm".to_owned(), "install".to_owned()],
ProjectType::Cargo => vec!["cargo".to_owned(), "install".to_owned()]
}
}
} }
#[derive(Debug)] #[derive(Debug)]
@@ -35,9 +60,9 @@ impl Project {
pub fn info(&self) -> ProjectInfo { pub fn info(&self) -> ProjectInfo {
match self.project_type { match self.project_type {
ProjectType::Maven => ProjectInfo { ProjectType::Maven => {
name: "placeholder".into(), let effective_pom = self.read_effective_pom();
version: "placeholder".into() ProjectInfo::from_pom(&effective_pom)
}, },
ProjectType::Npm => ProjectInfo { ProjectType::Npm => ProjectInfo {
name: "placeholder".into(), name: "placeholder".into(),
@@ -48,7 +73,25 @@ impl Project {
} }
fn read_cargo_metadata(&self) -> cargo_metadata::Metadata { fn read_cargo_metadata(&self) -> cargo_metadata::Metadata {
cargo_metadata::MetadataCommand::new().exec().expect("metadata call failed") cargo_metadata::MetadataCommand::new()
.current_dir(&self.path)
.exec()
.expect("metadata call failed")
}
fn read_effective_pom(&self) -> sxd_document::Package {
let full_output = std::str::from_utf8(&Command::new("mvn")
.arg("help:effective-pom")
.current_dir(&self.path)
.output()
.expect("failed to generate effective pom")
.stdout).expect("failed to generate string from output").to_owned();
let xml = full_output.get(
full_output.find("<?xml").expect("failed to find start of xml")
..
full_output.find("</project>").expect("failed to find end of xml") + 10
).expect("failed to extract xml body");
sxd_document::parser::parse(xml).expect("failed to parse effective pom")
} }
} }
@@ -74,6 +117,32 @@ impl From<cargo_metadata::Metadata> for ProjectInfo {
} }
} }
impl ProjectInfo {
fn from_pom(pom: &sxd_document::Package) -> Self {
let document = pom.as_document();
let mut context = sxd_xpath::context::Context::new();
context.set_namespace("mvn", "http://maven.apache.org/POM/4.0.0");
let factory = sxd_xpath::Factory::new();
let name_xpath = factory.build("/mvn:project/mvn:name")
.expect("failed to compile name xpath")
.expect("No XPath was compiled");
let version_xpath = factory.build("/mvn:project/mvn:version")
.expect("failed to compile name xpath")
.expect("No XPath was compiled");
ProjectInfo {
name: name_xpath.evaluate(&context, document.root())
.expect("failed to evaluate name expression")
.into_string(),
version: version_xpath.evaluate(&context, document.root())
.expect("failed to evaluate version expression")
.into_string(),
}
}
}
pub struct Scouter { pub struct Scouter {
search_path: PathBuf search_path: PathBuf
} }
@@ -126,4 +195,14 @@ mod test {
assert_eq!(env!("CARGO_PKG_NAME"), project_info.name); assert_eq!(env!("CARGO_PKG_NAME"), project_info.name);
assert_eq!(env!("CARGO_PKG_VERSION"), project_info.version); assert_eq!(env!("CARGO_PKG_VERSION"), project_info.version);
} }
#[test]
fn test_maven_project() {
let mut scouter = Scouter::new(format!("{}/testdata/maven", env!("CARGO_MANIFEST_DIR")));
let project = scouter.next().unwrap();
let project_info = project.info();
assert_eq!(ProjectType::Maven, project.project_type);
assert_eq!("Shenlong Maven Test Project", project_info.name);
assert_eq!("1.0.0-SNAPSHOT", project_info.version);
}
} }

42
scouter/testdata/maven/pom.xml vendored Normal file
View File

@@ -0,0 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.monarchpass</groupId>
<artifactId>shenlong-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Shenlong Maven Test Project</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,8 +1,47 @@
use c_str_macro::c_str; use c_str_macro::c_str;
use shenlong_sys::*; use shenlong_sys::*;
use std::ffi::CStr;
use std::ptr;
use std::mem::transmute;
use scouter::Scouter;
extern "C" fn shenlong_init(plugin: *mut GeanyPlugin, pdata: gpointer) -> gboolean { extern "C" fn shenlong_init(plugin: *mut GeanyPlugin, pdata: gpointer) -> gboolean {
println!("shenlong init"); println!("shenlong init");
unsafe {
plugin_signal_connect(
plugin,
ptr::null_mut(),
c_str!("document-open").to_owned().as_ptr(),
0,
Some(transmute(shenlong_document_open as usize)),
ptr::null_mut()
);
plugin_signal_connect(
plugin,
ptr::null_mut(),
c_str!("document-activate").to_owned().as_ptr(),
0,
Some(transmute(shenlong_document_activate as usize)),
ptr::null_mut()
);
plugin_signal_connect(
plugin,
ptr::null_mut(),
c_str!("document-new").to_owned().as_ptr(),
0,
Some(transmute(shenlong_document_new as usize)),
ptr::null_mut()
);
plugin_signal_connect(
plugin,
ptr::null_mut(),
c_str!("document-save").to_owned().as_ptr(),
0,
Some(transmute(shenlong_document_save as usize)),
ptr::null_mut()
);
}
1 1
} }
@@ -10,6 +49,38 @@ extern "C" fn shenlong_cleanup(plugin: *mut GeanyPlugin, pdata: gpointer) {
println!("shenlong cleanup"); println!("shenlong cleanup");
} }
extern "C" fn shenlong_document_open(obj: *mut GObject, doc: *mut GeanyDocument, user_data: gpointer) {
let document_path = unsafe { CStr::from_ptr((*doc).real_path).to_str().expect("failed to get document path") };
println!("shenlong document open: {:?}", document_path);
let mut scouter = Scouter::new(document_path);
if let Some(project) = scouter.next() {
println!("-- shenlong project open: {:?}", project);
}
}
extern "C" fn shenlong_document_activate(obj: *mut GObject, doc: *mut GeanyDocument, user_data: gpointer) {
let document_path = unsafe { CStr::from_ptr((*doc).real_path).to_str().expect("failed to get document path") };
println!("shenlong document activate: {:?}", document_path);
let mut scouter = Scouter::new(document_path);
if let Some(project) = scouter.next() {
println!("-- shenlong project open: {:?}", project);
}
}
extern "C" fn shenlong_document_new(obj: *mut GObject, doc: *mut GeanyDocument, user_data: gpointer) {
println!("shenlong document new");
}
extern "C" fn shenlong_document_save(obj: *mut GObject, doc: *mut GeanyDocument, user_data: gpointer) {
unsafe {
println!("shenlong document save: {:?}", CStr::from_ptr((*doc).real_path).to_str());
}
}
extern "C" fn shenlong_empty_callback() {
println!("shenlong empty callback");
}
#[no_mangle] #[no_mangle]
pub extern "C" fn geany_load_module(plugin: *mut GeanyPlugin) { pub extern "C" fn geany_load_module(plugin: *mut GeanyPlugin) {
println!("loading shenlong module"); println!("loading shenlong module");
@@ -24,6 +95,52 @@ pub extern "C" fn geany_load_module(plugin: *mut GeanyPlugin) {
plugin_funcs.init = Some(shenlong_init); plugin_funcs.init = Some(shenlong_init);
plugin_funcs.cleanup = Some(shenlong_cleanup); plugin_funcs.cleanup = Some(shenlong_cleanup);
/*let mut plugin_callbacks: [PluginCallback; 6] = [
PluginCallback {
signal_name: c_str!("document-open").to_owned().into_raw(),
callback: Some(transmute(shenlong_document_open as usize)),
//callback: Some(shenlong_empty_callback),
after: 0,
user_data: ptr::null_mut()
},
PluginCallback {
signal_name: c_str!("document-new").to_owned().into_raw(),
//callback: Some(transmute(shenlong_document_new as usize)),
callback: Some(shenlong_empty_callback),
after: 0,
user_data: ptr::null_mut()
},
PluginCallback {
signal_name: c_str!("document-close").to_owned().into_raw(),
//callback: Some(transmute(shenlong_document_new as usize)),
callback: Some(shenlong_empty_callback),
after: 0,
user_data: ptr::null_mut()
},
PluginCallback {
signal_name: c_str!("document-save").to_owned().into_raw(),
//callback: Some(transmute(shenlong_document_save as usize)),
callback: Some(shenlong_empty_callback),
after: 0,
user_data: ptr::null_mut()
},
PluginCallback {
signal_name: c_str!("document-reload").to_owned().into_raw(),
//callback: Some(transmute(shenlong_document_new as usize)),
callback: Some(shenlong_empty_callback),
after: 0,
user_data: ptr::null_mut()
},
PluginCallback {
signal_name: ptr::null(),
callback: None,
after: 0,
user_data: ptr::null_mut()
}
];
plugin_funcs.callbacks = plugin_callbacks.as_mut_ptr();*/
geany_plugin_register(plugin, 235, GEANY_API_VERSION as i32, GEANY_ABI_VERSION as i32); geany_plugin_register(plugin, 235, GEANY_API_VERSION as i32, GEANY_ABI_VERSION as i32);
} }
println!("... shenlong module loaded");
} }

View File

@@ -14,16 +14,21 @@ fn main() {
match args.next().as_ref().map(|arg| arg.as_str()) { match args.next().as_ref().map(|arg| arg.as_str()) {
Some("info") => println!("{:?}", project.info()), Some("info") => println!("{:?}", project.info()),
Some("where") => println!("{}", project.path().display()), Some("where") => println!("{}", project.path().display()),
Some("run") => { Some("build") => execute_command_in_project(&project, project.project_type.build_command().into_iter()),
Command::new(args.next().unwrap()) Some("install") => execute_command_in_project(&project, project.project_type.install_command().into_iter()),
.args(args) Some("start") => execute_command_in_project(&project, project.project_type.run_command().into_iter()),
.current_dir(project.path()) Some("run") => execute_command_in_project(&project, args),
.spawn()
.expect("command failed to start")
.wait()
.expect("failed to wait on child");
},
Some(_) => println!("unrecognized command"), Some(_) => println!("unrecognized command"),
None => println!("{:?}", project) None => println!("{:?}", project)
} }
} }
fn execute_command_in_project<C: Iterator<Item=String>>(project: &scouter::Project, mut command: C) {
Command::new(command.next().unwrap())
.args(command)
.current_dir(project.path())
.spawn()
.expect("command failed to start")
.wait()
.expect("failed to wait on child");
}