example_files v1.0.0 Mix.Tasks.ExampleFiles

Lists example files in your project and shows the status of each.

This task traverses the current working directory, looking for files that are intended to serve as illustrative samples of files provided by a project contributor or user.

$ mix example_files
Using glob pattern **/*{example,Example,EXAMPLE}*

Missing:     spec/fixtures/collisions/file2
Missing:     spec/fixtures/no_collisions/file

Collision detected! spec/fixtures/collisions/file1
• spec/fixtures/collisions/EXAMPLE-file1
• spec/fixtures/collisions/file1.example

Individual file status

This task displays the current status of each of the example files it finds. The status of a copy is one of three values:

  • Missing — not present
  • Identical — present and identical in content to the example
  • Out-of-date — present, but currently different in content from the example

Fileglobs

The pattern **/*{example,Example,EXAMPLE}* is used by default to search for example files. You can further restrict the search in mix example_files and its subtasks by specifying one or paths or patterns that will be combined with the example-files pattern:

$ mix example_files doc log
Using glob pattern {doc,log}/**/*{example,Example,EXAMPLE}*

Ignored paths

The following paths are ignored by default in searching for example files:

  • .git/
  • _build/
  • deps/
  • node_modules/
  • tmp/

You can override this default in mix example_files and its subtasks by specifying one or more --ignore or -i options:

$ mix example_files --ignore spec --ignore log
Using glob pattern **/*{example,Example,EXAMPLE}*

Collisions

An example file may be “pulled,” which means that it is copied into the same directory, using a file name that lacks the “example” nomenclature. A project may contain two or more example files that, if they were both pulled, would use the same resulting file name. This constitutes a “collision,” which is always prevented; colliding example files are never operated on, but are displayed on stderr.

Verbose output

You can get more information about what mix example_files and its subtasks are doing by specifying the --verbose or -v option.