2012-10-11 23:15:24 +02:00
|
|
|
module Gitlab
|
|
|
|
class FileEditor
|
|
|
|
|
2012-10-12 13:06:12 +02:00
|
|
|
attr_accessor :user, :project, :ref
|
2012-10-11 23:15:24 +02:00
|
|
|
|
2012-10-12 13:06:12 +02:00
|
|
|
def initialize(user, project, ref)
|
2012-10-11 23:15:24 +02:00
|
|
|
self.user = user
|
|
|
|
self.project = project
|
2012-10-12 13:06:12 +02:00
|
|
|
self.ref = ref
|
2012-10-11 23:15:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def can_edit?(path, last_commit)
|
2012-10-12 13:06:12 +02:00
|
|
|
current_last_commit = @project.commits(ref, path, 1).first.sha
|
|
|
|
last_commit == current_last_commit
|
2012-10-11 23:15:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def update(path, content)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|