View Source mix bex.generate (bex v0.3.0)

Mix task to generate the Bex wrapping behaviour scaffold.

By running mix bex.generate --module ModuleToConvert or mix bex.generate --function Module.function_to_convert/arity two modules are to be generated:

  • behaviour module for the functions(s)
  • default implementation module, wrapping the original function(s)

Allowed arguments

  • --module: :string or --function: :string [mandatory] the name of the module or the function to convert to behaviour implementation
  • --dir: :string [optional, default: lib/bex] the target directory for generated modules
  • --patch [optional, default: true] if false, no attempt to patch found occurences of calls to the behavioured function(s) would be made
  • --backup [optional, default: false] if true, the file will be backed up with .bex extension before patching
  • --test [optional, default: true] if false, tests for patched calls will not be generated (it has no effect with --no-patch)

Example

mix bex.generate --function Process.send_after/4 --no-patch