Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 159 lines (137 sloc) 4.878 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"
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
6 require "spec/rake/spectask"
35bfc5a @ciconia Added general Rakefile.
ciconia authored
7
8 include FileUtils
9
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
10 NAME = 'sequel'
11 VERS = '2.2.0'
12 CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage"]
13 RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
14 'Sequel: The Database Toolkit for Ruby', '--main', 'README']
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
15
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
16 ##############################################################################
17 # gem packaging and release
18 ##############################################################################
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
19 desc "Packages sequel"
20 task :package=>[:clean]
21 spec = Gem::Specification.new do |s|
22 s.name = NAME
23 s.rubyforge_project = 'sequel'
24 s.version = VERS
25 s.platform = Gem::Platform::RUBY
26 s.has_rdoc = true
27 s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"] + Dir["doc/*.rdoc"]
28 s.rdoc_options += RDOC_OPTS
29 s.summary = "The Database Toolkit for Ruby"
30 s.description = s.summary
31 s.author = "Jeremy Evans"
32 s.email = "code@jeremyevans.net"
33 s.homepage = "http://sequel.rubyforge.org"
34 s.required_ruby_version = ">= 1.8.4"
35 s.files = %w(COPYING CHANGELOG README Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
36 s.require_path = "lib"
37 s.bindir = 'bin'
35bfc5a @ciconia Added general Rakefile.
ciconia authored
38 end
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
39 Rake::GemPackageTask.new(spec) do |p|
40 p.need_tar = true
41 p.gem_spec = spec
35bfc5a @ciconia Added general Rakefile.
ciconia authored
42 end
43
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
44 desc "Install sequel gem"
45 task :install=>[:package] do
46 sh %{sudo gem install pkg/#{NAME}-#{VERS} --local}
35bfc5a @ciconia Added general Rakefile.
ciconia authored
47 end
48
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
49 desc "Install sequel gem without RDoc"
50 task :install_no_docs=>[:package] do
51 sh %{sudo gem install pkg/#{NAME}-#{VERS} --no-rdoc --no-ri --local}
35bfc5a @ciconia Added general Rakefile.
ciconia authored
52 end
53
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
54 desc "Uninstall sequel gem"
55 task :uninstall=>[:clean] do
56 sh %{sudo gem uninstall #{NAME}}
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task…
authored
57 end
58
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
59 desc "Upload sequel and sequel_core gems to rubyforge"
60 task :release=>[:package] do
61 sh %{rubyforge login}
62 sh %{rubyforge add_release sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.tgz}
63 sh %{rubyforge add_file sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.gem}
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
64 end
65
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
66 ##############################################################################
67 # rdoc
68 ##############################################################################
69 Rake::RDocTask.new do |rdoc|
d1fadee @jeremyevans Refactor RDoc creation and options in Rakefiles
authored
70 rdoc.rdoc_dir = "rdoc"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
71 rdoc.options += RDOC_OPTS
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
72 rdoc.rdoc_files.add %w"README CHANGELOG COPYING lib/**/*.rb doc/*.rdoc"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
73 end
74
75 desc "Update docs and upload to rubyforge.org"
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task…
authored
76 task :doc_rforge => [:rdoc]
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
77 task :doc_rforge do
d1fadee @jeremyevans Refactor RDoc creation and options in Rakefiles
authored
78 sh %{chmod -R g+w rdoc/*}
79 sh %{scp -rp rdoc/* rubyforge.org:/var/www/gforge-projects/sequel}
7612b7e @ciconia intermediate step
ciconia authored
80 end
81
82 ##############################################################################
83 # specs
84 ##############################################################################
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
85 lib_dir = File.join(File.dirname(__FILE__), 'lib')
86 fixRUBYLIB = Proc.new{ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)}
87 sequel_core_specs = "spec/sequel_core/*_spec.rb"
88 sequel_model_specs = "spec/sequel_model/*_spec.rb"
89 spec_opts = proc{File.read("spec/spec.opts").split("\n")}
90 rcov_opts = proc{File.read("spec/rcov.opts").split("\n")}
91
92 desc "Run core and model specs with coverage"
93 Spec::Rake::SpecTask.new("spec_coverage") do |t|
94 fixRUBYLIB.call
95 t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
96 t.spec_opts = spec_opts.call
97 t.rcov_opts = rcov_opts.call
98 t.rcov = true
99 end
7612b7e @ciconia intermediate step
ciconia authored
100
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
101 desc "Run core and model specs"
102 task :default => [:spec]
7612b7e @ciconia intermediate step
ciconia authored
103 Spec::Rake::SpecTask.new("spec") do |t|
4080ef5 @jeremyevans Allow running of specs without installing a new version of sequel_cor…
authored
104 fixRUBYLIB.call
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
105 t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
106 t.spec_opts = spec_opts.call
107 end
108
109 desc "Run core specs"
110 Spec::Rake::SpecTask.new("spec_core") do |t|
111 fixRUBYLIB.call
112 t.spec_files = FileList[sequel_core_specs]
113 t.spec_opts = spec_opts.call
7612b7e @ciconia intermediate step
ciconia authored
114 end
115
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
116 desc "Run model specs"
117 Spec::Rake::SpecTask.new("spec_model") do |t|
4080ef5 @jeremyevans Allow running of specs without installing a new version of sequel_cor…
authored
118 fixRUBYLIB.call
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
119 t.spec_files = FileList[sequel_model_specs]
120 t.spec_opts = spec_opts.call
121 end
122
0eba5fe @jeremyevans Add integration test suite, testing sequel against a real database, w…
authored
123 desc "Run integration tests"
124 Spec::Rake::SpecTask.new("integration") do |t|
125 fixRUBYLIB.call
126 t.spec_files = FileList["spec/integration/*_test.rb"]
127 t.spec_opts = spec_opts.call
128 end
129
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
130 %w'postgres sqlite mysql informix oracle'.each do |adapter|
131 desc "Run #{adapter} specs without coverage"
132 Spec::Rake::SpecTask.new("spec_#{adapter}") do |t|
133 t.spec_files = "spec/adapters/#{adapter}_spec.rb"
134 t.spec_opts = spec_opts.call
135 end
136 end
137
138 desc "check documentation coverage"
139 task :dcov do
140 sh %{find lib -name '*.rb' | xargs dcov}
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
141 end
142
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
143 ##############################################################################
144 # Statistics
145 ##############################################################################
146
147 STATS_DIRECTORIES = [
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
148 %w(Code lib/),
149 %w(Spec spec),
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
150 ].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
151
152 desc "Report code statistics (KLOCs, etc) from the application"
153 task :stats do
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
154 require "extra/stats"
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
155 verbose = true
156 CodeStatistics.new(*STATS_DIRECTORIES).to_s
157 end
158
Something went wrong with that request. Please try again.