arcticicestudio / snowsaw

A lightweight, plugin-driven and dynamic dotfiles bootstrapper.
MIT License
98 stars 8 forks source link

Multiple tasks of same type only handled once per snowblock configuration file #76

Closed arcticicestudio closed 5 years ago

arcticicestudio commented 5 years ago

Epic: #33

When a task is defined multiple times within the same snowblock configuration file, only the last object is processed while any object before are ignored. The root cause is the pkg/snowblock.TaskRunnerMapping custom type that only accepts one pkg/api.TaskConfiguration object. Therefore any parsed task object of the same type is overriden by tasks that are parsed after that task resulting in missing tasks.

Running this example configuration will not process the first clean task but only the second one:

[
  {
    "clean": ["~/desktop/failure"]
  },
  {
    "link": {
      "~/desktop/success/config.json": {
        "create": true,
        "path": "config.json"
      }
    }
  },
  {
    "clean": ["~/desktop/success"]
  },
]

To fix this problem the pkg/snowblock.TaskRunnerMapping type should accept multiple pkg/api.TaskConfiguration objects (TaskRunnerMapping map[api.TaskRunner][]api.TaskConfiguration) instead of only one so the previous object won't be overridden.

arcticicestudio commented 5 years ago

Fixed in 006ae9984032561839312db9c4024e9b6c25b1ad