2016-04-14 10:57:25 -04:00
|
|
|
module Gitlab
|
2016-03-08 06:35:37 -05:00
|
|
|
module ImportExport
|
|
|
|
class Shared
|
2016-05-11 11:22:45 -04:00
|
|
|
attr_reader :errors, :opts
|
2016-05-10 11:15:20 -04:00
|
|
|
|
2016-03-08 06:35:37 -05:00
|
|
|
def initialize(opts)
|
|
|
|
@opts = opts
|
2016-05-10 11:15:20 -04:00
|
|
|
@errors = []
|
2016-03-08 06:35:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def export_path
|
2016-06-02 08:44:59 -04:00
|
|
|
@export_path ||= Gitlab::ImportExport.export_path(relative_path: opts[:relative_path])
|
2016-03-08 06:35:37 -05:00
|
|
|
end
|
2016-05-10 11:15:20 -04:00
|
|
|
|
2016-05-13 06:33:13 -04:00
|
|
|
def error(error)
|
|
|
|
error_out(error.message, caller[0].dup)
|
|
|
|
@errors << error.message
|
|
|
|
# Debug:
|
2017-09-03 14:51:50 -04:00
|
|
|
Rails.logger.error(error.backtrace.join("\n"))
|
2016-05-10 11:15:20 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def error_out(message, caller)
|
|
|
|
Rails.logger.error("Import/Export error raised on #{caller}: #{message}")
|
|
|
|
end
|
2016-03-08 06:35:37 -05:00
|
|
|
end
|
|
|
|
end
|
2016-03-08 12:20:32 -05:00
|
|
|
end
|