forked from jeremyevans/sequel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
132 lines (116 loc) · 3.77 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
require "rake"
require "rake/clean"
require "rake/gempackagetask"
require "spec/rake/spectask"
begin
require "hanna/rdoctask"
rescue LoadError
require "rake/rdoctask"
end
require "fileutils"
require "lib/sequel_core/version"
include FileUtils
NAME = 'sequel'
VERS = Sequel.version
CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage", "www/public/*.html"]
RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
'Sequel: The Database Toolkit for Ruby', '--main', 'README.rdoc']
# Gem Packaging and Release
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = NAME
s.rubyforge_project = 'sequel'
s.version = VERS
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG", "COPYING"] + Dir["doc/*.rdoc"] + Dir['doc/release_notes/*.txt']
s.rdoc_options += RDOC_OPTS
s.summary = "The Database Toolkit for Ruby"
s.description = s.summary
s.author = "Jeremy Evans"
s.email = "[email protected]"
s.homepage = "http://sequel.rubyforge.org"
s.required_ruby_version = ">= 1.8.4"
s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
s.require_path = "lib"
s.bindir = 'bin'
s.executables << 'sequel'
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
### RDoc
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.options += RDOC_OPTS
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG COPYING lib/**/*.rb doc/*.rdoc doc/release_notes/*.txt"
end
### Specs
lib_dir = File.join(File.dirname(__FILE__), 'lib')
fixRUBYLIB = Proc.new{ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)}
sequel_core_specs = "spec/sequel_core/*_spec.rb"
sequel_model_specs = "spec/sequel_model/*_spec.rb"
spec_opts = proc{File.read("spec/spec.opts").split("\n")}
rcov_opts = proc{File.read("spec/rcov.opts").split("\n")}
desc "Run core and model specs with coverage"
Spec::Rake::SpecTask.new("spec_coverage") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
t.spec_opts = spec_opts.call
t.rcov_opts = rcov_opts.call
t.rcov = true
end
desc "Run core and model specs"
task :default => [:spec]
Spec::Rake::SpecTask.new("spec") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
t.spec_opts = spec_opts.call
end
desc "Run core specs"
Spec::Rake::SpecTask.new("spec_core") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs]
t.spec_opts = spec_opts.call
end
desc "Run model specs"
Spec::Rake::SpecTask.new("spec_model") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_model_specs]
t.spec_opts = spec_opts.call
end
desc "Run integration tests"
Spec::Rake::SpecTask.new("integration") do |t|
fixRUBYLIB.call
t.spec_files = FileList["spec/integration/*_test.rb"]
t.spec_opts = spec_opts.call
end
%w'postgres sqlite mysql informix oracle ado'.each do |adapter|
desc "Run #{adapter} specs without coverage"
Spec::Rake::SpecTask.new("spec_#{adapter}") do |t|
t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
t.spec_opts = spec_opts.call
end
end
desc "check documentation coverage"
task :dcov do
sh %{find lib -name '*.rb' | xargs dcov}
end
### Statistics
STATS_DIRECTORIES = [
%w(Code lib/),
%w(Spec spec),
].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
desc "Report code statistics (KLOCs, etc) from the application"
task :stats do
require "extra/stats"
verbose = true
CodeStatistics.new(*STATS_DIRECTORIES).to_s
end
desc "uninstall"
task :uninstall do
sh "gem uninstall sequel"
end
desc "reinstall"
task :reinstall => [:uninstall, :gemspec, :build, :install]