class Cardio::Mod::Dirs

Dirs objects are used to manage the load paths for card mods. Mods can be loaded as gems and by using directories with mod subdirectories.

  1. Gemfile

A mod gem needs a metadata attribute with { “card-mod” => “the_mod_name” } or the name has to start with “card-mod-”. Then you can just add it to your Gemfile. Otherwise it won’t be recognized as mod.

  1. mod directory

Give a path to a directory with mods. The mods will be loaded in alphabetical order. To change the load order you can add number prefixes to the mod names (like “01_this_first”) or add a Modfile. In the Modfile you list all the mods you want to be loaded from that directory in load order with a preceding “mod” command (similar to a Gemfile). The mods are expected in subdirectories with the mod names.

Mods in Modfiles are always loaded before mods in the Gemfile. If you have to change the order add gem mods to your Modfile using the mod_gem command. You can omit the ‘card-mod’ prefix.

Example for a mod directory:

# my_mod/Modfile
mod "twitter"
gem_mod "logger"
mod "cache"

# directory structure
my_mods/
  Modfile
  cache/
    set/
      all/
        my_cache.rb
  twitter/
    set/
      type/
        basic.rb
    set_pattern/
      my_pattern.rb

Dir checks always for gems. You can initialize an Dirs object with an additional array of paths to card mod directories.