diff options
Diffstat (limited to 'lib/gitlab/ci/config/dependencies.rb')
-rw-r--r-- | lib/gitlab/ci/config/dependencies.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/gitlab/ci/config/dependencies.rb b/lib/gitlab/ci/config/dependencies.rb new file mode 100644 index 00000000000..9029e5f5155 --- /dev/null +++ b/lib/gitlab/ci/config/dependencies.rb @@ -0,0 +1,26 @@ +module Gitlab + module Ci + class Config + class Dependencies + class UnmetDependencyError < StandardError; end + + def initialize + @entries = {} + end + + def visit(entry) + @entries[entry.location] = entry + entry.dependencies = self + end + + def entry(location) + unless @entries.has_key?(location) + raise UnmetDependencyError, "Unmet dependency #{location}" + end + + @entries[location] + end + end + end + end +end |