Skip to content

njonsson/example_files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example_files

Travis CI build status Hex release

See what’s changed lately by reading the project history.

Your project may contain files that are intended to serve as explanatory samples of files provided by a project contributor or user, such as configuration and the like. The Mix tasks provided here enable you to easily find, copy, and check the freshness of example files and your copies of them.

Installation

Use example_files by adding it to a Mix deps declaration.

# mix.exs

# ...
defp deps do
  [{:example_files, "~> 0.2", only: [:dev, :test]}]
end
# ...

Usage

The example_files commands are exposed as Mix tasks. Get help on them through Mix itself, with mix help | grep example_files and mix help example_files.

example_files task

To list all example files in your project, mix example_files.

This task traverses the current working directory, looking for files that are intended to serve as explanatory samples of files provided by a project contributor or user. By default it uses **/*{example,Example,EXAMPLE}* as the file glob pattern.

An example file may be “applied,” which means that it is copied into the same directory, using a file name that lacks the “example” nomenclature.

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

Missing:    spec/fixtures/no_collisions/file
1 example file found

Collision detected! spec/fixtures/collisions/file1, corresponding to:
· spec/fixtures/collisions/file1.example
· spec/fixtures/collisions/EXAMPLE-file1

Individual file status

Status is one of three values:

  • Missing — never applied
  • Out-of-date — applied, but currently different in content from the example
  • Up-to-date — applied and identical in content to the example

Collisions

Your project may contain two or more example files that, when applied, use the same resulting file name. This constitutes a “collision.” Colliding example files are noted on stderr.

Contributing

To submit a patch to the project:

  1. Fork the official repository.
  2. Create your feature branch: git checkout -b my-new-feature.
  3. Commit your changes: git commit -am 'Add some feature'.
  4. Push to the branch: git push origin my-new-feature.
  5. Create a new pull request.

After cloning the repository, mix deps.get to install dependencies. Then mix espec to run the tests. You can also iex to get an interactive prompt that will allow you to experiment. To build this package, mix hex.build.

To release a new version:

  1. Update the “Installation” section of this readme to reference the new version, and commit.
  2. Update the project history in History.md, and commit.
  3. Update the version number in mix.exs, and commit.
  4. Tag the commit and push commits and tags.
  5. Build and publish the package on Hex with mix hex.publish.

License

Released under the MIT License.

About

Mix tasks for managing example files in your project

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages