-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
121 lines (96 loc) · 3.7 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
##############################################################################
# Gem Management
##############################################################################
require "rake"
require "rake/clean"
require "rake/gempackagetask"
require "rake/rdoctask"
require "fileutils"
include FileUtils
CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
##############################################################################
# Load Gemspec Data
##############################################################################
gemspec_data = File.read("sequel_nested_set.gemspec")
spec = nil
Thread.new { spec = eval("$SAFE = 3\n#{gemspec_data}") }.join
desc "Packages up the Sequel Plugin: #{spec.name}."
task :default => [:package]
task :package => [:clean]
task :doc => [:rdoc]
##############################################################################
# RDoc Task
##############################################################################
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = "doc/rdoc"
rdoc.options += spec.rdoc_options
rdoc.main = "README"
rdoc.title = spec.name
rdoc.rdoc_files.add ["lib/*.rb", "lib/**/*.rb"]
rdoc.rdoc_files.add spec.extra_rdoc_files
end
Rake::GemPackageTask.new(spec) do |p|
p.need_tar = true
p.gem_spec = spec
end
##############################################################################
# Rubyforge Managment Tasks
##############################################################################
task :release => [:package] do
sh %{rubyforge login}
sh %{rubyforge add_release sequel #{spec.name} #{Version} pkg/#{spec.name}-#{spec.version}.tgz}
sh %{rubyforge add_file sequel #{spec.name} #{Version} pkg/#{spec.name}-#{spec.version}.gem}
end
task :install do
sh %{rake package}
sh %{sudo gem install pkg/#{spec.name}-#{spec.version}.gem}
end
task :install_no_docs do
sh %{rake package}
sh %{sudo gem install pkg/#{spec.name}-#{spec.version}.gem --no-rdoc --no-ri}
end
task :uninstall => [:clean] do
sh %{sudo gem uninstall #{spec.name}}
end
desc "Update docs and upload to rubyforge.org"
task :doc_rforge do
sh %{rake doc}
sh %{scp -r doc/rdoc/* [email protected]:/var/www/gforge-projects/sequel/plugins/#{spec.name}}
end
##############################################################################
# rSpec
##############################################################################
require "spec/rake/spectask"
desc "Run specs with coverage"
Spec::Rake::SpecTask.new("spec") do |spec_task|
spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
spec_task.spec_files = FileList["spec/*_spec.rb"].sort
spec_task.rcov = true
spec_task.rcov_opts = lambda do
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
end
end
desc "Run specs without coverage"
Spec::Rake::SpecTask.new("spec_no_cov") do |spec_task|
spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
spec_task.spec_files = FileList["spec/*_spec.rb"].sort
end
desc "Run all specs with coverage"
Spec::Rake::SpecTask.new("specs") do |spec_task|
spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
spec_task.spec_files = FileList["spec/**/*_spec.rb"].sort
spec_task.rcov = true
spec_task.rcov_opts = lambda do
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
end
end
desc "Run all specs without coverage"
Spec::Rake::SpecTask.new("specs_no_cov") do |spec_task|
spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
spec_task.spec_files = FileList["spec/**/*_spec.rb"].sort
end
desc "Run all specs and output html"
Spec::Rake::SpecTask.new("specs_html") do |spec_task|
spec_task.spec_opts = ["--format", "html"]
spec_task.spec_files = Dir["spec/**/*_spec.rb"].sort
end