Commit 9972abc2 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Add methods to build eraseable component

parent c1affed1
......@@ -35,6 +35,9 @@
module Ci
class Build < CommitStatus
include Compoundable
component :eraseable, Gitlab::Ci::Build::Eraseable
include Gitlab::Application.routes.url_helpers
LAZY_ATTRIBUTES = ['trace']
......
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