Rake desc bug

J

Jim Menard

I think I've found a minor bug in Rake with the "desc" method and -T flag.

task :default => [:eek:ne]

task :eek:ne do
puts 'one'
end

desc "description of task one"
task :eek:ne => [:anything]

desc "description of task two"
task :two do
puts 'two'
end

% rake -T
(in c:/jmenard)
rake two # description of task two

This only happens if "task :eek:ne" appears more than once and the description
comes after the first "task :eek:ne". For example, reversing the tasks but
keeping the desc after the second one does the same thing:

task :default => [:eek:ne]

task :eek:ne do
puts 'one'
end

desc "description of task one"
task :eek:ne => [:anything]

desc "description of task two"
task :two do
puts 'two'
end

% rake -T
(in c:/jmenard)
rake two # description of task two

If I move the desc up before the first "task :eek:ne" then both descriptions get
printed:

task :default => [:eek:ne]

desc "description of task one"
task :eek:ne => [:anything]

task :eek:ne do
puts 'one'
end

desc "description of task two"
task :two do
puts 'two'
end

~> rake -T
(in c:/jmenard)
rake one # description of task one
rake two # description of task two

Looking at rake.rb, I think the problem is that $last_comment is only used
when a new task is created, not when an existing one is extended (re-opened?
added to?). I don't know if using $last_comment inside Task.define_task
instead of in the initialize method makes sense or if that would break
something else.

Jim
 
J

Jim Weirich

Jim Menard said:
I think I've found a minor bug in Rake with the "desc" method and -T flag.

task :default => [:eek:ne]

task :eek:ne do
puts 'one'
end

desc "description of task one"
task :eek:ne => [:anything]

desc "description of task two"
task :two do
puts 'two'
end

% rake -T
(in c:/jmenard)
rake two # description of task two

This only happens if "task :eek:ne" appears more than once and the
description
comes after the first "task :eek:ne". For example, reversing the tasks but
keeping the desc after the second one does the same thing:

task :default => [:eek:ne]

task :eek:ne do
puts 'one'
end

desc "description of task one"
task :eek:ne => [:anything]

desc "description of task two"
task :two do
puts 'two'
end

% rake -T
(in c:/jmenard)
rake two # description of task two

If I move the desc up before the first "task :eek:ne" then both descriptions
get
printed:

task :default => [:eek:ne]

desc "description of task one"
task :eek:ne => [:anything]

task :eek:ne do
puts 'one'
end

desc "description of task two"
task :two do
puts 'two'
end

~> rake -T
(in c:/jmenard)
rake one # description of task one
rake two # description of task two

Looking at rake.rb, I think the problem is that $last_comment is only used
when a new task is created, not when an existing one is extended
(re-opened?
added to?). I don't know if using $last_comment inside Task.define_task
instead of in the initialize method makes sense or if that would break
something else.

Thanks for the report. I think this is a case where it works as designed,
but perhaps it could have been designed better.

I think moving the check for $last_comment should be safe. I'll look at
the code tonight when I get home.

With that in mind, what should rake -T display for the following?

desc "First Comment"
task :eek:ne

desc "Second Comment"
task :eek:ne
 
J

Jim Menard

Jim,
Thanks for the report. I think this is a case where it works as designed,
but perhaps it could have been designed better.

I think moving the check for $last_comment should be safe. I'll look at
the code tonight when I get home.

With that in mind, what should rake -T display for the following?

desc "First Comment"
task :eek:ne

desc "Second Comment"
task :eek:ne

A warning, perhaps?

I can see arguments for keeping the first, the second, or both. I think I'd
prefer seeing both joined by a space.

Thanks for listening.

Jim
 
J

Jim Weirich

Jim said:
Jim Menard said:

The latest rake in CVS now supports additive comments. Multiple
comments will be separated by a "/". This feature will be in the next
version.
 
J

Jim Menard

Jim,
The latest rake in CVS now supports additive comments. Multiple
comments will be separated by a "/". This feature will be in the next
version.

Thanks for this modification, your helpfulness, and Rake.

Jim
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top