2016-01-14 18:37:52 +05:30
|
|
|
module Gitlab
|
|
|
|
module GithubImport
|
|
|
|
class BaseFormatter
|
2017-08-17 22:00:37 +05:30
|
|
|
attr_reader :client, :formatter, :project, :raw_data
|
2016-01-14 18:37:52 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def initialize(project, raw_data, client = nil)
|
2016-01-14 18:37:52 +05:30
|
|
|
@project = project
|
|
|
|
@raw_data = raw_data
|
2017-08-17 22:00:37 +05:30
|
|
|
@client = client
|
2016-01-14 18:37:52 +05:30
|
|
|
@formatter = Gitlab::ImportFormatter.new
|
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
def create!
|
2016-11-03 12:29:30 +05:30
|
|
|
project.public_send(project_association).find_or_create_by!(find_condition) do |record|
|
|
|
|
record.attributes = attributes
|
|
|
|
end
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def url
|
|
|
|
raw_data.url || ''
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
2016-01-14 18:37:52 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|