Skip to content

filipprober/orchestra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orchestra

Retrieve modules implementing specific behaviours.

Installation

Add :orchestra to your list of dependencies in mix.exs:

def deps do
  [
    {:orchestra, "~> 1.0.0"}
  ]
end

Usage

# Retrieve the current application name:
current_app = Mix.Project.config()[:app]

# Retrieve all modules implementing the `Illuminate.Console.Command` behaviour:
Orchestra.apps([:illuminate, current_app])
|> Orchestra.get(Illuminate.Console.Command)

[
  MigrateCommand,
  MakeModelCommand,
  # ...
]

To retrieve a list of modules including their paths, you can use the Orchestra.with_paths/0 function:

# Retrieve the current application name:
current_app = Mix.Project.config()[:app]

# Retrieve all modules implementing the `Illuminate.Console.Command` behaviour including their paths:
Orchestra.apps([:illuminate, current_app])
|> Orchestra.get(Illuminate.Console.Command)
|> Orchestra.with_paths()

[
  %{
    module: MigrateCommand,
    path: ~c"/path/to/file.ex"
  },
  %{
    module: MakeModelCommand,
    path: ~c"/path/to/file.ex"
  },
  # ..
]

License

Orchestra is open-sourced software licensed under the MIT license.

About

Retrieve modules implementing specific behaviours in Elixir.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages