Websites/app/logical/storage_manager/git.rb
Donovan Daniels f84eef5e5f
Add git storage manager
Yes, I'm aware this is dumb
No, I don't care
2024-06-29 02:13:04 -05:00

29 lines
597 B
Ruby

# frozen_string_literal: true
module StorageManager
class Git < StorageManager::Local
def delete(path)
return unless exists?(path)
super
system!("git add #{base_path}#{path}")
system!("git commit -m \"Remove #{path[1..]}\"")
system!("git push")
end
def put(path, io)
super
if exists?(path)
system!("git add #{base_path}#{path}")
system!("git commit -m \"Add #{path[1..]}\"")
system!("git push")
end
end
private
def system!(*)
system(*, exception: true, chdir: base_path)
end
end
end