This commit is contained in:
Adrian Malacoda 2017-10-26 02:42:35 -05:00
parent 9b1be645ff
commit b488413f96

30
TODO.md
View File

@ -6,20 +6,20 @@ Make an API that actually makes sense. I'm thinking something along the lines of
* ResourceWriter, which just wraps the Generators and spits out the output file * ResourceWriter, which just wraps the Generators and spits out the output file
## Sample ## Sample
let mut routes = RocketRouteGenerator::new(); let mut routes = RocketRouteGenerator::new();
routes.add(RocketRoute { routes.add(RocketRoute {
source: browserify("foo.js"), source: browserify("foo.js"),
mountpoint: String::from("/foo.js"), mountpoint: String::from("/foo.js"),
content_type: "JavaScript" content_type: "JavaScript"
}); });
let mut templates = HandlebarsGenerator::new(); let mut templates = HandlebarsGenerator::new();
templates.add(HandlebarsTemplate { templates.add(HandlebarsTemplate {
source: PathBuf::from("templates/foo.hbs"), source: PathBuf::from("templates/foo.hbs"),
name: "foo" name: "foo"
}); });
let mut writer = ResourceWriter::new(); let mut writer = ResourceWriter::new();
writer.add_resources(routes); writer.add_resources(routes);
writer.add_resources(templates); writer.add_resources(templates);
writer.write("resources.rs"); writer.write("resources.rs");