Don't know how to rake Rakefile

T

T. Onoma

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 = "(e-mail address removed)"
#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
 
M

Mauricio Fernández

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 [...]
rake aborted!
Don't know how to rake Rakefile

Try to rename it to Rakefile or run rake -f rakefile.
 
J

Jim Weirich

T. Onoma said:
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

Rake is reporting that a something has a dependency on a file named
"Rakefile" and rake doesn't know how to build it.

Use "rake -P" to find all the dependencies (prerequisites) for all the
tasks. We see that "rdoc" needs a file named "doc/index.html", which in
turn depends upon a bunch of files. One of the those files is
"Rakefile". But if you copied David's setup, he tends to name his file
"rakefile" (different case).

On OSX (and windows) case doesn't matter. But on Linux it does.
Evidently the rdoc task is adding an implicit dependency on the Rakefile
so that changes in the rake file will regenerate the doc files (e.g. if
you change an RDoc option in the rake file). This is actually a bug in
the rdoc task, it should use the actually name of the rakefile rather
than assuming it is always "Rakefile". I'll fix this in the next release.

In the meantime, change the name of your rake file to "Rakefile" and it
should be OK.
 
J

Jim Weirich

Mauricio said:
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
[...]

rake aborted!
Don't know how to rake Rakefile


Try to rename it to Rakefile or run rake -f rakefile.

In general, rake doesn't care if the rake file is "Rakefile" or
"rakefile". This particular problem is in the rdoc task which make an
unwarrented assumption about the name of the rake file.
 
T

T. Onoma

In the meantime, change the name of your rake file to "Rakefile" and it
should be OK.

Thanks all! Works! Well...works better...

BTW: What is the "--accessor cattr_accessor=object" in rdoc.options?

Also, is there not a rdoc gem?

Thanks,
T.
 
J

Jim Weirich

T. Onoma said:
BTW: What is the "--accessor cattr_accessor=object" in rdoc.options?

$ rdoc --help

RDoc V1.0pr1: 2004/04/04 23:19:58 (1.1.2.6)

Usage:

rdoc [options] [names...]
[...]
Options:

--accessor, -A accessorname[,..]
comma separated list of additional class methods
that should be treated like 'attr_reader' and
friends. Option may be repeated. Each accessorname
may have '=text' appended, in which case that text
appears where the r/w/rw appears for normal accessors.
[...]
Also, is there not a rdoc gem?

RDoc comes standard with Ruby, so there's little need for a gem.
 
T

T. Onoma

--accessor, -A accessorname[,..]
comma separated list of additional class methods
that should be treated like 'attr_reader' and
friends. Option may be repeated. Each accessorname
may have '=text' appended, in which case that text
appears where the r/w/rw appears for normal accessors.
[...]

Oh, I see. Glad I ran across that. That's actually useful for my library!
(Guess I could have looked that up myself. Sorry.)
RDoc comes standard with Ruby, so there's little need for a gem.

Doh! Yes, that's right. I get confused b/c I'm using debian and in debian
everything is split up into separate libs. So very little comes "standard"
from that perspective.

Thanks for going out the way to answer silly questions,
T.
 
J

James Britt

Jim said:
T. Onoma said:
BTW: What is the "--accessor cattr_accessor=object" in rdoc.options?


$ rdoc --help

RDoc V1.0pr1: 2004/04/04 23:19:58 (1.1.2.6)

Usage:

rdoc [options] [names...]
[...]
Options:

--accessor, -A accessorname[,..]
comma separated list of additional class methods
that should be treated like 'attr_reader' and
friends. Option may be repeated. Each accessorname
may have '=text' appended, in which case that text
appears where the r/w/rw appears for normal accessors.
[...]

Interesting. Is there the inverse? I.e. a way to tell rdoc to document
methods created using attr_* as methods, rather than treating them as
public properties?




James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top