added a start of the html overview
This commit is contained in:
parent
856961b8f5
commit
098cb5e0bc
6 changed files with 106 additions and 20 deletions
47
Cargo.lock
generated
47
Cargo.lock
generated
|
|
@ -96,6 +96,12 @@ version = "1.70.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "jiff"
|
||||
version = "0.2.15"
|
||||
|
|
@ -126,6 +132,28 @@ version = "0.4.27"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "maud"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"maud_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "maud_macros"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"proc-macro2-diagnostics",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.5"
|
||||
|
|
@ -162,6 +190,18 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2-diagnostics"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.40"
|
||||
|
|
@ -237,6 +277,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"maud",
|
||||
"regex",
|
||||
]
|
||||
|
||||
|
|
@ -252,6 +293,12 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ edition = "2024"
|
|||
[dependencies]
|
||||
log = "0.4"
|
||||
env_logger = "0.11"
|
||||
regex="1.11"
|
||||
regex="1.11"
|
||||
maud = "*"
|
||||
17
main.rs
17
main.rs
|
|
@ -1,17 +0,0 @@
|
|||
fn main() {
|
||||
println!("Hello, Rust!");
|
||||
|
||||
// Example: Simple calculation
|
||||
let x = 5;
|
||||
let y = 10;
|
||||
let sum = x + y;
|
||||
|
||||
println!("The sum of {} and {} is {}", x, y, sum);
|
||||
|
||||
// Example: Vector operations
|
||||
let numbers = vec![1, 2, 3, 4, 5];
|
||||
let doubled: Vec<i32> = numbers.iter().map(|x| x * 2).collect();
|
||||
|
||||
println!("Original: {:?}", numbers);
|
||||
println!("Doubled: {:?}", doubled);
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
pub mod maven;
|
||||
pub mod xml;
|
||||
mod report;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use std::env;
|
||||
use std::{env, fs};
|
||||
use std::path::PathBuf;
|
||||
use undeepend::maven::project::parse_project;
|
||||
|
||||
|
|
@ -8,5 +8,6 @@ fn main() {
|
|||
env::current_dir().expect("Could not access current directory")
|
||||
} else { PathBuf::from(&args[1]) };
|
||||
let project = parse_project(&dir).unwrap();
|
||||
println!("{:?}", project.get_dependencies(&project.root));
|
||||
|
||||
fs::write(PathBuf::from("index.html"), project.generate_dependency_html()).unwrap();
|
||||
}
|
||||
|
|
|
|||
53
src/report.rs
Normal file
53
src/report.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
use crate::maven::project::Project;
|
||||
use maud::{Markup, PreEscaped, html};
|
||||
|
||||
impl Project {
|
||||
pub fn generate_dependency_html(&self) -> String {
|
||||
let html = html! {
|
||||
(PreEscaped(r#"
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Project Dependencies</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
"#))
|
||||
h1{"Project Dependencies"}
|
||||
table{
|
||||
thead{
|
||||
tr {
|
||||
th{"Group ID"}
|
||||
th{"Artifact ID"}
|
||||
th{"Version"}
|
||||
}
|
||||
}
|
||||
tbody{
|
||||
@for dependency in &self.get_dependencies(&self.root) {
|
||||
tr {
|
||||
td { (dependency.group_id) }
|
||||
td { (dependency.artifact_id) }
|
||||
td { (dependency.version.clone().unwrap()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
html.into_string()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue