Don't know how to rake Rakefile

Discussion in 'Ruby' started by T. Onoma, Aug 23, 2004.

  1. T. Onoma

    T. Onoma Guest

    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 = ""
    #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.
     
    T. Onoma, Aug 23, 2004
    #1
    1. Advertising

  2. 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
     
    Mauricio Fernández, Aug 23, 2004
    #2
    1. Advertising

  3. T. Onoma

    Jim Weirich Guest

    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://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)
     
    Jim Weirich, Aug 23, 2004
    #3
  4. T. Onoma

    Jim Weirich Guest

    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 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)
     
    Jim Weirich, Aug 23, 2004
    #4
  5. T. Onoma

    T. Onoma Guest

    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.
     
    T. Onoma, Aug 23, 2004
    #5
  6. T. Onoma

    Jim Weirich Guest

    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 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)
     
    Jim Weirich, Aug 23, 2004
    #6
  7. T. Onoma

    T. Onoma Guest

    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.
     
    T. Onoma, Aug 23, 2004
    #7
  8. 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
     
    Gavin Sinclair, Aug 23, 2004
    #8
  9. T. Onoma

    James Britt Guest

    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
     
    James Britt, Aug 23, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DP
    Replies:
    0
    Views:
    1,156
  2. mikshir
    Replies:
    0
    Views:
    128
    mikshir
    Sep 8, 2006
  3. John Gabriele
    Replies:
    1
    Views:
    174
    Suraj Kurapati
    Dec 5, 2006
  4. peppermonkey
    Replies:
    1
    Views:
    251
    Gregory Brown
    Feb 10, 2007
  5. Peter Pk

    rakefile "$0" path in rake

    Peter Pk, Jan 13, 2009, in forum: Ruby
    Replies:
    3
    Views:
    120
    Peter Pk
    Jan 13, 2009
Loading...

Share This Page