Skip to content

Commit

Permalink
Changed how tokei searches through files.
Browse files Browse the repository at this point in the history
Updated dependencies
Changed languages.json formatting
  • Loading branch information
Aaron Power committed Aug 10, 2017
1 parent 6761589 commit f53c796
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 775 deletions.
90 changes: 62 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ lto=true
serde_json = "1"
ignore = "0.2"
handlebars = "0.27"
lazy_static = "0.2"

[dependencies]
encoding = "0.2"
errln = "0.1"
ignore = "0.2"
lazy_static = "0.2"
log = "0.3"
maplit = "0.1"
rayon = "0.7"
regex = "0.2"
clap = "2.24"
Expand Down Expand Up @@ -78,6 +77,7 @@ version = "0.4"

[dev-dependencies]
tempdir = "0.3"
lazy_static = "0.2"

[features]
all = ["json", "cbor", "toml-io", "yaml"]
Expand Down
29 changes: 16 additions & 13 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate serde_json;
extern crate ignore;
extern crate handlebars;
extern crate ignore;
extern crate serde_json;

use std::env;
use std::fs::File;
Expand All @@ -17,21 +17,24 @@ fn main() {
}

fn generate_languages(out_dir: &OsStr) {
let mut handlebars = Handlebars::new();

handlebars.register_escape_fn(handlebars::no_escape);

let data: Value = serde_json::from_reader(
File::open(&"languages.json").expect("Can't open JSON")
).expect("Can't parse JSON");

let out = Path::new(&out_dir).join("language_type.rs");
let handlebars = {
let mut h = Handlebars::new();
h.register_escape_fn(handlebars::no_escape);
h
};

let json: Value = {
let json = File::open(&"languages.json").expect("Cant open json");
serde_json::from_reader(json).expect("Can't parse json")
};

let output = Path::new(&out_dir).join("language_type.rs");
let mut source_template = File::open(&"src/language/language_type.hbs.rs")
.expect("Can't find Template");
let mut output_file = File::create(&out).expect("Can't create output");
let mut output_file = File::create(&output).expect("Can't create output");

if let Err(err) = handlebars.template_renderw2(&mut source_template,
&data,
&json,
&mut output_file)
{
panic!("Failed to generate languages! ERROR: {:?}", err);
Expand Down
Loading

0 comments on commit f53c796

Please sign in to comment.