Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 177 lines (145 sloc) 5.519 kB
35bfc5a @ciconia Added general Rakefile.
ciconia authored
1 require "rake"
2 require "rake/clean"
3
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
4 NAME = 'sequel'
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
5 VERS = lambda do
a86f93f In Ruby 1.9.2 current directory is no longer in $LOAD_PATH.
Jakub Stastny aka Botanicus authored
6 require File.expand_path("../lib/sequel/version", __FILE__)
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
7 Sequel.version
8 end
16677cb @jeremyevans Add .rbc files to ignore and clean files
authored
9 CLEAN.include ["**/.*.sw?", "sequel-*.gem", ".config", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc*", '**/*.rbc']
824515b @jeremyevans Allow disabling use of sudo with SUDO='' when running the rake instal…
authored
10 SUDO = ENV['SUDO'] || 'sudo'
b2ea1ba @ciconia Fixed Rakefile.
ciconia authored
11
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
12 # Gem Packaging and Release
13
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
14 desc "Packages sequel"
15705ff @jeremyevans Move gem specification out of Rakefile (Fixes #285)
authored
15 task :package=>[:clean] do |p|
7db36fa @jeremyevans Make rake package task not assume name of gem binary
authored
16 load './sequel.gemspec'
17 Gem::Builder.new(SEQUEL_GEMSPEC).build
35bfc5a @ciconia Added general Rakefile.
ciconia authored
18 end
19
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
20 desc "Install sequel gem"
21 task :install=>[:package] do
824515b @jeremyevans Allow disabling use of sudo with SUDO='' when running the rake instal…
authored
22 sh %{#{SUDO} gem install ./#{NAME}-#{VERS.call} --local}
35bfc5a @ciconia Added general Rakefile.
ciconia authored
23 end
24
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
25 desc "Uninstall sequel gem"
26 task :uninstall=>[:clean] do
824515b @jeremyevans Allow disabling use of sudo with SUDO='' when running the rake instal…
authored
27 sh %{#{SUDO} gem uninstall #{NAME}}
48d9aa3 @jeremyevans Add descriptions to all rake tasks, and a top level rake release task…
authored
28 end
29
77c0483 @jeremyevans Switch release task to use gemcutter instead of rubyforge
authored
30 desc "Upload sequel gem to gemcutter"
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
31 task :release=>[:package] do
15705ff @jeremyevans Move gem specification out of Rakefile (Fixes #285)
authored
32 sh %{gem push ./#{NAME}-#{VERS.call}.gem}
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
33 end
34
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
35 ### RDoc
36
38e8924 @jeremyevans Use hanna-nouveau instead of hanna as the RDoc template
authored
37 RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Sequel: The Database Toolkit for Ruby']
38
39 rdoc_task_class = begin
40 require "rdoc/task"
41 RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
42 RDoc::Task
43 rescue LoadError
44 require "rake/rdoctask"
45 Rake::RDocTask
46 end
47
48 RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
49
50 rdoc_task_class.new do |rdoc|
d1fadee @jeremyevans Refactor RDoc creation and options in Rakefiles
authored
51 rdoc.rdoc_dir = "rdoc"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
52 rdoc.options += RDOC_OPTS
56562f0 @jeremyevans Rename COPYING file to MIT-LICENSE
authored
53 rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb doc/*.rdoc doc/release_notes/*.txt"
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
54 end
55
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
56 ### Website
57
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
58 desc "Make local version of website"
59 task :website do
fe3705b @jeremyevans Use FileUtils::RUBY instead of RUBY in the Rakefile, to work with rak…
authored
60 sh %{#{FileUtils::RUBY} www/make_www.rb}
bedb708 @jeremyevans Split website update Rakefile tasks into RDoc and Non-RDoc parts
authored
61 end
62
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
63 desc "Make rdoc for website"
64 task :website_rdoc=>[:website_rdoc_main, :website_rdoc_adapters, :website_rdoc_plugins]
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
65
38e8924 @jeremyevans Use hanna-nouveau instead of hanna as the RDoc template
authored
66 rdoc_task_class.new(:website_rdoc_main) do |rdoc|
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
67 rdoc.rdoc_dir = "www/public/rdoc"
68 rdoc.options += RDOC_OPTS
56562f0 @jeremyevans Rename COPYING file to MIT-LICENSE
authored
69 rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/*.rb lib/sequel/*.rb lib/sequel/{connection_pool,dataset,database,model}/*.rb doc/*.rdoc doc/release_notes/*.txt lib/sequel/extensions/migration.rb"
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
70 end
7612b7e @ciconia intermediate step
ciconia authored
71
38e8924 @jeremyevans Use hanna-nouveau instead of hanna as the RDoc template
authored
72 rdoc_task_class.new(:website_rdoc_adapters) do |rdoc|
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
73 rdoc.rdoc_dir = "www/public/rdoc-adapters"
74 rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
75 rdoc.rdoc_files.add %w"lib/sequel/adapters/**/*.rb"
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
76 end
77
38e8924 @jeremyevans Use hanna-nouveau instead of hanna as the RDoc template
authored
78 rdoc_task_class.new(:website_rdoc_plugins) do |rdoc|
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
79 rdoc.rdoc_dir = "www/public/rdoc-plugins"
80 rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
81 rdoc.rdoc_files.add %w"lib/sequel/{extensions,plugins}/**/*.rb"
7612b7e @ciconia intermediate step
ciconia authored
82 end
83
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
84 desc "Update Non-RDoc section of sequel.rubyforge.org"
85 task :website_rf_base=>[:website] do
86 sh %{rsync -rt www/public/*.html rubyforge.org:/var/www/gforge-projects/sequel/}
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
87 end
88
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
89 desc "Update sequel.rubyforge.org"
90 task :website_rf=>[:website, :website_rdoc] do
91 sh %{rsync -rvt www/public/* rubyforge.org:/var/www/gforge-projects/sequel/}
6f31723 @jeremyevans Move caching, hook class methods, and STI into plugins, deprecate old…
authored
92 end
93
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
94 ### Specs
95
96 begin
c5b45d7 @jeremyevans Support RSpec 2, keeping backwards compatibility with RSpec 1
authored
97 begin
98 # RSpec 1
99 require "spec/rake/spectask"
100 spec_class = Spec::Rake::SpecTask
101 spec_files_meth = :spec_files=
6a458c8 @jeremyevans Fix deprecation warning when using SEQUEL_SPEC_OPTS environment varia…
authored
102 spec_opts_meth = :spec_opts=
c5b45d7 @jeremyevans Support RSpec 2, keeping backwards compatibility with RSpec 1
authored
103 rescue LoadError
104 # RSpec 2
105 require "rspec/core/rake_task"
106 spec_class = RSpec::Core::RakeTask
107 spec_files_meth = :pattern=
6a458c8 @jeremyevans Fix deprecation warning when using SEQUEL_SPEC_OPTS environment varia…
authored
108 spec_opts_meth = :rspec_opts=
c5b45d7 @jeremyevans Support RSpec 2, keeping backwards compatibility with RSpec 1
authored
109 end
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
110
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
111 spec = lambda do |name, files, d|
112 lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
113 ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
114 desc d
c5b45d7 @jeremyevans Support RSpec 2, keeping backwards compatibility with RSpec 1
authored
115 spec_class.new(name) do |t|
116 t.send spec_files_meth, files
6a458c8 @jeremyevans Fix deprecation warning when using SEQUEL_SPEC_OPTS environment varia…
authored
117 t.send spec_opts_meth, ENV['SEQUEL_SPEC_OPTS'].split if ENV['SEQUEL_SPEC_OPTS']
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
118 end
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
119 end
0eba5fe @jeremyevans Add integration test suite, testing sequel against a real database, w…
authored
120
68fbb89 @jeremyevans Remove ruby <1.8.7 support
authored
121 spec_with_cov = lambda do |name, files, d, &b|
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
122 spec.call(name, files, d)
123 t = spec.call("#{name}_cov", files, "#{d} with coverage")
124 t.rcov = true
125 t.rcov_opts = File.read("spec/rcov.opts").split("\n")
68fbb89 @jeremyevans Remove ruby <1.8.7 support
authored
126 b.call(t) if b
7f4b319 @jeremyevans Exclude adapter files (except mock adapter) from coverage in spec_cov…
authored
127 t
128 end
129
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
130 task :default => [:spec]
7f4b319 @jeremyevans Exclude adapter files (except mock adapter) from coverage in spec_cov…
authored
131 spec_with_cov.call("spec", Dir["spec/{core,model}/*_spec.rb"], "Run core and model specs"){|t| t.rcov_opts.concat(%w'--exclude "lib/sequel/adapters/([a-ln-z]|m[a-np-z])"')}
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
132 spec.call("spec_core", Dir["spec/core/*_spec.rb"], "Run core specs")
133 spec.call("spec_model", Dir["spec/model/*_spec.rb"], "Run model specs")
2d542f9 @jeremyevans Add spec_model_no_assoc tasks for running model specs without the ass…
authored
134 spec.call("_spec_model_no_assoc", Dir["spec/model/*_spec.rb"].delete_if{|f| f =~ /association|eager_loading/}, '')
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
135 spec_with_cov.call("spec_plugin", Dir["spec/extensions/*_spec.rb"], "Run extension/plugin specs")
136 spec_with_cov.call("spec_integration", Dir["spec/integration/*_test.rb"], "Run integration tests")
d064c98 @jeremyevans Add integration_cov and spec_adapter_cov rake tasks for testing cover…
authored
137
21ae66f @jeremyevans Significant changes to get the ibmdb adapter passing the test suite
authored
138 %w'postgres sqlite mysql informix oracle firebird mssql db2'.each do |adapter|
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
139 spec_with_cov.call("spec_#{adapter}", ["spec/adapters/#{adapter}_spec.rb"] + Dir["spec/integration/*_test.rb"], "Run #{adapter} specs")
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
140 end
2d542f9 @jeremyevans Add spec_model_no_assoc tasks for running model specs without the ass…
authored
141
142 desc "Run model specs without the associations code"
143 task :spec_model_no_assoc do
144 ENV['SEQUEL_NO_ASSOCIATIONS'] = '1'
145 Rake::Task['_spec_model_no_assoc'].invoke
146 end
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
147 rescue LoadError
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
148 task :default do
149 puts "Must install rspec to run the default task (which runs specs)"
150 end
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
151 end
152
153 desc "check documentation coverage"
154 task :dcov do
155 sh %{find lib -name '*.rb' | xargs dcov}
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
156 end
157
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
158 ### Statistics
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
159
160 desc "Report code statistics (KLOCs, etc) from the application"
161 task :stats do
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
162 STATS_DIRECTORIES = [%w(Code lib/), %w(Spec spec)].map{|name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir)}
c988cc8 @jeremyevans (Re)?move some files and fix RDoc clean tasks
authored
163 require "extra/stats"
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
164 verbose = true
165 CodeStatistics.new(*STATS_DIRECTORIES).to_s
166 end
167
f3fa745 @jeremyevans Add Sequel.version for getting the internal version of Sequel
authored
168 desc "Print Sequel version"
169 task :version do
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
170 puts VERS.call
f3fa745 @jeremyevans Add Sequel.version for getting the internal version of Sequel
authored
171 end
5fa47bd @jeremyevans Add check_syntax rake task for checking the syntax of .rb files
authored
172
173 desc "Check syntax of all .rb files"
174 task :check_syntax do
fe3705b @jeremyevans Use FileUtils::RUBY instead of RUBY in the Rakefile, to work with rak…
authored
175 Dir['**/*.rb'].each{|file| print `#{FileUtils::RUBY} -c #{file} | fgrep -v "Syntax OK"`}
5fa47bd @jeremyevans Add check_syntax rake task for checking the syntax of .rb files
authored
176 end
Something went wrong with that request. Please try again.