2015-12-23 17:02:59 -05:00
|
|
|
module Gitlab
|
|
|
|
module GithubImport
|
|
|
|
class BaseFormatter
|
2017-02-03 10:07:22 -05:00
|
|
|
attr_reader :client, :formatter, :project, :raw_data
|
2015-12-23 17:02:59 -05:00
|
|
|
|
2017-02-03 10:07:22 -05:00
|
|
|
def initialize(project, raw_data, client = nil)
|
2015-12-23 17:02:59 -05:00
|
|
|
@project = project
|
|
|
|
@raw_data = raw_data
|
2017-02-03 10:07:22 -05:00
|
|
|
@client = client
|
2015-12-23 17:02:59 -05:00
|
|
|
@formatter = Gitlab::ImportFormatter.new
|
|
|
|
end
|
|
|
|
|
2016-06-06 13:00:44 -04:00
|
|
|
def create!
|
2016-10-27 08:54:51 -04:00
|
|
|
project.public_send(project_association).find_or_create_by!(find_condition) do |record|
|
2016-10-19 14:42:31 -04:00
|
|
|
record.attributes = attributes
|
|
|
|
end
|
2016-06-06 13:00:44 -04:00
|
|
|
end
|
|
|
|
|
2016-12-15 11:36:53 -05:00
|
|
|
def url
|
|
|
|
raw_data.url || ''
|
|
|
|
end
|
2015-12-23 17:02:59 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|