mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
require "bundler/gem_tasks"
|
|
require "rake/extensiontask"
|
|
require "rake/testtask"
|
|
|
|
Rake::ExtensionTask.new do |ext|
|
|
ext.name = "cext"
|
|
ext.ext_dir = "ext/trilogy-ruby"
|
|
ext.lib_dir = "lib/trilogy"
|
|
end
|
|
|
|
# When any of the parent library's files change, we need to re-run extconf
|
|
vendored_c_lib = FileList["ext/trilogy-ruby/src/**/*.c", "ext/trilogy-ruby/inc/**/*.h"]
|
|
if extconf_task = Rake.application.tasks.find { |t| t.name =~ /Makefile/ }
|
|
task extconf_task => vendored_c_lib
|
|
end
|
|
|
|
Rake::TestTask.new do |t|
|
|
t.libs << "test"
|
|
t.test_files = FileList['test/*_test.rb']
|
|
t.verbose = true
|
|
end
|
|
|
|
task :test => [:compile, "db:clean"]
|
|
|
|
task :default => :test
|
|
|
|
task :console => :compile do
|
|
sh "ruby -I lib -r trilogy -S irb"
|
|
end
|
|
|
|
namespace :db do
|
|
task :create do
|
|
mysql_command = "mysql -uroot -e"
|
|
%x( #{mysql_command} "create DATABASE IF NOT EXISTS test DEFAULT CHARACTER SET utf8mb4" )
|
|
end
|
|
|
|
task :drop do
|
|
mysql_command = "mysql -uroot -e"
|
|
%x( #{mysql_command} "drop DATABASE IF EXISTS test" )
|
|
end
|
|
|
|
task :clean => ["db:drop", "db:create"]
|
|
end
|