forked from jeremyevans/fixture_dependencies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (45 loc) · 1.31 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
require 'rake'
require 'rake/clean'
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source"]
rdoc_task_class = begin
require "rdoc/task"
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
RDoc::Task
rescue LoadError
begin
require "rake/rdoctask"
Rake::RDocTask
rescue LoadError, StandardError
end
end
CLEAN.include ["rdoc", "spec/db/fd_spec.sqlite3"]
rdoc_task_class.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.options += RDOC_DEFAULT_OPTS
rdoc.main = "README.md"
rdoc.title = "fixture_dependencies: Sequel/ActiveRecord fixture loader that handles dependency graphs"
rdoc.rdoc_files.add ["README.md", "MIT-LICENSE", "lib/**/*.rb"]
end
desc "Package fixture_dependencies"
task :package do
sh %{gem build fixture_dependencies.gemspec}
end
desc "Run Sequel and ActiveRecord specs"
task :default=>[:spec_migrate, :spec_sequel, :spec_ar]
desc "Run Sequel specs"
task :spec_sequel do
sh "#{FileUtils::RUBY} -I lib spec/fd_spec.rb"
end
desc "Run ActiveRecord specs"
task :spec_ar do
ENV['FD_AR'] = '1'
sh "#{FileUtils::RUBY} -I lib spec/fd_spec.rb"
ENV.delete('FD_AR')
end
desc "Create spec database"
task :spec_migrate do
unless File.exist?('spec/db/fd_spec.sqlite3')
sh %{mkdir -p spec/db}
sh %{#{FileUtils::RUBY} -S sequel -m spec/migrate sqlite://spec/db/fd_spec.sqlite3}
end
end