Skip to content

Commit

Permalink
Allow customizing the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
antifuchs committed Oct 23, 2018
1 parent f6d167e commit ef85471
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main.rs
Expand Up @@ -130,6 +130,9 @@ struct TemplateCIConfig<'a> {
#[serde(default)]
additional_matrix_entries: HashMap<&'a str, CustomEntry<'a>>,

#[serde(default = "TemplateCIConfig::default_cache")]
cache: &'a str,

#[serde(default = "TemplateCIConfig::default_os")]
os: &'a str,

Expand All @@ -152,6 +155,7 @@ impl<'a> Default for TemplateCIConfig<'a> {
rustfmt: Default::default(),
additional_matrix_entries: Default::default(),
dist: "xenial",
cache: "cargo",
os: "linux",
versions: vec!["stable", "beta", "nightly"],
test_commandline: "cargo test --verbose --all".to_owned(),
Expand All @@ -160,6 +164,10 @@ impl<'a> Default for TemplateCIConfig<'a> {
}

impl<'a> TemplateCIConfig<'a> {
fn default_cache() -> &'a str {
Self::default().cache
}

fn default_os() -> &'a str {
Self::default().os
}
Expand Down
2 changes: 1 addition & 1 deletion templates/travis.yml
Expand Up @@ -4,7 +4,7 @@ dist: "{{dist}}"

language: rust
sudo: required
cache: cargo
cache: {{cache}}

rust:
- stable
Expand Down

0 comments on commit ef85471

Please sign in to comment.