From ef66d23ed45f02f5d1ec4cfbab0f8fec37bdc609 Mon Sep 17 00:00:00 2001 From: Valentine Valyaeff Date: Wed, 4 Sep 2019 00:25:39 +0300 Subject: [PATCH] Move templates to src --- .../bmp/cortex_m.gdb => src/templates/bmp/cortex_m.gdb.hbs | 0 templates/bmp/flash.gdb => src/templates/bmp/flash.gdb.hbs | 0 templates/bmp/gdb.gdb => src/templates/bmp/gdb.gdb.hbs | 0 templates/bmp/itm.gdb => src/templates/bmp/itm.gdb.hbs | 0 templates/bmp/reset.gdb => src/templates/bmp/reset.gdb.hbs | 0 templates/bmp/stm32.gdb => src/templates/bmp/stm32.gdb.hbs | 0 templates/layout.ld => src/templates/layout.ld.hbs | 0 src/{templates.rs => templates/mod.rs} | 3 +-- templates/new/Cargo.toml => src/templates/new/Cargo.toml.hbs | 0 templates/new/Drone.toml => src/templates/new/Drone.toml.hbs | 0 templates/new/Justfile => src/templates/new/Justfile.hbs | 0 .../new/_cargo/config => src/templates/new/_cargo/config.hbs | 0 templates/new/_gitignore => src/templates/new/_gitignore.hbs | 0 .../new/rust-toolchain => src/templates/new/rust-toolchain.hbs | 0 templates/new/src/lib.rs => src/templates/new/src/lib.rs.hbs | 0 templates/new/src/main.rs => src/templates/new/src/main.rs.hbs | 0 .../new/src/thr/mod.rs => src/templates/new/src/thr/mod.rs.hbs | 0 .../src/thr/trunk.rs => src/templates/new/src/thr/trunk.rs.hbs | 0 18 files changed, 1 insertion(+), 2 deletions(-) rename templates/bmp/cortex_m.gdb => src/templates/bmp/cortex_m.gdb.hbs (100%) rename templates/bmp/flash.gdb => src/templates/bmp/flash.gdb.hbs (100%) rename templates/bmp/gdb.gdb => src/templates/bmp/gdb.gdb.hbs (100%) rename templates/bmp/itm.gdb => src/templates/bmp/itm.gdb.hbs (100%) rename templates/bmp/reset.gdb => src/templates/bmp/reset.gdb.hbs (100%) rename templates/bmp/stm32.gdb => src/templates/bmp/stm32.gdb.hbs (100%) rename templates/layout.ld => src/templates/layout.ld.hbs (100%) rename src/{templates.rs => templates/mod.rs} (97%) rename templates/new/Cargo.toml => src/templates/new/Cargo.toml.hbs (100%) rename templates/new/Drone.toml => src/templates/new/Drone.toml.hbs (100%) rename templates/new/Justfile => src/templates/new/Justfile.hbs (100%) rename templates/new/_cargo/config => src/templates/new/_cargo/config.hbs (100%) rename templates/new/_gitignore => src/templates/new/_gitignore.hbs (100%) rename templates/new/rust-toolchain => src/templates/new/rust-toolchain.hbs (100%) rename templates/new/src/lib.rs => src/templates/new/src/lib.rs.hbs (100%) rename templates/new/src/main.rs => src/templates/new/src/main.rs.hbs (100%) rename templates/new/src/thr/mod.rs => src/templates/new/src/thr/mod.rs.hbs (100%) rename templates/new/src/thr/trunk.rs => src/templates/new/src/thr/trunk.rs.hbs (100%) diff --git a/templates/bmp/cortex_m.gdb b/src/templates/bmp/cortex_m.gdb.hbs similarity index 100% rename from templates/bmp/cortex_m.gdb rename to src/templates/bmp/cortex_m.gdb.hbs diff --git a/templates/bmp/flash.gdb b/src/templates/bmp/flash.gdb.hbs similarity index 100% rename from templates/bmp/flash.gdb rename to src/templates/bmp/flash.gdb.hbs diff --git a/templates/bmp/gdb.gdb b/src/templates/bmp/gdb.gdb.hbs similarity index 100% rename from templates/bmp/gdb.gdb rename to src/templates/bmp/gdb.gdb.hbs diff --git a/templates/bmp/itm.gdb b/src/templates/bmp/itm.gdb.hbs similarity index 100% rename from templates/bmp/itm.gdb rename to src/templates/bmp/itm.gdb.hbs diff --git a/templates/bmp/reset.gdb b/src/templates/bmp/reset.gdb.hbs similarity index 100% rename from templates/bmp/reset.gdb rename to src/templates/bmp/reset.gdb.hbs diff --git a/templates/bmp/stm32.gdb b/src/templates/bmp/stm32.gdb.hbs similarity index 100% rename from templates/bmp/stm32.gdb rename to src/templates/bmp/stm32.gdb.hbs diff --git a/templates/layout.ld b/src/templates/layout.ld.hbs similarity index 100% rename from templates/layout.ld rename to src/templates/layout.ld.hbs diff --git a/src/templates.rs b/src/templates/mod.rs similarity index 97% rename from src/templates.rs rename to src/templates/mod.rs index 1acabd8..412cd58 100644 --- a/src/templates.rs +++ b/src/templates/mod.rs @@ -24,8 +24,7 @@ impl Registry { let mut handlebars = Handlebars::new(); macro_rules! template { ($path:expr) => { - handlebars - .register_template_string($path, include_str!(concat!("../templates/", $path))) + handlebars.register_template_string($path, include_str!(concat!($path, ".hbs"))) }; } diff --git a/templates/new/Cargo.toml b/src/templates/new/Cargo.toml.hbs similarity index 100% rename from templates/new/Cargo.toml rename to src/templates/new/Cargo.toml.hbs diff --git a/templates/new/Drone.toml b/src/templates/new/Drone.toml.hbs similarity index 100% rename from templates/new/Drone.toml rename to src/templates/new/Drone.toml.hbs diff --git a/templates/new/Justfile b/src/templates/new/Justfile.hbs similarity index 100% rename from templates/new/Justfile rename to src/templates/new/Justfile.hbs diff --git a/templates/new/_cargo/config b/src/templates/new/_cargo/config.hbs similarity index 100% rename from templates/new/_cargo/config rename to src/templates/new/_cargo/config.hbs diff --git a/templates/new/_gitignore b/src/templates/new/_gitignore.hbs similarity index 100% rename from templates/new/_gitignore rename to src/templates/new/_gitignore.hbs diff --git a/templates/new/rust-toolchain b/src/templates/new/rust-toolchain.hbs similarity index 100% rename from templates/new/rust-toolchain rename to src/templates/new/rust-toolchain.hbs diff --git a/templates/new/src/lib.rs b/src/templates/new/src/lib.rs.hbs similarity index 100% rename from templates/new/src/lib.rs rename to src/templates/new/src/lib.rs.hbs diff --git a/templates/new/src/main.rs b/src/templates/new/src/main.rs.hbs similarity index 100% rename from templates/new/src/main.rs rename to src/templates/new/src/main.rs.hbs diff --git a/templates/new/src/thr/mod.rs b/src/templates/new/src/thr/mod.rs.hbs similarity index 100% rename from templates/new/src/thr/mod.rs rename to src/templates/new/src/thr/mod.rs.hbs diff --git a/templates/new/src/thr/trunk.rs b/src/templates/new/src/thr/trunk.rs.hbs similarity index 100% rename from templates/new/src/thr/trunk.rs rename to src/templates/new/src/thr/trunk.rs.hbs