Skip to content

Instantly share code, notes, and snippets.

@jakenotjacob
Created November 20, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakenotjacob/5c69f957973d8b7aa29d to your computer and use it in GitHub Desktop.
Save jakenotjacob/5c69f957973d8b7aa29d to your computer and use it in GitHub Desktop.
Rakefile for IRC bot to create/reset database...
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
namespace :db do
require 'sequel'
DB = Sequel.sqlite("db/bot.db")
desc "Create default database schema."
task :create do
if File.exists? "db/bot.db"
puts "Database has not been created. It already exists!"
else
puts "Creating default database..."
DB.create_table :facts do
primary_key :id
String :name
String :response
end
end
end
desc "Empties the database, resetting to initial schema."
task :reset do
puts "Resetting the database..."
#If database exists, Code to reset database to defaults
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment