Hello world

First open source release of Campfire 🎉
This commit is contained in:
Kevin McConnell
2025-08-15 11:02:42 +01:00
commit df76a227dc
664 changed files with 36235 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
require File.expand_path("../../config/environment", File.dirname(__FILE__))
class Backup
class << self
def create
dest = SQLite3::Database.new(backup_filename)
backup = SQLite3::Backup.new(dest, "main", Room.connection.raw_connection, "main")
backup.step(-1)
backup.finish
dest.close
end
private
def backup_filename
Rails.root.join("storage", "backups").tap(&:mkpath).join(primary_database_filename)
end
def primary_database_filename
path = Rails.application.config.database_configuration[Rails.env]["primary"]["database"]
File.basename(path)
end
end
end
Backup.create