tags:

views:

207

answers:

2

I think I'm going mad. Can anyone help?

I have the folder c:\project\bin I run the following to execute my rake script

cd C:\project
rake

In my rake script I have:

require 'rake/clean'
CLOBBER.include('bin')

task :default => ["compile"]

task :compile do
    # do nothing
end

It doesn't delete the "bin" folder nor the contents of the "bin" folder. I'm running Ruby in Windows (1.86 or so) and installed rake using, gem install rake.

Have I missed something. I've tried --trace etc.. but get no feedback.

A: 

CLEAN nor CLOBBER are not implicit tasks - you must declare dependency or invoke them

hoppo
Could you give an example, as everywhere I'm reading doesn't state this to be the case. Martin Fowler for example, http://martinfowler.com/articles/rake.html#BuiltInCleaning, or this article http://www.stuartellis.eu/articles/rake/.
Bealer
A: 

TL;DR: $ rake clobber


As the answer above said, they are not implicilty invoked. Here is an example, as you asked for.

~/deleteme$ cd project
total 8
-rw-r--r--@ 1 josh  staff  110 Jun 27 06:04 Rakefile


~/deleteme/project$ cat Rakefile
require 'rake/clean'
CLOBBER.include('bin')

task :default => ["compile"]

task :compile do
  mkdir 'bin'
end


~/deleteme/project$ rake
(in /Users/josh/deleteme/project)
mkdir bin


~/deleteme/project$ ls -l
total 8
-rw-r--r--@ 1 josh  staff  110 Jun 27 06:04 Rakefile
drwxr-xr-x  2 josh  staff   68 Jun 27 06:05 bin


~/deleteme/project$ rake -T
(in /Users/josh/deleteme/project)
rake clean    # Remove any temporary products.
rake clobber  # Remove any generated file.


~/deleteme/project$ rake clobber
(in /Users/josh/deleteme/project)
rm -r bin


~/deleteme/project$ ls -l
total 8
-rw-r--r--@ 1 josh  staff  110 Jun 27 06:04 Rakefile
Joshua Cheek