Module Templater::Discovery
In: lib/templater/discovery.rb

This provides a hook system which programs that use Templater can use to discover generators installed through gems. This requires two separate things, the Templater-using progrma will have to call the discover! method giving a scope, like this:

    Templater::Discovery.discover!("name-of-scope")

Where "name-of-scope" should be a string that uniquely identifies your program. Any gem wishing to then add a generator, that is automatically picked up, will then need to add a Generators file at the root of the project (don‘t forget to add it to the gem‘s manifest of files).

    - lib /
    - spec /
    - Rakefile
    - Generators

This file should look something like this:

    scope "name-of-scope" do
      require ...something...
    end

Multiple scopes can be added to the same Generators file for use with different generator programs.

Methods

Public Instance methods

Searches installed gems for Generators files and loads all code blocks in them that match the given scope.

Parameters

scope<String>:The name of the scope to search for

Adds a block of code specific for a certain scope of generators, where the scope would probably be the name of the program running the generator.

Parameters

scope<String>:The name of the scope
block<&Proc>:A block of code to execute provided the scope is correct

Protected Instance methods

[Validate]