Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
Update all docs/tests to use the .factfile extension (closes #34)
Browse files Browse the repository at this point in the history
Renamed .factotum files in samples .factfile (#34)

Renamed .factotum files in tests to .factfile (#34)

Renamed .factotum files to .factfile in README (#34)
  • Loading branch information
ninjabear committed Sep 30, 2016
1 parent 7b68225 commit 8574ac9
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -118,15 +118,15 @@ 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

* **[Install Rust](https://www.rust-lang.org/downloads.html)**
* on Linux/Mac - `curl -sSf https://static.rust-lang.org/rustup.sh | sh`
* Clone this repository - `git clone [email protected]: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

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions src/factotum/parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ 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");
}
}

#[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())
Expand All @@ -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())
Expand All @@ -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))
Expand All @@ -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))
Expand All @@ -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();
Expand All @@ -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");
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ 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));
}

#[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"),
Expand Down
File renamed without changes.

0 comments on commit 8574ac9

Please sign in to comment.