lib/core/project.rb in buildr-1.2.3 vs lib/core/project.rb in buildr-1.2.4

- old
+ new

@@ -282,9 +282,22 @@ else projects end end + # :call-seq: + # task_in_parent_project(task_name) => task_name or nil + # + # Assuming the task name is prefixed with the current project, finds and returns a task with the + # same name in a parent project. Call this with "foo:bar:test" will return "foo:test", but call + # this with "foo:test" will return nil. + def task_in_parent_project(task_name) + namespace = task_name.split(":") + last_name = namespace.pop + namespace.pop + Rake.application.lookup((namespace + [last_name]).join(":"), []) unless namespace.empty? + end + end include InheritedAttributes # The project name. For example, "foo" for the top-level project, and "foo:bar"