From 8574ac9d87be7575b13f040c29f2ea5bdd008555 Mon Sep 17 00:00:00 2001 From: Ed Lewis Date: Wed, 21 Sep 2016 10:06:34 +0100 Subject: [PATCH] Update all docs/tests to use the .factfile extension (closes #34) Renamed .factotum files in samples .factfile (#34) Renamed .factotum files in tests to .factfile (#34) Renamed .factotum files to .factfile in README (#34) --- README.md | 20 +++++++++---------- ....factotum => echo-with-variables.factfile} | 0 samples/{echo.factotum => echo.factfile} | 0 samples/{noop.factotum => noop.factfile} | 0 samples/{sleep.factotum => sleep.factfile} | 0 ...{variables.factotum => variables.factfile} | 0 src/factotum/parser/tests.rs | 16 +++++++-------- src/main.rs | 4 ++-- ...m => example_invalid_no_continue.factfile} | 0 ...totum => example_invalid_no_name.factfile} | 0 ..._invalid_terminate_continue_same.factfile} | 0 ...xample_ok.factotum => example_ok.factfile} | 0 ...e.factotum => example_wrong_type.factfile} | 0 ...id_json.factotum => invalid_json.factfile} | 0 14 files changed, 20 insertions(+), 20 deletions(-) rename samples/{echo-with-variables.factotum => echo-with-variables.factfile} (100%) rename samples/{echo.factotum => echo.factfile} (100%) rename samples/{noop.factotum => noop.factfile} (100%) rename samples/{sleep.factotum => sleep.factfile} (100%) rename samples/{variables.factotum => variables.factfile} (100%) rename tests/resources/{example_invalid_no_continue.factotum => example_invalid_no_continue.factfile} (100%) rename tests/resources/{example_invalid_no_name.factotum => example_invalid_no_name.factfile} (100%) rename tests/resources/{example_invalid_terminate_continue_same.factotum => example_invalid_terminate_continue_same.factfile} (100%) rename tests/resources/{example_ok.factotum => example_ok.factfile} (100%) rename tests/resources/{example_wrong_type.factotum => example_wrong_type.factfile} (100%) rename tests/resources/{invalid_json.factotum => invalid_json.factfile} (100%) diff --git a/README.md b/README.md index 5f62c63..41ca1fa 100644 --- a/README.md +++ b/README.md @@ -20,28 +20,28 @@ unzip factotum_0.2.0_linux_x86_64.zip ./factotum --help ``` -Factotum requires one argument, which is a **[factotum factfile](/README.md#factfile-format)** that describes the job to run. For example, to run the sample **[sleep.factotum](https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/sleep.factotum)**: +Factotum requires one argument, which is a **[factotum factfile](/README.md#factfile-format)** that describes the job to run. For example, to run the sample **[sleep.factfile](https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/sleep.factfile)**: ```{bash} -wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/sleep.factotum -./factotum sleep.factotum +wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/sleep.factfile +./factotum sleep.factfile ``` Specifying variables in the job file can be done using `--env JSON` (or `-e JSON`). The `JSON` here is free-form and needs to correspond to the placeholders you've set in your job. For example, the following will print "hello world!": ```{bash} -wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/variables.factotum -./factotum variables.factotum --env '{ "message": "hello world!" }' +wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/variables.factfile +./factotum variables.factfile --env '{ "message": "hello world!" }' ``` Starting from an arbitrary task can be done using the `--start TASK` or `-s TASK` arguments, where TASK is the name of the task you'd like to start at. -For example, to start at the "echo beta" task in [this job](https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/echo.factotum), you can run the following: +For example, to start at the "echo beta" task in [this job](https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/echo.factfile), you can run the following: ```{bash} -wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/echo.factotum -./factotum echo.factotum --start "echo beta" +wget https://raw.githubusercontent.com/snowplow/factotum/release/0.2.0/samples/echo.factfile +./factotum echo.factfile --start "echo beta" ``` To get a quick overview of the options provided, you can use the `--help` or `-h` argument: @@ -118,7 +118,7 @@ Factotum is written in **[Rust](https://www.rust-lang.org/)**. * Set up a Vagrant box and ssh into it - `vagrant up && vagrant ssh` * This will take a few minutes * `cd /vagrant` -* Compile and run a demo - `cargo run -- samples/echo.factotum` +* Compile and run a demo - `cargo run -- samples/echo.factfile` ### Using stable Rust without Vagrant @@ -126,7 +126,7 @@ Factotum is written in **[Rust](https://www.rust-lang.org/)**. * on Linux/Mac - `curl -sSf https://static.rust-lang.org/rustup.sh | sh` * Clone this repository - `git clone git@github.com:snowplow/factotum.git` * `cd factotum` -* Compile and run a demo - `cargo run -- samples/echo.factotum` +* Compile and run a demo - `cargo run -- samples/echo.factfile` ## Copyright and license diff --git a/samples/echo-with-variables.factotum b/samples/echo-with-variables.factfile similarity index 100% rename from samples/echo-with-variables.factotum rename to samples/echo-with-variables.factfile diff --git a/samples/echo.factotum b/samples/echo.factfile similarity index 100% rename from samples/echo.factotum rename to samples/echo.factfile diff --git a/samples/noop.factotum b/samples/noop.factfile similarity index 100% rename from samples/noop.factotum rename to samples/noop.factfile diff --git a/samples/sleep.factotum b/samples/sleep.factfile similarity index 100% rename from samples/sleep.factotum rename to samples/sleep.factfile diff --git a/samples/variables.factotum b/samples/variables.factfile similarity index 100% rename from samples/variables.factotum rename to samples/variables.factfile diff --git a/src/factotum/parser/tests.rs b/src/factotum/parser/tests.rs index 5dd1f49..a4faa93 100644 --- a/src/factotum/parser/tests.rs +++ b/src/factotum/parser/tests.rs @@ -33,9 +33,9 @@ fn invalid_files_err() { #[test] fn invalid_json_err() { - let res = parse(&resource("invalid_json.factotum"), None); + let res = parse(&resource("invalid_json.factfile"), None); if let Err(msg) = res { - assert_eq!(msg,format!("'{}' is not a valid factotum factfile: invalid JSON - invalid syntax at line 1, column 3", resource("invalid_json.factotum")).to_string()) + assert_eq!(msg,format!("'{}' is not a valid factotum factfile: invalid JSON - invalid syntax at line 1, column 3", resource("invalid_json.factfile")).to_string()) } else { panic!("the file is invalid json - the test should have failed"); } @@ -43,7 +43,7 @@ fn invalid_json_err() { #[test] fn invalid_against_schema_err() { - let invalid = resource("example_invalid_no_name.factotum"); + let invalid = resource("example_invalid_no_name.factfile"); let res = parse(&invalid, None); if let Err(msg) = res { assert_eq!(msg,format!("'{}' is not a valid factotum factfile: '/data/name' - This property is required", invalid).to_string()) @@ -54,7 +54,7 @@ fn invalid_against_schema_err() { #[test] fn invalid_against_schema_wrong_type() { - let invalid = resource("example_wrong_type.factotum"); + let invalid = resource("example_wrong_type.factfile"); let res = parse(&invalid, None); if let Err(msg) = res { assert_eq!(msg,format!("'{}' is not a valid factotum factfile: '/data/tasks/0/onResult/terminateJobWithSuccess/0' - Type of the value is wrong (The value must be integer)", invalid).to_string()) @@ -65,7 +65,7 @@ fn invalid_against_schema_wrong_type() { #[test] fn invalid_ambiguous_on_result() { - let invalid = resource("example_invalid_terminate_continue_same.factotum"); + let invalid = resource("example_invalid_terminate_continue_same.factfile"); let res = parse(&invalid, None); if let Err(msg) = res { assert_eq!(msg, format!("'{}' is not a valid factotum factfile: the task 'ambi' has conflicting actions.", invalid)) @@ -76,7 +76,7 @@ fn invalid_ambiguous_on_result() { #[test] fn invalid_must_continue() { - let invalid = resource("example_invalid_no_continue.factotum"); + let invalid = resource("example_invalid_no_continue.factfile"); let res = parse(&invalid, None); if let Err(msg) = res { assert_eq!(msg, format!("'{}' is not a valid factotum factfile: the task 'continue' has no way to continue successfully.", invalid)) @@ -87,7 +87,7 @@ fn invalid_must_continue() { #[test] fn valid_generates_factfile() { - let valid = resource("example_ok.factotum"); + let valid = resource("example_ok.factfile"); if let Ok(factfile) = parse(&valid, None) { let tasks = factfile.get_tasks_in_order(); @@ -105,7 +105,7 @@ fn valid_generates_factfile() { assert_eq!(task_three.name, "SQL Runner"); assert_eq!(task_three.depends_on, vec!["StorageLoader"]); } else { - panic!("valid factfile example_ok.factotum should have parsed but didn't"); + panic!("valid factfile example_ok.factfile should have parsed but didn't"); } } diff --git a/src/main.rs b/src/main.rs index f4857cd..c810830 100644 --- a/src/main.rs +++ b/src/main.rs @@ -337,7 +337,7 @@ fn factotum() -> i32 { #[test] fn validate_ok_factfile_good() { - let test_file_path = "./tests/resources/example_ok.factotum"; + let test_file_path = "./tests/resources/example_ok.factfile"; let is_valid = validate(test_file_path, None); let expected:String = format!("'{}' is a valid Factfile!", test_file_path).green().to_string(); assert_eq!(is_valid, Ok(expected)); @@ -345,7 +345,7 @@ fn validate_ok_factfile_good() { #[test] fn validate_ok_factfile_bad() { - let test_file_path = "./tests/resources/invalid_json.factotum"; + let test_file_path = "./tests/resources/invalid_json.factfile"; let is_valid = validate(test_file_path, None); match is_valid { Ok(_) => panic!("Validation returning valid for invalid file"), diff --git a/tests/resources/example_invalid_no_continue.factotum b/tests/resources/example_invalid_no_continue.factfile similarity index 100% rename from tests/resources/example_invalid_no_continue.factotum rename to tests/resources/example_invalid_no_continue.factfile diff --git a/tests/resources/example_invalid_no_name.factotum b/tests/resources/example_invalid_no_name.factfile similarity index 100% rename from tests/resources/example_invalid_no_name.factotum rename to tests/resources/example_invalid_no_name.factfile diff --git a/tests/resources/example_invalid_terminate_continue_same.factotum b/tests/resources/example_invalid_terminate_continue_same.factfile similarity index 100% rename from tests/resources/example_invalid_terminate_continue_same.factotum rename to tests/resources/example_invalid_terminate_continue_same.factfile diff --git a/tests/resources/example_ok.factotum b/tests/resources/example_ok.factfile similarity index 100% rename from tests/resources/example_ok.factotum rename to tests/resources/example_ok.factfile diff --git a/tests/resources/example_wrong_type.factotum b/tests/resources/example_wrong_type.factfile similarity index 100% rename from tests/resources/example_wrong_type.factotum rename to tests/resources/example_wrong_type.factfile diff --git a/tests/resources/invalid_json.factotum b/tests/resources/invalid_json.factfile similarity index 100% rename from tests/resources/invalid_json.factotum rename to tests/resources/invalid_json.factfile