Robot is a build system for Elixir projects. Use it to compile things, run commands or do anything that requires being run when files change.
> *[Wreckers] don't call for backup, they call for cleanup ~!*
A set of paths you want to watch is called a *watch group*. Each watch group has the following
* a list of paths to watch
* a function, which we'll call the *rotor function*, that is run everytime any of the files in the paths changes. It should accept one argument (a list of maps, each having info about a file).
#### Adding watch groups
Rotor.add_group(name, files, rotor_function)
The rotor function is passed info about the list of files that match the paths specified. The rotor function calls other little functions called `rotors`, that run certain tasks.
Rotor ships with a few simple rotors in the `Rotor.Basic` module.
* `read_files(files)` - reads contents of files, and returns files with a property called `contents`
* `copy_files(files, destination_dir)` - copies files to destination_dir
* `concat(files)` - concats contents of files and returns a string
* `write_to(contents, output_path)` - writes the contents to the file path specified in output path
You can also write your own. Check the *"Writing custom actions"* section below.
### Other stuff
To remove a watch group
To list groups
To run a watch group's rotor forcefully
paths = ["assets/stylesheets/libs/*.css", "assets/stylesheets/*.css"]
Rotor.add_group :stylesheets, paths, fn(files)->
paths = ["assets/images/*", "assets/fonts/*"]
Rotor.add_group :images_and_fonts, paths, fn(files)->
### Writing custom rotors
Rotors are just functions that accept data and do something.
Checkout [coffee_rotor](https://github.com/HashNuke/coffee_rotor), which provides a rotor to compile CoffeeScript files.