mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-17 14:02:09 +09:00
Hello world
First open source release of Campfire 🎉
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
require File.expand_path("../../config/environment", File.dirname(__FILE__))
|
||||
|
||||
vapid_key = WebPush.generate_key
|
||||
|
||||
puts "PRIVATE KEY : #{vapid_key.private_key}"
|
||||
puts "PUBLIC KEY : #{vapid_key.public_key}"
|
||||
Executable
+27
@@ -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
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env ruby
|
||||
require File.expand_path("../../config/environment", File.dirname(__FILE__))
|
||||
|
||||
abort "Usage: #{$0} <email-address> <password>" unless ARGV.length == 2
|
||||
|
||||
email_address, password = ARGV
|
||||
if user = User.find_by(email_address: email_address)
|
||||
user.update!(password: password)
|
||||
puts "Password has been reset"
|
||||
else
|
||||
puts "User not found"
|
||||
exit -1
|
||||
end
|
||||
Reference in New Issue
Block a user