Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Don't know how to rake Rakefile

Reply
Thread Tools

Don't know how to rake Rakefile

 
 
T. Onoma
Guest
Posts: n/a
 
      08-23-2004
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 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


--
T.


 
Reply With Quote
 
 
 
 
Mauricio Fernández
Guest
Posts: n/a
 
      08-23-2004
On Mon, Aug 23, 2004 at 04:40:19PM +0900, T. Onoma wrote:
> 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.

--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com



 
Reply With Quote
 
 
 
 
Jim Weirich
Guest
Posts: n/a
 
      08-23-2004
T. Onoma wrote:
> 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.

--
-- Jim Weirich http://www.velocityreviews.com/forums/(E-Mail Removed) http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


 
Reply With Quote
 
Jim Weirich
Guest
Posts: n/a
 
      08-23-2004
Mauricio Fernández wrote:
> On Mon, Aug 23, 2004 at 04:40:19PM +0900, T. Onoma wrote:
>
>>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.

--
-- Jim Weirich (E-Mail Removed) http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


 
Reply With Quote
 
T. Onoma
Guest
Posts: n/a
 
      08-23-2004
On Monday 23 August 2004 07:54 am, Jim Weirich wrote:

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


 
Reply With Quote
 
Jim Weirich
Guest
Posts: n/a
 
      08-23-2004

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.

--
-- Jim Weirich (E-Mail Removed) http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



 
Reply With Quote
 
T. Onoma
Guest
Posts: n/a
 
      08-23-2004
On Monday 23 August 2004 10:16 am, Jim Weirich wrote:
> --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.)

> > Also, is there not a rdoc gem?

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


 
Reply With Quote
 
Gavin Sinclair
Guest
Posts: n/a
 
      08-23-2004
On Monday, August 23, 2004, 11:56:07 PM, T. wrote:

> On Monday 23 August 2004 07:54 am, Jim Weirich wrote:


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


See rdoc --help

> Also, is there not a rdoc gem?


RDoc is part of the Ruby distribution, from 1.8 onwards, faulty Debian
packages notwithstanding.

Gavin




 
Reply With Quote
 
James Britt
Guest
Posts: n/a
 
      08-23-2004
Jim Weirich wrote:
> 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







 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
rakefile "$0" path in rake Peter Pk Ruby 3 01-13-2009 03:36 PM
Rake and rake aborted! Rake aborted! undefined method `gem' for main:Object peppermonkey Ruby 1 02-10-2007 04:43 AM
rakefile help: rakefile calling a rakefile? John Gabriele Ruby 1 12-05-2006 08:04 PM
Rake: Looking for shortcut to file targets list from within a rakefile mikshir Ruby 0 09-08-2006 04:58 PM



Advertisments