Rotor

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 ~!

Usage

A set of paths you want to watch is called a watch group. Each watch group has the following

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.

paths = ["assets/javascripts/libs/*.js"", "assets/javascripts/*.js"]
Rotor.add_group :javascripts, paths, fn(files)->
read_files(files)
|> concat
|> write_to("priv/static/assets/app.js")
end

Rotors

Rotor ships with a few simple rotors in the Rotor.Basic module.

You can also write your own. Check the "Writing custom actions" section below.

Other stuff

To remove a watch group

Rotor.remove_group(group_name)

To list groups

Rotor.groups

To run a watch group's rotor forcefully

Rotor.run(group_name)

Examples

paths = ["assets/stylesheets/libs/*.css", "assets/stylesheets/*.css"]
Rotor.add_group :stylesheets, paths, fn(files)->
read_files(files)
|> concat
|> write_to("app.css")
end
paths = ["assets/images/*", "assets/fonts/*"]
Rotor.add_group :images_and_fonts, paths, fn(files)->
copy_files(files, "priv/static/assets")
end

Writing custom rotors

Rotors are just functions that accept data and do something.

Checkout coffee_rotor, which provides a rotor to compile CoffeeScript files.