2024-06-29 07:13:04 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module StorageManager
|
|
|
|
class Git < StorageManager::Local
|
|
|
|
def delete(path)
|
|
|
|
return unless exists?(path)
|
|
|
|
super
|
2024-10-21 06:32:17 +00:00
|
|
|
GitJob.perform_later("#{base_path}#{path}", "git add #{base_path}#{path}", "git commit -m \"Remove #{path[1..]}\"", "git push")
|
2024-06-29 07:13:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def put(path, io)
|
|
|
|
super
|
2024-10-21 06:32:17 +00:00
|
|
|
if exists?(path) # rubocop:disable Style/IfUnlessModifier
|
|
|
|
GitJob.perform_later("#{base_path}#{path}", "git add #{base_path}#{path}", "git commit -m \"Add #{path[1..]}\"", "git push")
|
2024-06-29 07:13:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def system!(*)
|
|
|
|
system(*, exception: true, chdir: base_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|