From 42d1a875850d8e7ad7067b7848e40bcfbdfaf266 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Thu, 26 Oct 2017 02:38:08 -0500 Subject: [PATCH] readme --- README.md | 4 ++++ TODO.md | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 TODO.md diff --git a/README.md b/README.md index 634171f..b3180f9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # Plushie Narwhal A loosely organized group of utilities for generating resources, bundling them, and generating code to use them. + +For example: call browserify on an input javascript file, bake the resulting javascript into the binary, and wrap it in a Rocket route which serves it up. + +This was yanked out of a build script for another project, so while it can be used standalone, the API is not particularly great yet. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..9ad905e --- /dev/null +++ b/TODO.md @@ -0,0 +1,25 @@ +# TODO +Make an API that actually makes sense. I'm thinking something along the lines of: +* ResourceGenerator, which accepts an input (always a file, static byte or character source, etc), and + transforms it into some other representation +* Convenience methods that add a file or an entire directory structure, guessing the content type etc. +* ResourceWriter, which just wraps the Generators and spits out the output file + +## Sample +let mut routes = RocketRouteGenerator::new(); +routes.add(RocketRoute { + source: browserify("foo.js"), + mountpoint: String::from("/foo.js"), + content_type: "JavaScript" +}); + +let mut templates = HandlebarsGenerator::new(); +templates.add(HandlebarsTemplate { + source: PathBuf::from("templates/foo.hbs"), + name: "foo" +}); + +let mut writer = ResourceWriter::new(); +writer.add_resources(routes); +writer.add_resources(templates); +writer.write("resources.rs");