Created
November 20, 2015 16:12
-
-
Save jakenotjacob/5c69f957973d8b7aa29d to your computer and use it in GitHub Desktop.
Rakefile for IRC bot to create/reset database...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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