Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 134 lines (113 sloc) 3.865 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
da3605c @jeremyevans Change from 3 gems (sequel, sequel_core, sequel_model) to 2 gems (sequel...
authored
9 PROJECTS = %w{sequel_core sequel}
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
10 CLEAN.include ["rdoc", "coverage"]
35bfc5a @ciconia Added general Rakefile.
ciconia authored
11
12 def with_each_project
13 PROJECTS.each do |p|
14 FileUtils.cd(p)
15 begin
16 yield p
17 ensure
18 FileUtils.cd('..')
19 end
20 end
21 end
22
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
23 def sh_with_each_project(cmd)
24 with_each_project {sh cmd rescue nil}
25 end
26
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
27 ##############################################################################
28 # gem packaging and release
29 ##############################################################################
da3605c @jeremyevans Change from 3 gems (sequel, sequel_core, sequel_model) to 2 gems (sequel...
authored
30 desc "Packages up sequel and sequel_core."
35bfc5a @ciconia Added general Rakefile.
ciconia authored
31 task :package do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
32 sh_with_each_project "rake package"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
33 end
34
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task, p...
authored
35 desc "Install sequel and sequel_core gems"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
36 task :install do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
37 sh_with_each_project "rake install"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
38 end
39
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task, p...
authored
40 desc "Install sequel and sequel_core gems without RDoc"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
41 task :install_no_docs do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
42 sh_with_each_project "rake install_no_docs"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
43 end
44
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task, p...
authored
45 desc "Uninstall sequel and sequel_core gems"
46 task :uninstall do
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
47 sh_with_each_project "rake uninstall"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
48 end
49
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task, p...
authored
50 desc "Upload sequel and sequel_core gems to rubyforge"
51 task :release do
52 sh_with_each_project "rake release"
53 end
54
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
55 task :clean => [:clean_subdirs]
56 desc "Clean files from both subdirectories"
57 task :clean_subdirs do
58 sh_with_each_project "rake clean"
59 end
60
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
61 ##############################################################################
62 # rspec
63 ##############################################################################
7612b7e @ciconia intermediate step
ciconia authored
64 # task :spec do
65 # sh_with_each_project "rake spec"
66 # end
67 #
68 # task :spec_no_cov do
69 # sh_with_each_project "rake spec_no_cov"
70 # end
71 #
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
72 ##############################################################################
73 # rdoc
74 ##############################################################################
63665a9 @jeremyevans Refactor Rakefile rdoc tasks, and fix default task description
authored
75 RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source"]
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
76
77 Rake::RDocTask.new do |rdoc|
d1fadee @jeremyevans Refactor RDoc creation and options in Rakefiles
authored
78 rdoc.rdoc_dir = "rdoc"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
79 rdoc.options += RDOC_OPTS
63665a9 @jeremyevans Refactor Rakefile rdoc tasks, and fix default task description
authored
80 rdoc.main = "sequel_core/README"
de172d9 @ciconia Merged new associations branch into trunk.
ciconia authored
81 rdoc.title = "Sequel: The Database Toolkit for Ruby"
63665a9 @jeremyevans Refactor Rakefile rdoc tasks, and fix default task description
authored
82 rdoc.rdoc_files.add ["sequel*/README", "sequel*/COPYING", "sequel*/lib/**/*.rb"]
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
83 end
84
85 desc "Update docs and upload to rubyforge.org"
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task, p...
authored
86 task :doc_rforge => [:rdoc]
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
87 task :doc_rforge do
d1fadee @jeremyevans Refactor RDoc creation and options in Rakefiles
authored
88 sh %{chmod -R g+w rdoc/*}
89 sh %{scp -rp rdoc/* rubyforge.org:/var/www/gforge-projects/sequel}
7612b7e @ciconia intermediate step
ciconia authored
90 end
91
92 ##############################################################################
93 # specs
94 ##############################################################################
95 require "spec/rake/spectask"
4080ef5 @jeremyevans Allow running of specs without installing a new version of sequel_core f...
authored
96 sqcdir = File.join(File.dirname(__FILE__), 'sequel_core', 'lib')
97 fixRUBYLIB = Proc.new{ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{sqcdir}") : (ENV['RUBYLIB'] = sqcdir)}
7612b7e @ciconia intermediate step
ciconia authored
98
99 desc "Run specs with coverage"
100 Spec::Rake::SpecTask.new("spec") do |t|
4080ef5 @jeremyevans Allow running of specs without installing a new version of sequel_core f...
authored
101 fixRUBYLIB.call
da3605c @jeremyevans Change from 3 gems (sequel, sequel_core, sequel_model) to 2 gems (sequel...
authored
102 t.spec_files = FileList["sequel_core/spec/*_spec.rb", "sequel/spec/*_spec.rb"]
7612b7e @ciconia intermediate step
ciconia authored
103 t.spec_opts = File.read("sequel_core/spec/spec.opts").split("\n")
104 t.rcov_opts = File.read("sequel_core/spec/rcov.opts").split("\n")
105 t.rcov = true
106 end
107
108 desc "Run specs without coverage"
63665a9 @jeremyevans Refactor Rakefile rdoc tasks, and fix default task description
authored
109 task :default => [:spec_no_cov]
7612b7e @ciconia intermediate step
ciconia authored
110 Spec::Rake::SpecTask.new("spec_no_cov") do |t|
4080ef5 @jeremyevans Allow running of specs without installing a new version of sequel_core f...
authored
111 fixRUBYLIB.call
da3605c @jeremyevans Change from 3 gems (sequel, sequel_core, sequel_model) to 2 gems (sequel...
authored
112 t.spec_files = FileList["sequel_core/spec/*_spec.rb", "sequel/spec/*_spec.rb"]
ee4fa06 @ciconia on the way...
ciconia authored
113 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
114 end
115
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
116 ##############################################################################
117 # Statistics
118 ##############################################################################
119
120 STATS_DIRECTORIES = [
121 %w(core_code sequel_core/lib/),
122 %w(core_spec sequel_core/spec/),
da3605c @jeremyevans Change from 3 gems (sequel, sequel_core, sequel_model) to 2 gems (sequel...
authored
123 %w(model_code sequel/lib/),
124 %w(model_spec sequel/spec/)
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
125 ].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
126
127 desc "Report code statistics (KLOCs, etc) from the application"
128 task :stats do
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
129 require "extra/stats"
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
130 verbose = true
131 CodeStatistics.new(*STATS_DIRECTORIES).to_s
132 end
133
Something went wrong with that request. Please try again.