Skip to content

Commit

Permalink
rename script to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett committed Mar 17, 2019
1 parent 73442e1 commit 972a1b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions docs/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Scripts are used to extend the build process of your project.
# Defining a Script
Scripts use a list of shell commands. This small snippet is all that is needed to define a basic script. This example would be ran with `hemtt run build`.
```json
"script": {
"scripts": {
"build": {
"steps": [
"make all"
Expand All @@ -15,7 +15,7 @@ Scripts use a list of shell commands. This small snippet is all that is needed t
### steps_windows / steps_linux
`steps_windows` and `steps_linux` can be used to run different steps on the respective platforms.
```json
"script": {
"scripts": {
"build": {
"steps_linux": [
"make linux"
Expand All @@ -30,7 +30,7 @@ Scripts use a list of shell commands. This small snippet is all that is needed t
### show_output
All output is hidden by default. Setting `show_output` will display the command being executed and its output.
```json
"script": {
"scripts": {
"example": {
"steps": ["echo 'this is an example'"],
"show_output": true
Expand All @@ -45,7 +45,7 @@ There are 3 different build step definitions. `prebuild`, `postbuild` and `relea
"releasebuild": [
"!build",
],
"script": {
"scripts": {
"build": {
"steps_linux": [
"make linux",
Expand All @@ -72,7 +72,7 @@ In addition to the standard [templating variables](templating.md), additional va
| time | | (build time in ms) | (build time in ms) |

```json
"script": {
"scripts": {
"buildtime": {
"steps": ["echo {{addon}} took {{time}} ms to build."],
"show_output": true,
Expand Down
8 changes: 4 additions & 4 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct Project {
pub releasebuild: Vec<String>,
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default = "HashMap::new")]
pub script: HashMap<String, crate::build::script::BuildScript>,
pub scripts: HashMap<String, crate::build::script::BuildScript>,

#[serde(skip_deserializing,skip_serializing)]
pub template_data: BTreeMap<&'static str, String>,
Expand Down Expand Up @@ -120,8 +120,8 @@ impl Project {
}

pub fn script(&self, name: &String, state: &State) -> Result<(), Error> {
if self.script.contains_key(name) {
let script = self.script.get(name).unwrap();
if self.scripts.contains_key(name) {
let script = self.scripts.get(name).unwrap();
if script.foreach && state.stage == crate::state::Stage::Script {
println!("Unable to run scripts with 'foreach' outside of build steps");
std::process::exit(1);
Expand Down Expand Up @@ -157,7 +157,7 @@ pub fn init(name: String, prefix: String, author: String) -> Result<Project, Err
prebuild: Vec::new(),
postbuild: Vec::new(),
releasebuild: Vec::new(),
script: HashMap::new(),
scripts: HashMap::new(),

template_data: BTreeMap::new(),
};
Expand Down

0 comments on commit 972a1b0

Please sign in to comment.