summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-31 12:21:56 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:15 +0100
commit3de8a4620a70c886c815576dc0a30a745cbb8ccb (patch)
tree7cad0174855a338bab620068f005f78fa804fce7 /lib
parent447f56036e837fc9a9c2bcaf382d38dc513a9733 (diff)
downloadgitlab-ce-3de8a4620a70c886c815576dc0a30a745cbb8ccb.tar.gz
Parse artifacts metadata stored in JSON format
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/string_path.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/gitlab/string_path.rb b/lib/gitlab/string_path.rb
index bfeb0f852f0..ad68a8ff2d6 100644
--- a/lib/gitlab/string_path.rb
+++ b/lib/gitlab/string_path.rb
@@ -10,10 +10,11 @@ module Gitlab
class StringPath
attr_reader :path, :universe
- def initialize(path, universe)
+ def initialize(path, universe, metadata = [])
@path = prepare(path)
- @universe = Set.new(universe.map { |entry| prepare(entry) })
- @universe.add('./')
+ @universe = universe.map { |entry| prepare(entry) }
+ @universe << './' unless @universe.include?('./')
+ @metadata = metadata
end
def to_s
@@ -84,6 +85,11 @@ module Gitlab
children.select(&:file?)
end
+ def metadata
+ index = @universe.index(@path)
+ @metadata[index]
+ end
+
def ==(other)
@path == other.path && @universe == other.universe
end