diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-04 15:07:49 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:15 +0100 |
commit | 1b1793c2530d7003d8baa5aa1912a4ab258d4a1c (patch) | |
tree | 1cc66e5c26d47cedb7473d889a724eae50e8a25a /lib | |
parent | cd3b8bbd2f8e7ad75a453441f83c46aeb1d37353 (diff) | |
download | gitlab-ce-1b1793c2530d7003d8baa5aa1912a4ab258d4a1c.tar.gz |
Show file size in artifacts browser using metadata
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/build/artifacts/metadata.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/string_path.rb | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/gitlab/ci/build/artifacts/metadata.rb b/lib/gitlab/ci/build/artifacts/metadata.rb index d5c3cd10e48..1f3000e7c8a 100644 --- a/lib/gitlab/ci/build/artifacts/metadata.rb +++ b/lib/gitlab/ci/build/artifacts/metadata.rb @@ -23,13 +23,12 @@ module Gitlab each do |line| next unless line =~ %r{^#{Regexp.escape(@path)}[^/\s]*/?\s} - path, meta = line.split(' ') paths.push(path) metadata.push(meta) - end + end - [paths, metadata.map { |meta| JSON.parse(meta) }] + [paths, metadata.map { |meta| JSON.parse(meta, symbolize_names: true) }] end def to_string_path diff --git a/lib/gitlab/string_path.rb b/lib/gitlab/string_path.rb index a6234d34e7d..774d4244a2a 100644 --- a/lib/gitlab/string_path.rb +++ b/lib/gitlab/string_path.rb @@ -19,10 +19,6 @@ module Gitlab @path end - def exists? - @path == './' || @universe.include?(@path) - end - def absolute? @path.start_with?('/') end @@ -94,13 +90,17 @@ module Gitlab def metadata index = @universe.index(@path) - @metadata[index] + @metadata[index] || {} end def nodes @path.count('/') + (file? ? 1 : 0) end + def exists? + @path == './' || @universe.include?(@path) + end + def ==(other) @path == other.path && @universe == other.universe end @@ -112,7 +112,7 @@ module Gitlab private def new(path) - self.class.new(path, @universe) + self.class.new(path, @universe, @metadata) end def select |