Skip to content

Commit

Permalink
Cleanup Rakefile and use new rdoc format for website
Browse files Browse the repository at this point in the history
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
sequel.rubyforge.org 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
jeremyevans committed Apr 2, 2009
1 parent d2f3b9b commit c879600
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 121 deletions.
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spec/spec_config.rb
rdoc
pkg
coverage
www/public/*.html
/spec/spec_config.rb
/rdoc
/pkg
/coverage
/www/public/*.html
/www/public/rdoc*
184 changes: 98 additions & 86 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
require "rake"
require "rake/clean"
require "rake/gempackagetask"
require "spec/rake/spectask"
begin
require "hanna/rdoctask"
rescue LoadError
require "rake/rdoctask"
end
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
end
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 = Gem::Specification.new do |s|
s.name = NAME
s.rubyforge_project = 'sequel'
s.version = VERS
s.version = VERS.call
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
s.author = "Jeremy Evans"
s.email = "code@jeremyevans.net"
s.homepage = "http://sequel.rubyforge.org"
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'
end

desc "Packages sequel"
task :package=>[:clean]
Rake::GemPackageTask.new(spec) do |p|
p.need_tar = true
p.gem_spec = spec
end

desc "Install sequel gem"
task :install=>[:package] do
sh %{sudo gem install pkg/#{NAME}-#{VERS} --local}
end

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}-#{VERS.call} --local}
end

desc "Uninstall sequel gem"
Expand All @@ -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} #{VERS.call} pkg/#{NAME}-#{VERS.call}.tgz}
sh %{rubyforge add_file sequel #{NAME} #{VERS.call} pkg/#{NAME}-#{VERS.call}.gem}
end

### RDoc
Expand All @@ -78,81 +72,103 @@ end

### Website

desc "Update Non-RDoc section of sequel.rubyforge.org"
task :website_base do
desc "Make local version of website"
task :website do
sh %{www/make_www.rb}
sh %{scp -r www/public/* rubyforge.org:/var/www/gforge-projects/sequel/}
end

desc "Update RDoc section of sequel.rubyforge.org"
task :website_rdoc=>[:rerdoc] do
sh %{scp -r rdoc/* rubyforge.org:/var/www/gforge-projects/sequel/rdoc/}
end

desc "Update sequel.rubyforge.org"
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 = Proc.new{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{File.read("spec/spec.opts").split("\n")}
rcov_opts = proc{File.read("spec/rcov.opts").split("\n")}

desc "Run core and model specs with coverage"
Spec::Rake::SpecTask.new("spec_coverage") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
t.spec_opts = spec_opts.call
t.rcov_opts = rcov_opts.call
t.rcov = true
Rake::RDocTask.new(:website_rdoc_main) 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"
end

desc "Run core and model specs"
task :default => [:spec]
Spec::Rake::SpecTask.new("spec") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
t.spec_opts = spec_opts.call
Rake::RDocTask.new(:website_rdoc_adapters) 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"
end

desc "Run core specs"
Spec::Rake::SpecTask.new("spec_core") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_core_specs]
t.spec_opts = spec_opts.call
Rake::RDocTask.new(:website_rdoc_plugins) 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"
end

desc "Run model specs"
Spec::Rake::SpecTask.new("spec_model") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_model_specs]
t.spec_opts = spec_opts.call
desc "Update Non-RDoc section of sequel.rubyforge.org"
task :website_rf_base=>[:website] do
sh %{rsync -rt www/public/*.html rubyforge.org:/var/www/gforge-projects/sequel/}
end

desc "Run extension/plugin specs"
Spec::Rake::SpecTask.new("spec_plugin") do |t|
fixRUBYLIB.call
t.spec_files = FileList[sequel_plugin_specs]
t.spec_opts = spec_opts.call
desc "Update sequel.rubyforge.org"
task :website_rf=>[:website, :website_rdoc] do
sh %{rsync -rvt www/public/* rubyforge.org:/var/www/gforge-projects/sequel/}
end

desc "Run integration tests"
Spec::Rake::SpecTask.new("integration") do |t|
fixRUBYLIB.call
t.spec_files = FileList["spec/integration/*_test.rb"]
t.spec_opts = spec_opts.call
end
### Specs

begin
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)
File.read("spec/spec.opts").split("\n")
end

%w'postgres sqlite mysql informix oracle ado'.each do |adapter|
desc "Run #{adapter} specs without coverage"
Spec::Rake::SpecTask.new("spec_#{adapter}") do |t|
t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
rcov_opts = lambda do
[true, File.read("spec/rcov.opts").split("\n")]
end

desc "Run core and model specs with coverage"
Spec::Rake::SpecTask.new("spec_coverage") do |t|
t.spec_files = Dir["spec/{core,model}/*_spec.rb"]
t.spec_opts = spec_opts.call
t.rcov, t.rcov_opts = rcov_opts.call
end

desc "Run core and model specs"
task :default => [:spec]
Spec::Rake::SpecTask.new("spec") do |t|
t.spec_files = Dir["spec/{core,model}/*_spec.rb"]
t.spec_opts = spec_opts.call
end

desc "Run core specs"
Spec::Rake::SpecTask.new("spec_core") do |t|
t.spec_files = Dir["spec/core/*_spec.rb"]
t.spec_opts = spec_opts.call
end

desc "Run model specs"
Spec::Rake::SpecTask.new("spec_model") do |t|
t.spec_files = Dir["spec/model/*_spec.rb"]
t.spec_opts = spec_opts.call
end

desc "Run extension/plugin specs"
Spec::Rake::SpecTask.new("spec_plugin") do |t|
t.spec_files = Dir["spec/extensions/*_spec.rb"]
t.spec_opts = spec_opts.call
end

desc "Run integration tests"
Spec::Rake::SpecTask.new("integration") do |t|
t.spec_files = FileList["spec/integration/*_test.rb"]
t.spec_opts = spec_opts.call
end

%w'postgres sqlite mysql informix oracle ado'.each do |adapter|
desc "Run #{adapter} specs without coverage"
Spec::Rake::SpecTask.new("spec_#{adapter}") do |t|
t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
t.spec_opts = spec_opts.call
end
end
rescue LoadError
end

desc "check documentation coverage"
Expand All @@ -162,19 +178,15 @@ end

### Statistics

STATS_DIRECTORIES = [
%w(Code lib/),
%w(Spec spec),
].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(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| File.directory?(dir)}
require "extra/stats"
verbose = true
CodeStatistics.new(*STATS_DIRECTORIES).to_s
end

desc "Print Sequel version"
task :version do
puts VERS
puts VERS.call
end
14 changes: 7 additions & 7 deletions www/layout.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
</head>
<body>
<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">
<ul>
<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>
</ul>
</div>
<br style="clear: both;" />
Expand Down
2 changes: 1 addition & 1 deletion www/pages/development
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

<h3>License</h3>

<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>
45 changes: 25 additions & 20 deletions www/pages/documentation
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,42 @@
<h3>General Info, Guides, Examples, and Tutorials</h3>

<ul>
<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>
</ul>

<h3><a href="/rdoc/">Full API RDoc</a>, Main Classes/Modules:</h3>
<h3>RDoc</h3>

<ul>
<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>
</ul></li>
<li><a href="rdoc-adapters/index.html">Adapters</a></li>
<li><a href="rdoc-plugins/index.html">Extensions/Plugins</a></li>
</ul>

<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>

<h3>Presentations</h3>

<ul>
<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="http://mwrc2009.confreaks.com/13-mar-2009-12-30-sequel-jeremy-evans.html">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="http://mwrc2009.confreaks.com/13-mar-2009-12-30-sequel-jeremy-evans.html">Video</a>) (<a href="static/mwrc2009_presentation.txt">Transcript</a>)</li>
<li><a href="http://assets.loriholden.com/presentations/merbcamp2008/">Lori Holden's &quot;Merb And Sequel&quot; Presentation at Merbcamp 2008</a></li>
</ul>
2 changes: 1 addition & 1 deletion www/pages/index
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion www/pages/plugins
Original file line number Diff line number Diff line change
@@ -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>

<ul>
<li><a href='http://github.com/sbfaulkner/sequel_cascading'>sequel_cascading</a>: Destroy associated records, nullify foreign keys or raise an exception when destroying a record.</li>
Expand Down

0 comments on commit c879600

Please sign in to comment.