-
Notifications
You must be signed in to change notification settings - Fork 77
/
Rakefile
executable file
·54 lines (45 loc) · 1.22 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env rake
require "bundler/gem_helper"
case RUBY_PLATFORM
when "java"
Bundler::GemHelper.install_tasks name: "upsert-java"
else
Bundler::GemHelper.install_tasks name: "upsert"
end
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--format documentation"
end
task :default => :spec
task :rspec_all_databases do
results = {}
dbs = %w{ postgresql mysql sqlite3 }
if ENV['DB']
dbs = ENV['DB'].split(',')
end
dbs.each do |db|
puts
puts '#'*50
puts "# Running specs against #{db}"
puts '#'*50
puts
if RUBY_VERSION >= '1.9'
pid = spawn({'DB' => db}, 'rspec', '--format', 'documentation', File.expand_path('../spec', __FILE__))
Process.waitpid pid
results[db] = $?.success?
else
exec({'DB' => db}, 'rspec', '--format', 'documentation', File.expand_path('../spec', __FILE__))
end
end
puts results.inspect
end
task :n, :from, :to do |t, args|
Dir[File.expand_path("../lib/upsert/**/#{args.from}.*", __FILE__)].each do |path|
dir = File.dirname(path)
File.open("#{dir}/#{args.to}.rb", 'w') do |f|
f.write File.read(path).gsub(args.from, args.to)
end
end
end
require 'yard'
YARD::Rake::YardocTask.new