Skip to content
Newer
Older
100644 133 lines (111 sloc) 3.54 KB
35bfc5a @ciconia Added general Rakefile.
ciconia authored
1 require "rake"
2 require "rake/clean"
3 require "rake/gempackagetask"
4 require "rake/rdoctask"
5 require "fileutils"
6
7 include FileUtils
8
7612b7e @ciconia intermediate step
ciconia authored
9 PROJECTS = %w{sequel_core sequel_model}
35bfc5a @ciconia Added general Rakefile.
ciconia authored
10
11 def with_each_project
12 PROJECTS.each do |p|
13 FileUtils.cd(p)
14 begin
15 yield p
16 ensure
17 FileUtils.cd('..')
18 end
19 end
20 end
21
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
22 def sh_with_each_project(cmd)
23 with_each_project {sh cmd rescue nil}
24 end
25
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
26 ##############################################################################
27 # gem packaging and release
28 ##############################################################################
35bfc5a @ciconia Added general Rakefile.
ciconia authored
29 desc "Packages up Sequel and Sequel Model."
30 task :default => [:package]
31 task :package => [:clean]
32 task :doc => [:rdoc]
33
34 task :package do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
35 sh_with_each_project "rake package"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
36 end
37
38 task :install do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
39 sh_with_each_project "rake install"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
40 end
41
42 task :install_no_docs do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
43 sh_with_each_project "rake install_no_docs"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
44 end
45
46 task :uninstall => [:clean] do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
47 sh_with_each_project "rake uninstall"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
48 end
49
e4db7b0 @ciconia Added a stub for Sequel::Model that auto-loads sequel_model.
ciconia authored
50 task :tag do
51 sh_with_each_project "rake tag"
52 end
53
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
54 ##############################################################################
55 # rspec
56 ##############################################################################
7612b7e @ciconia intermediate step
ciconia authored
57 # task :spec do
58 # sh_with_each_project "rake spec"
59 # end
60 #
61 # task :spec_no_cov do
62 # sh_with_each_project "rake spec_no_cov"
63 # end
64 #
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
65 ##############################################################################
66 # rdoc
67 ##############################################################################
68 RDOC_OPTS = [
69 "--quiet",
70 "--title", "Sequel Model: Lightweight ORM for Ruby",
71 "--opname", "index.html",
72 "--line-numbers",
3ece811 @ciconia In preparation for 1.0.
ciconia authored
73 "--main", "sequel/README",
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
74 "--inline-source"
75 ]
76
77 Rake::RDocTask.new do |rdoc|
3ece811 @ciconia In preparation for 1.0.
ciconia authored
78 rdoc.rdoc_dir = "sequel/doc/rdoc"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
79 rdoc.options += RDOC_OPTS
7612b7e @ciconia intermediate step
ciconia authored
80 rdoc.main = "sequel/README"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
81 rdoc.title = "Sequel: Lightweight ORM for Ruby"
3ece811 @ciconia In preparation for 1.0.
ciconia authored
82 rdoc.rdoc_files.add ["sequel/README", "sequel/COPYING",
7612b7e @ciconia intermediate step
ciconia authored
83 "sequel_core/lib/sequel_core.rb", "sequel_core/lib/**/*.rb",
84 "sequel_model/lib/sequel_model.rb", "sequel_model/lib/**/*.rb",
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
85 ]
86 end
87
88 task :doc_rforge => [:doc]
89
90 desc "Update docs and upload to rubyforge.org"
91 task :doc_rforge do
92 # sh %{rake doc}
7612b7e @ciconia intermediate step
ciconia authored
93 sh %{scp -r sequel/doc/rdoc/* ciconia@rubyforge.org:/var/www/gforge-projects/sequel}
94 end
95
96 ##############################################################################
97 # specs
98 ##############################################################################
99 require "spec/rake/spectask"
100
101 desc "Run specs with coverage"
102 Spec::Rake::SpecTask.new("spec") do |t|
103 t.spec_files = FileList["sequel_core/spec/*_spec.rb", "sequel_model/spec/*_spec.rb"]
104 t.spec_opts = File.read("sequel_core/spec/spec.opts").split("\n")
105 t.rcov_opts = File.read("sequel_core/spec/rcov.opts").split("\n")
106 t.rcov = true
107 end
108
109 desc "Run specs without coverage"
110 Spec::Rake::SpecTask.new("spec_no_cov") do |t|
111 t.spec_files = FileList["sequel_core/spec/*_spec.rb", "sequel_model/spec/*_spec.rb"]
ee4fa06 @ciconia on the way...
ciconia authored
112 t.spec_opts = File.read("sequel_core/spec/spec.opts").split("\n")
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
113 end
114
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
115 ##############################################################################
116 # Statistics
117 ##############################################################################
118
119 STATS_DIRECTORIES = [
120 %w(core_code sequel_core/lib/),
121 %w(core_spec sequel_core/spec/),
122 %w(model_code sequel_model/lib/),
123 %w(model_spec sequel_model/spec/)
124 ].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
125
126 desc "Report code statistics (KLOCs, etc) from the application"
127 task :stats do
128 require "sequel_core/extra/stats"
129 verbose = true
130 CodeStatistics.new(*STATS_DIRECTORIES).to_s
131 end
132
Something went wrong with that request. Please try again.