Browse files

Cleanup Rakefile and use new rdoc format for website

The website now will have 3 separate rdoc sections, one for
core/model, one for adapters, and one for extensions/plugins.
I think this will make the RDoc less cluttered and more approachable.

The Rakefile website and website_rdoc tasks are now able to generate
a fully functional local version of the site.  In order for this to
work, I changed all of the internal website links to relative links
instead of the absolute links used previously.

You can now use the Rakefile without rspec installed, though obviously
you can't use the spec tasks.  I refactored the Rakefile to use
lambdas to reduce the amount of work done just by parsing the
Rakefile, by only running code inside the tasks that need it.

I removed the install_no_docs task.  If anyone really wants it I can
add it back.

I made the .gitignore patterns absolute.  I don't think this will
cause any problems, and with normal usage of the sequel repository,
there should be no effect.

This commit changes the website task to only generate the base
website, and adds a website_rdoc task to generate the 3 rdoc
pages.  You now need to use the website_rf task to update the site.  As I'm the only person that does
that, I don't expect any complaints.  I'm also switching the
website upload to use rsync instead of scp, to improve the speed.
  • Loading branch information...
1 parent d2f3b9b commit c879600684489e56ae8b37240cb21ad9d063e20e @jeremyevans committed Apr 2, 2009
Showing with 139 additions and 121 deletions.
  1. +6 −5 .gitignore
  2. +98 −86 Rakefile
  3. +7 −7 www/layout.html.erb
  4. +1 −1 www/pages/development
  5. +25 −20 www/pages/documentation
  6. +1 −1 www/pages/index
  7. +1 −1 www/pages/plugins
@@ -1,5 +1,6 @@
184 Rakefile
@@ -1,59 +1,53 @@
require "rake"
require "rake/clean"
require "rake/gempackagetask"
-require "spec/rake/spectask"
require "hanna/rdoctask"
rescue LoadError
require "rake/rdoctask"
-require "fileutils"
-require "lib/sequel/version"
-include FileUtils
NAME = 'sequel'
-VERS = Sequel.version
-CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage", "www/public/*.html"]
-RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
- 'Sequel: The Database Toolkit for Ruby', '--main', 'README.rdoc']
+VERS = lambda do
+ require "lib/sequel/version"
+ Sequel.version
+CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc*"]
+RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Sequel: The Database Toolkit for Ruby']
+RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
# Gem Packaging and Release
-desc "Packages sequel"
-task :package=>[:clean]
spec = do |s| = NAME
s.rubyforge_project = 'sequel'
- s.version = VERS
+ s.version =
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG", "COPYING"] + Dir["doc/*.rdoc"] + Dir['doc/release_notes/*.txt']
- s.rdoc_options += RDOC_OPTS
+ s.rdoc_options += RDOC_OPTS
s.summary = "The Database Toolkit for Ruby"
s.description = s.summary = "Jeremy Evans" = ""
s.homepage = ""
s.required_ruby_version = ">= 1.8.4"
- s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
+ s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) + Dir["{bin,doc,spec,lib}/**/*"]
s.require_path = "lib"
s.bindir = 'bin'
s.executables << 'sequel'
+desc "Packages sequel"
+task :package=>[:clean] do |p|
p.need_tar = true
p.gem_spec = spec
desc "Install sequel gem"
task :install=>[:package] do
- sh %{sudo gem install pkg/#{NAME}-#{VERS} --local}
-desc "Install sequel gem without RDoc"
-task :install_no_docs=>[:package] do
- sh %{sudo gem install pkg/#{NAME}-#{VERS} --no-rdoc --no-ri --local}
+ sh %{sudo gem install pkg/#{NAME}-#{} --local}
desc "Uninstall sequel gem"
@@ -64,8 +58,8 @@ end
desc "Upload sequel gem to rubyforge"
task :release=>[:package] do
sh %{rubyforge login}
- sh %{rubyforge add_release sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.tgz}
- sh %{rubyforge add_file sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.gem}
+ sh %{rubyforge add_release sequel #{NAME} #{} pkg/#{NAME}-#{}.tgz}
+ sh %{rubyforge add_file sequel #{NAME} #{} pkg/#{NAME}-#{}.gem}
### RDoc
@@ -78,81 +72,103 @@ end
### Website
-desc "Update Non-RDoc section of"
-task :website_base do
+desc "Make local version of website"
+task :website do
sh %{www/make_www.rb}
- sh %{scp -r www/public/*}
-desc "Update RDoc section of"
-task :website_rdoc=>[:rerdoc] do
- sh %{scp -r rdoc/*}
-desc "Update"
-task :website=>[:website_base, :website_rdoc]
-### Specs
+desc "Make rdoc for website"
+task :website_rdoc=>[:website_rdoc_main, :website_rdoc_adapters, :website_rdoc_plugins]
-lib_dir = File.join(File.dirname(__FILE__), 'lib')
-fixRUBYLIB ={ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)}
-sequel_core_specs = "spec/core/*_spec.rb"
-sequel_model_specs = "spec/model/*_spec.rb"
-sequel_plugin_specs = "spec/extensions/*_spec.rb"
-spec_opts = proc{"spec/spec.opts").split("\n")}
-rcov_opts = proc{"spec/rcov.opts").split("\n")}
-desc "Run core and model specs with coverage""spec_coverage") do |t|
- t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
- t.spec_opts =
- t.rcov_opts =
- t.rcov = true do |rdoc|
+ rdoc.rdoc_dir = "www/public/rdoc"
+ rdoc.options += RDOC_OPTS
+ rdoc.rdoc_files.add %w"README.rdoc CHANGELOG COPYING lib/*.rb lib/sequel/*.rb lib/sequel/{dataset,database,model}/*.rb doc/*.rdoc doc/release_notes/*.txt"
-desc "Run core and model specs"
-task :default => [:spec]"spec") do |t|
- t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
- t.spec_opts = do |rdoc|
+ rdoc.rdoc_dir = "www/public/rdoc-adapters"
+ rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
+ rdoc.rdoc_files.add %w"lib/sequel/adapters/**/*.rb"
-desc "Run core specs""spec_core") do |t|
- t.spec_files = FileList[sequel_core_specs]
- t.spec_opts = do |rdoc|
+ rdoc.rdoc_dir = "www/public/rdoc-plugins"
+ rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
+ rdoc.rdoc_files.add %w"lib/sequel/{extensions,plugins}/**/*.rb"
-desc "Run model specs""spec_model") do |t|
- t.spec_files = FileList[sequel_model_specs]
- t.spec_opts =
+desc "Update Non-RDoc section of"
+task :website_rf_base=>[:website] do
+ sh %{rsync -rt www/public/*.html}
-desc "Run extension/plugin specs""spec_plugin") do |t|
- t.spec_files = FileList[sequel_plugin_specs]
- t.spec_opts =
+desc "Update"
+task :website_rf=>[:website, :website_rdoc] do
+ sh %{rsync -rvt www/public/*}
-desc "Run integration tests""integration") do |t|
- t.spec_files = FileList["spec/integration/*_test.rb"]
- t.spec_opts =
+### Specs
+ require "spec/rake/spectask"
+ spec_opts = lambda do
+ lib_dir = File.join(File.dirname(__FILE__), 'lib')
+ ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)
+ end
-%w'postgres sqlite mysql informix oracle ado'.each do |adapter|
- desc "Run #{adapter} specs without coverage"
-"spec_#{adapter}") do |t|
- t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
+ rcov_opts = lambda do
+ [true,"spec/rcov.opts").split("\n")]
+ end
+ desc "Run core and model specs with coverage"
+"spec_coverage") do |t|
+ t.spec_files = Dir["spec/{core,model}/*_spec.rb"]
+ t.spec_opts =
+ t.rcov, t.rcov_opts =
+ end
+ desc "Run core and model specs"
+ task :default => [:spec]
+"spec") do |t|
+ t.spec_files = Dir["spec/{core,model}/*_spec.rb"]
+ t.spec_opts =
+ end
+ desc "Run core specs"
+"spec_core") do |t|
+ t.spec_files = Dir["spec/core/*_spec.rb"]
t.spec_opts =
+ desc "Run model specs"
+"spec_model") do |t|
+ t.spec_files = Dir["spec/model/*_spec.rb"]
+ t.spec_opts =
+ end
+ desc "Run extension/plugin specs"
+"spec_plugin") do |t|
+ t.spec_files = Dir["spec/extensions/*_spec.rb"]
+ t.spec_opts =
+ end
+ desc "Run integration tests"
+"integration") do |t|
+ t.spec_files = FileList["spec/integration/*_test.rb"]
+ t.spec_opts =
+ end
+ %w'postgres sqlite mysql informix oracle ado'.each do |adapter|
+ desc "Run #{adapter} specs without coverage"
+"spec_#{adapter}") do |t|
+ t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
+ t.spec_opts =
+ end
+ end
+rescue LoadError
desc "check documentation coverage"
@@ -162,19 +178,15 @@ end
### Statistics
- %w(Code lib/),
- %w(Spec spec),
-].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| }
desc "Report code statistics (KLOCs, etc) from the application"
task :stats do
+ STATS_DIRECTORIES = [%w(Code lib/), %w(Spec spec)].map{|name, dir| [ name, "./#{dir}" ] }.select { |name, dir|}
require "extra/stats"
verbose = true*STATS_DIRECTORIES).to_s
desc "Print Sequel version"
task :version do
- puts VERS
+ puts
@@ -13,19 +13,19 @@
<meta name="keywords" content="ruby, sequel, sql, toolkit, orm, plugins, activerecord, documentation, howto, news" />
<meta name="description" content="Ruby Sequel is a lightweight database toolkit for Ruby." />
- <link href="/css/application.css" media="screen" rel="stylesheet" type="text/css" />
- <link href="/css/ruby.css" media="screen" rel="stylesheet" type="text/css" />
+ <link href="css/application.css" media="screen" rel="stylesheet" type="text/css" />
+ <link href="css/ruby.css" media="screen" rel="stylesheet" type="text/css" />
<div id="header">
- <a href="/" id="logo"><img src="/images/ruby-sequel.png" alt="Ruby Sequel Logo" /></a>
+ <a href="index.html" id="logo"><img src="images/ruby-sequel.png" alt="Ruby Sequel Logo" /></a>
<h1>The Database Toolkit for Ruby</h1>
<div id="navigation">
- <li><a href="/development.html">Development</a></li>
- <li><a href="/documentation.html">Documentation</a></li>
- <li><a href="/plugins.html">Plugins</a></li>
- <li><a href="/press.html">Press</a></li>
+ <li><a href="development.html">Development</a></li>
+ <li><a href="documentation.html">Documentation</a></li>
+ <li><a href="plugins.html">Plugins</a></li>
+ <li><a href="press.html">Press</a></li>
<br style="clear: both;" />
@@ -16,4 +16,4 @@
-<p>Sequel is distributed under the <a href="/rdoc/files/COPYING.html">MIT License</a>. Patches are assumed to be submitted under the same license as Sequel.</p>
+<p>Sequel is distributed under the <a href="rdoc/files/COPYING.html">MIT License</a>. Patches are assumed to be submitted under the same license as Sequel.</p>
@@ -3,37 +3,42 @@
<h3>General Info, Guides, Examples, and Tutorials</h3>
-<li><a href="/rdoc/files/README_rdoc.html">README</a></li>
-<li><a href="/rdoc/files/doc/cheat_sheet_rdoc.html">Cheat Sheet</a></li>
-<li><a href="/rdoc/files/doc/dataset_filtering_rdoc.html">Dataset Filtering</a></li>
-<li><a href="/rdoc/files/doc/advanced_associations_rdoc.html">Advanced Associations</a></li>
-<li><a href="/rdoc/files/doc/prepared_statements_rdoc.html">Prepared Statements/Bound Variables</a></li>
-<li><a href="/rdoc/files/doc/sharding_rdoc.html">Master/Slave Databases and Sharding</a></li>
-<li><a href="/rdoc/files/doc/schema_rdoc.html">Schema Modification</a></li>
-<li><a href="/rdoc/files/doc/virtual_rows_rdoc.html">Virtual Row Blocks</a></li>
+ <li><a href="rdoc/files/README_rdoc.html">README</a></li>
+ <li><a href="rdoc/files/doc/cheat_sheet_rdoc.html">Cheat Sheet</a></li>
+ <li><a href="rdoc/files/doc/dataset_filtering_rdoc.html">Dataset Filtering</a></li>
+ <li><a href="rdoc/files/doc/advanced_associations_rdoc.html">Advanced Associations</a></li>
+ <li><a href="rdoc/files/doc/prepared_statements_rdoc.html">Prepared Statements/Bound Variables</a></li>
+ <li><a href="rdoc/files/doc/sharding_rdoc.html">Master/Slave Databases and Sharding</a></li>
+ <li><a href="rdoc/files/doc/schema_rdoc.html">Schema Modification</a></li>
+ <li><a href="rdoc/files/doc/virtual_rows_rdoc.html">Virtual Row Blocks</a></li>
-<h3><a href="/rdoc/">Full API RDoc</a>, Main Classes/Modules:</h3>
-<li><a href="/rdoc/classes/Sequel.html">Sequel</a></li>
-<li><a href="/rdoc/classes/Sequel/Database.html">Database</a></li>
-<li><a href="/rdoc/classes/Sequel/Dataset.html">Dataset</a></li>
-<li><a href="/rdoc/classes/Sequel/Model/ClassMethods.html">Model Class Methods</a></li>
-<li><a href="/rdoc/classes/Sequel/Model/InstanceMethods.html">Model Instance Methods</a></li>
-<li><a href="/rdoc/classes/Sequel/Model/Associations/ClassMethods.html">Model Association Class Methods</a></li>
-<li><a href="/rdoc/classes/Sequel/Model/Associations/DatasetMethods.html">Model Association Eager Loading Methods</a></li>
+ <li><a href="rdoc/index.html">Core/Model</a>, main pages:<ul>
+ <li><a href="rdoc/classes/Sequel.html">Sequel</a> (main module)</li>
+ <li><a href="rdoc/classes/Sequel/Database.html">Database</a></li>
+ <li><a href="rdoc/classes/Sequel/Dataset.html">Dataset</a></li>
+ <li><a href="rdoc/classes/Sequel/Model.html">Model</a></li>
+ <li><a href="rdoc/classes/Sequel/Model/ClassMethods.html">Model Class Methods</a></li>
+ <li><a href="rdoc/classes/Sequel/Model/InstanceMethods.html">Model Instance Methods</a></li>
+ <li><a href="rdoc/classes/Sequel/Model/Associations/ClassMethods.html">Model Association Class Methods</a></li>
+ <li><a href="rdoc/classes/Sequel/Model/Associations/DatasetMethods.html">Model Eager Loading Methods</a></li>
+ <li><a href="rdoc-adapters/index.html">Adapters</a></li>
+ <li><a href="rdoc-plugins/index.html">Extensions/Plugins</a></li>
-<h3><a href="/rdoc/files/CHANGELOG.html">Change Log</a></h3>
+<h3><a href="rdoc/files/CHANGELOG.html">Change Log</a></h3>
-<h3><a href="/rdoc/files/doc/release_notes/">Release Notes</a></h3>
+<h3><a href="rdoc/files/doc/release_notes/">Release Notes</a></h3>
-<h3><a href="/rdoc/files/COPYING.html">License</a></h3>
+<h3><a href="rdoc/files/COPYING.html">License</a></h3>
-<li><a href="/static/mwrc2009_presentation.html">Jeremy Evans's &quot;Sequel: The Database Toolkit for Ruby&quot; Presentation at MountainWest RubyConf 2009</a> (<a href="">Video</a>) (<a href="/static/mwrc2009_presentation.txt">Transcript</a>)</li>
+<li><a href="static/mwrc2009_presentation.html">Jeremy Evans's &quot;Sequel: The Database Toolkit for Ruby&quot; Presentation at MountainWest RubyConf 2009</a> (<a href="">Video</a>) (<a href="static/mwrc2009_presentation.txt">Transcript</a>)</li>
<li><a href="">Lori Holden's &quot;Merb And Sequel&quot; Presentation at Merbcamp 2008</a></li>
@@ -34,4 +34,4 @@
<span class='comment'># print out the average price</span>
<span class='ident'>puts</span> <span class='punct'>&quot;</span><span class='string'>The average price is: <span class='expr'>#{items.avg(:price)}</span></span><span class='punct'>&quot;</span></code></pre>
-<h2><a href='/documentation.html'>Learn more about Sequel&#8230;</a></h2>
+<h2><a href='documentation.html'>Learn more about Sequel&#8230;</a></h2>
@@ -1,6 +1,6 @@
<h2>Sequel::Model Plugins</h2>
-<p>Sequel::Model has a very flexible and standardized plugin architecture, see the <a href="/rdoc/classes/Sequel/Plugins.html">RDoc</a>. Here is a list of plugins that members of the Sequel community have developed:</p>
+<p>Sequel::Model has a very flexible and standardized plugin architecture, see the <a href="rdoc/classes/Sequel/Plugins.html">RDoc</a>. Here is a list of plugins that members of the Sequel community have developed:</p>
<li><a href=''>sequel_cascading</a>: Destroy associated records, nullify foreign keys or raise an exception when destroying a record.</li>

0 comments on commit c879600

Please sign in to comment.