Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 149 lines (121 sloc) 4.626 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
15705ff @jeremyevans Move gem specification out of Rakefile (Fixes #285)
authored
15 CLEAN.include ["**/.*.sw?", "sequel-*.gem", ".config", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc*"]
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
4749f02 @jeremyevans Add release notes to repository, include in RDoc
authored
46 rdoc.rdoc_files.add %w"README.rdoc CHANGELOG COPYING 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
e990284 @jeremyevans Replace the Schema Modification guide with a much more detailed Migra…
authored
62 rdoc.rdoc_files.add %w"README.rdoc CHANGELOG COPYING 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
90 require "spec/rake/spectask"
91
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
92 spec = lambda do |name, files, d|
93 lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
94 ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
95 desc d
96 Spec::Rake::SpecTask.new(name) do |t|
97 t.spec_files = files
98 t.spec_opts = ENV['SEQUEL_SPEC_OPTS'].split if ENV['SEQUEL_SPEC_OPTS']
99 end
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
100 end
0eba5fe @jeremyevans Add integration test suite, testing sequel against a real database, w…
authored
101
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
102 spec_with_cov = lambda do |name, files, d|
103 spec.call(name, files, d)
104 t = spec.call("#{name}_cov", files, "#{d} with coverage")
105 t.rcov = true
106 t.rcov_opts = File.read("spec/rcov.opts").split("\n")
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
107 end
108
109 task :default => [:spec]
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
110 spec_with_cov.call("spec", Dir["spec/{core,model}/*_spec.rb"], "Run core and model specs")
111 spec.call("spec_core", Dir["spec/core/*_spec.rb"], "Run core specs")
112 spec.call("spec_model", Dir["spec/model/*_spec.rb"], "Run model specs")
113 spec_with_cov.call("spec_plugin", Dir["spec/extensions/*_spec.rb"], "Run extension/plugin specs")
114 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
115
5c597d2 Add an empty spec file for MSSQL.
John Firebaugh authored
116 %w'postgres sqlite mysql informix oracle firebird mssql'.each do |adapter|
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
117 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
118 end
119 rescue LoadError
97fa216 @jeremyevans Refactor spec tasks in Rakefile
authored
120 task :default do
121 puts "Must install rspec to run the default task (which runs specs)"
122 end
778a032 @jeremyevans Combine sequel and sequel_core into one gem
authored
123 end
124
125 desc "check documentation coverage"
126 task :dcov do
127 sh %{find lib -name '*.rb' | xargs dcov}
d768d94 @ciconia Added doc rake task for core+model. Some order in rake files.
ciconia authored
128 end
129
189fe30 @jeremyevans Use boof's website design for sequel.rubyforge.org
authored
130 ### Statistics
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
131
132 desc "Report code statistics (KLOCs, etc) from the application"
133 task :stats do
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
134 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
135 require "extra/stats"
cc7ecf4 @ciconia Some more rake tasks work, and sequel_model version 0.2.
ciconia authored
136 verbose = true
137 CodeStatistics.new(*STATS_DIRECTORIES).to_s
138 end
139
f3fa745 @jeremyevans Add Sequel.version for getting the internal version of Sequel
authored
140 desc "Print Sequel version"
141 task :version do
c879600 @jeremyevans Cleanup Rakefile and use new rdoc format for website
authored
142 puts VERS.call
f3fa745 @jeremyevans Add Sequel.version for getting the internal version of Sequel
authored
143 end
5fa47bd @jeremyevans Add check_syntax rake task for checking the syntax of .rb files
authored
144
145 desc "Check syntax of all .rb files"
146 task :check_syntax do
147 Dir['**/*.rb'].each{|file| print `#{ENV['RUBY'] || :ruby} -c #{file} | fgrep -v "Syntax OK"`}
148 end
Something went wrong with that request. Please try again.