diff --git a/Cargo.lock b/Cargo.lock index 1b389e99..80ecf73f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -697,7 +697,6 @@ version = "0.1.0" dependencies = [ "core_model", "dockerfile-parser", - "jenkinsfile", "plugin_interface", ] @@ -747,7 +746,7 @@ version = "0.1.0" dependencies = [ "core_model", "gumdrop", - "jdp", + "jenkinsfile", "pest", "pest_derive", "plugin_interface", @@ -1184,19 +1183,6 @@ dependencies = [ "syn 1.0.58", ] -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime 1.3.0", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.8.2" @@ -1204,7 +1190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" dependencies = [ "atty", - "humantime 2.1.0", + "humantime", "log", "regex", "termcolor", @@ -1715,15 +1701,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - [[package]] name = "humantime" version = "2.1.0" @@ -1857,19 +1834,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -[[package]] -name = "jdp" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4c8a57edb766bb70f5966429c8b8ca797ea3cb8bfa1c3700207a9784226581b" -dependencies = [ - "gumdrop", - "log", - "pest", - "pest_derive", - "pretty_env_logger", -] - [[package]] name = "jenkinsfile" version = "0.1.1" @@ -2539,16 +2503,6 @@ dependencies = [ "output_vt100", ] -[[package]] -name = "pretty_env_logger" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" -dependencies = [ - "env_logger 0.7.1", - "log", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3634,7 +3588,7 @@ dependencies = [ "dashmap", "dirs", "encoding_rs_io", - "env_logger 0.8.2", + "env_logger", "grep-searcher", "ignore", "log", diff --git a/plugins/coco_container/Cargo.toml b/plugins/coco_container/Cargo.toml index a5276880..7a7e0ae8 100644 --- a/plugins/coco_container/Cargo.toml +++ b/plugins/coco_container/Cargo.toml @@ -8,7 +8,6 @@ edition = "2018" [dependencies] dockerfile-parser = "0.7.1" -jenkinsfile = "0.1.1" [dependencies.core_model] path = "../../core_model" diff --git a/plugins/coco_container/src/lib.rs b/plugins/coco_container/src/lib.rs index 290dfb61..80e19501 100644 --- a/plugins/coco_container/src/lib.rs +++ b/plugins/coco_container/src/lib.rs @@ -31,7 +31,6 @@ pub fn plugin() -> Box { #[cfg(test)] mod tests { use dockerfile_parser::Dockerfile; - use jenkinsfile::Jenkinsfile; #[test] pub fn demo() { @@ -53,27 +52,4 @@ mod tests { } } } - - #[test] - pub fn should_parse_hello_world() { - let code = r#"pipeline { - agent { docker 'maven:3.3.3' } - stages { - stage('build') { - steps { - sh 'mvn --version' - } - } - } -} - "#; - let jenkinsfile = Jenkinsfile::from_str(code).unwrap(); - - for stage in jenkinsfile.stages { - println!("stage # {}", stage.name); - for ins in stage.steps { - println!("steps # {}", ins); - } - } - } } diff --git a/plugins/coco_pipeline/Cargo.toml b/plugins/coco_pipeline/Cargo.toml index ce7feff2..790a7839 100644 --- a/plugins/coco_pipeline/Cargo.toml +++ b/plugins/coco_pipeline/Cargo.toml @@ -7,8 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# Jenkins Declarative Parser -jdp = "0.2.2" +jenkinsfile = "0.1.1" # grammar generator pest = "2.1.3" diff --git a/plugins/coco_pipeline/src/jenkinsfile.rs b/plugins/coco_pipeline/src/jenkinsfile.rs index 3aa1a4ef..c23fe5e6 100644 --- a/plugins/coco_pipeline/src/jenkinsfile.rs +++ b/plugins/coco_pipeline/src/jenkinsfile.rs @@ -24,3 +24,31 @@ pub struct PostConfig { pub key: String, pub value: Vec, } + +#[cfg(test)] +mod tests { + use jenkinsfile::Jenkinsfile; + + #[test] + pub fn should_parse_hello_world() { + let code = r#"pipeline { + agent { docker 'maven:3.3.3' } + stages { + stage('build') { + steps { + sh 'mvn --version' + } + } + } +} + "#; + let jenkinsfile = Jenkinsfile::from_str(code).unwrap(); + + for stage in jenkinsfile.stages { + println!("stage # {}", stage.name); + for ins in stage.steps { + println!("steps # {}", ins); + } + } + } +}