I can't seem to get rake to generate rdocs (for starters). I'm using version
0.4.4 and I started with a template rakefile based on Active Record --it
looks pretty standard. One thing I noticed is "--accessor
cattr_accessor=object". What's that all about? The error I get is:
rake aborted!
Don't know how to rake Rakefile
Well here's my rake file just in case. Thanks!
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
PKG_VERSION = "0.0.1"
PKG_FILES = FileList[
"lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "[A-Z]*",
"install.rb", "rakefile"
].exclude(/\bCVS\b|~$/)
# defaults to running tests
desc "Default Task"
task :default =>
[ :test_attr, :test_contracts, :test_vars, :test_type, :test_duckhunter ]
# Run the unit tests
Rake::TestTask.new("test_attr") { |t|
t.libs << "test"
t.pattern = 'test/attr_test.rb'
t.verbose = true
}
Rake::TestTask.new("test_contracts") { |t|
t.libs << "test"
t.pattern = 'test/contracts_test.rb'
t.verbose = true
}
Rake::TestTask.new("test_vars") { |t|
t.libs << "test"
t.pattern = 'test/vars_test.rb'
t.verbose = true
}
Rake::TestTask.new("test_type") { |t|
t.libs << "test"
t.pattern = 'test/type_test.rb'
t.verbose = true
}
Rake::TestTask.new("test_duckhunter") { |t|
t.libs << "test"
t.pattern = 'test/duckhunter_test.rb'
t.verbose = true
}
# Genereate the RDoc Documentation
Rake::RDocTask.new { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.template = 'css2'
rdoc.title = "Duckbill - Libraries a la AFLAC"
rdoc.options << '--line-numbers --inline-source --accessor
cattr_accessor=object' # *** Huh? ***
rdoc.rdoc_files.include('README', 'CHANGELOG', 'TODO', 'LICENSE')
rdoc.rdoc_files.include('lib/**/*.rb')
#rdoc.rdoc_files.exclude('lib/active_dba/vendor/*')
#rdoc.rdoc_files.include('dev-utils/*.rb')
}
# Create Compressed Packages
dist_dirs = [ "lib", "test", "examples" ]
spec = Gem::Specification.new do |s|
s.name = 'duckbill'
s.version = PKG_VERSION
s.summary = "Ducktype-based insurances libraries."
s.description = %q{Duckbill provides ducktype-based insurances libraries,
including a Euphoria-like type system, interface contracts, cast attributes,
a method probe and more. With these tools you too can create "duck-billable"
goods! Oh, this is fun!}
s.files = [ "rakefile", "install.rb", "README", "TODO", "CHANGELOG",
"VERSION", "LICENSE" ]
dist_dirs.each do |dir|
s.files.concat Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?
( "CVS" ) }
end
#s.files.delete "test/fixtures/fixture_database.sqlite"
s.require_path = 'lib'
s.autorequire = 'bill'
s.has_rdoc = true
s.author = "Thomas Sawyer"
s.email = "transami@runbox.com"
#s.homepage = "http://duckbill.rubyforge.org"
#s.rubyforge_project = "duckbill"
end
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end
task :lines do
lines = 0
codelines = 0
Dir.foreach("lib/bill") { |file_name|
next unless file_name =~ /.*rb/
f = File.open("lib/bill/" + file_name)
while line = f.gets
lines += 1
next if line =~ /^\s*$/
next if line =~ /^\s*#/
codelines += 1
end
}
puts "Lines #{lines}, LOC #{codelines}"
end
···
--
T.