Skip to content

HTTPS clone URL

Subversion checkout URL

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