Rake FileList not working?

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

  1. T. Onoma

    T. Onoma Guest

    In my Rakefile (given in earlier post):

    PKG_FILES = FileList[
    "lib/**/*",
    "test/**/*",
    "examples/**/*",
    "doc/**/*",
    "[A-Z]*",
    "install.rb",
    "Rakefile"
    ].exclude(/\bCVS\b|~$/)
    p PKG_FILES.class

    # => NilClass

    Huh?

    --
    T.
    T. Onoma, Aug 24, 2004
    #1
    1. Advertising

  2. T. Onoma

    Jim Weirich Guest

    T. Onoma wrote:
    > In my Rakefile (given in earlier post):
    >
    > PKG_FILES = FileList[
    > "lib/**/*",
    > "test/**/*",
    > "examples/**/*",
    > "doc/**/*",
    > "[A-Z]*",
    > "install.rb",
    > "Rakefile"
    > ].exclude(/\bCVS\b|~$/)
    > p PKG_FILES.class
    >
    > # => NilClass
    >
    > Huh?


    (1) Remove the exclude call. You don't need it. FileLists are smart
    enough to automatically exclude CVS directories and backup files.

    (2) If you do need exclude, put it in a separate step. E.g.

    PKG_FILES = FileList['blah*.rb']
    PKG_FILES.exclude(/.*test.rb/)

    Exclude must not be returning the filelist. That is a bug. I'll fix it
    in the next release.

    Thanks for the heads up.

    --
    -- 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 24, 2004
    #2
    1. Advertising

  3. T. Onoma

    T. Onoma Guest

    On Tuesday 24 August 2004 09:05 am, Jim Weirich wrote:
    > (1) Remove the exclude call. You don't need it. FileLists are smart
    > enough to automatically exclude CVS directories and backup files.
    >
    > (2) If you do need exclude, put it in a separate step. E.g.
    >
    > PKG_FILES = FileList['blah*.rb']
    > PKG_FILES.exclude(/.*test.rb/)
    >
    > Exclude must not be returning the filelist. That is a bug. I'll fix it
    > in the next release.
    >
    > Thanks for the heads up.


    No, No, Thank You! :)

    BTW, how do I give the RDocTask a prerequisite?

    Thanks again,
    T.
    T. Onoma, Aug 24, 2004
    #3
  4. Jim Weirich wrote:
    > Exclude must not be returning the filelist. That is a bug. I'll fix it
    > in the next release.


    I'm confused... Isn't FileList#exclude supposed to return an array of
    strings, not a FileList? (Rake 0.4.3, anyway)
    Joel VanderWerf, Aug 24, 2004
    #4
  5. T. Onoma

    Jim Weirich Guest

    T. Onoma said:
    > BTW, how do I give the RDocTask a prerequisite?


    Prerequisites can be added to a task at any time. Just redeclare the task
    and the prerequisites and action will be appended to the existing task.

    For example:

    task :build => [:preprocess, :compile, :link]

    is equivalent to ...

    task :build => [:preprocess]
    task :build => [:compile]
    task :build => [:link]

    So, to add a prereq to the :rdoc task ...

    task :rdoc => [:whatever]

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

    Jim Weirich Guest

    Joel VanderWerf said:
    > I'm confused... Isn't FileList#exclude supposed to return an array of
    > strings, not a FileList? (Rake 0.4.3, anyway)


    Well, exclude should return a list of strings (actually a list of file
    names). The type of list it returns is a FileList. And since FileList
    acts a lot like an array (through the magic of DuckTyping), returning the
    file list object *is* returning an array of strings ... it's just not an
    Array of strings.

    --
    -- 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 25, 2004
    #6
    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. Replies:
    3
    Views:
    163
    Jim Weirich
    Aug 23, 2004
  2. T. Onoma

    Rake FileList Includes Request

    T. Onoma, Aug 27, 2004, in forum: Ruby
    Replies:
    2
    Views:
    97
    T. Onoma
    Aug 27, 2004
  3. Joel VanderWerf

    [rake] excluding dirs with FileList

    Joel VanderWerf, Aug 1, 2005, in forum: Ruby
    Replies:
    3
    Views:
    522
    Stefan Lang
    Aug 1, 2005
  4. Don McClean

    Rake::Filelist and symbolic links

    Don McClean, Jul 2, 2007, in forum: Ruby
    Replies:
    0
    Views:
    107
    Don McClean
    Jul 2, 2007
  5. Bob Archer
    Replies:
    0
    Views:
    110
    Bob Archer
    Dec 4, 2008
Loading...

Share This Page