Commit 000af871 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Remove redundant code from container registry classes

parent c753975b
...@@ -34,7 +34,7 @@ module Projects ...@@ -34,7 +34,7 @@ module Projects
break if path.has_repository? break if path.has_repository?
ContainerRepository.build_from_path(path).tap do |repository| ContainerRepository.build_from_path(path).tap do |repository|
repository.save if repository.has_tags? repository.save! if repository.has_tags?
end end
end end
end end
......
...@@ -28,7 +28,7 @@ class ContainerRepository < ActiveRecord::Base ...@@ -28,7 +28,7 @@ class ContainerRepository < ActiveRecord::Base
end end
def manifest def manifest
@manifest ||= client.repository_tags(self.path) @manifest ||= client.repository_tags(path)
end end
def tags def tags
...@@ -45,7 +45,7 @@ class ContainerRepository < ActiveRecord::Base ...@@ -45,7 +45,7 @@ class ContainerRepository < ActiveRecord::Base
end end
def has_tags? def has_tags?
tags.to_a.any? tags.any?
end end
def root_repository? def root_repository?
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ContainerRegistry::Blob do describe ContainerRegistry::Blob do
let(:group) { create(:group, name: 'group') } let(:group) { create(:group, name: 'group') }
let(:project) { create(:project, path: 'test', group: group) } let(:project) { create(:empty_project, path: 'test', group: group) }
let(:repository) do let(:repository) do
create(:container_repository, name: 'image', create(:container_repository, name: 'image',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment