Commit f6a91ccc authored by Grzegorz Bizon's avatar Grzegorz Bizon

Move eraseable implementation to build concern

parent 9972abc2
......@@ -35,10 +35,9 @@
module Ci
class Build < CommitStatus
include Compoundable
component :eraseable, Gitlab::Ci::Build::Eraseable
include Gitlab::Application.routes.url_helpers
include Eraseable
LAZY_ATTRIBUTES = ['trace']
belongs_to :runner, class_name: 'Ci::Runner'
......
module Ci
class Build
module Eraseable
include ActiveSupport::Concern
def erase!
raise NotImplementedError
end
def erased?
raise NotImpementedError
end
end
end
end
module Compoundable
extend ActiveSupport::Concern
class_methods do
private
def component(name, klass)
define_method(name) do
component_object = instance_variable_get("@#{name}")
return component_object if component_object
instance_variable_set("@#{name}", klass.new(self))
end
klass.instance_methods(false).each do |method|
delegate method, to: name
end
end
end
end
module Gitlab
module Ci
module Build
class Eraseable
def initialize(build)
@build = build
end
def erase!
raise NotImplementedError
end
def erased?
@build.artifacts_file.exists? && @build.artifacts_metadata.exists?
end
private
def trace_file
raise NotImplementedError
end
end
end
end
end
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