aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs64
1 files changed, 2 insertions, 62 deletions
diff --git a/src/main.rs b/src/main.rs
index a6f8e1f..9f24daf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,66 +7,6 @@ fn main() {
Err(n) => {print!("\"settings.toml\": {}: ", n); simple_static_site_generator::Config::new()},
};
- println!("{}", config.get_str("source").unwrap());
-
- let mut path_vec = vec![];
- let mut ex_path_vec = vec![];
-
- let dirs = fs::read_dir("src").unwrap();
- for dir in dirs {
-
- let path = dir.as_ref().unwrap().path();
- if path != std::path::PathBuf::from("assets") {
- path_vec.push(path);
- } else {
- ex_path_vec.push(path);
- }
- }
-
- println!("INCLUDED");
- for x in &path_vec {
- println!("{:?}", x)
- }
- println!("EXCLUDED");
- for x in &ex_path_vec {
- println!("{:?}", x)
- }
- println!();
-
-
- // create build directory or panic
- simple_static_site_generator::create_dir("build").unwrap();
-
- for path in path_vec {
- let mut file_string = String::new();
-
- if path.is_dir() {
- // RECURSE HERE
- continue
- }
-
- for line in fs::read_to_string(&path).unwrap().lines() {
- if line.contains(":?") {
- let v: Vec<&str> = line.trim().split(":?").collect();
- let v = v.get(1).unwrap();
-
- println!("INSERTING {} into {:?}", v, path);
-
- file_string.push_str(fs::read_to_string(v).unwrap().as_ref());
- } else {
- file_string.push_str(line);
- file_string.push('\n')
- }
- }
-
-
- let dest = simple_static_site_generator::replace_path_head(&path, "build/");
-
- // NEEDS TO CREATE DIRECTORY STRUCTURE
- fs::write(dest, file_string).expect("Could not write file");
-
- }
-
-
- // NEEDS TO COPY NOT SCANNED DIRECTORIES
+ // Run
+ simple_static_site_generator::run(config);
} \ No newline at end of file