Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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