Permalink
Browse files

Changing show tasks.

  • Loading branch information...
1 parent 72e5cbb commit e98aa212219f18096b1804423696f7a01f92acb8 @jimweirich committed May 18, 2009
Showing with 10 additions and 14 deletions.
  1. +3 −5 lib/rake/application.rb
  2. +1 −0 test/functional/session_based_tests.rb
  3. +6 −9 test/lib/application_test.rb
View
@@ -178,7 +178,7 @@ def display_tasks_and_comments
displayable_tasks = tasks.select { |t|
t.comment && t.name =~ options.show_task_pattern
}
- if options.full_description
+ if options.show_task == :describe
displayable_tasks.each do |t|
puts "#{name} #{t.name_with_args}"
t.full_comment.split("\n").each do |line|
@@ -256,8 +256,7 @@ def standard_rake_options
],
['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
lambda { |value|
- options.show_tasks = true
- options.full_description = true
+ options.show_tasks = :describe
options.show_task_pattern = Regexp.new(value || '')
}
],
@@ -340,9 +339,8 @@ def standard_rake_options
],
['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
lambda { |value|
- options.show_tasks = true
+ options.show_tasks = :tasks
options.show_task_pattern = Regexp.new(value || '')
- options.full_description = false
}
],
['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
@@ -84,6 +84,7 @@ def test_long_description
in_environment("PWD" => "test/data/multidesc") do
rake "--describe"
end
+ puts @out
assert_match %r{^rake a\n *A / A2 *$}m, @out
assert_match %r{^rake b\n *B *$}m, @out
assert_match %r{^rake d\n *x{80}}m, @out
@@ -99,9 +99,9 @@ def test_display_tasks_with_long_comments_to_a_non_tty_with_columns_set_truncate
end
end
- def test_display_tasks_with_full_descriptions
+ def test_describe_tasks
+ @app.options.show_task = :describe
@app.options.show_task_pattern = //
- @app.options.full_description = true
@app.last_description = "COMMENT"
@app.define_task(Rake::Task, "t")
out = capture_stdout do @app.instance_eval { display_tasks_and_comments } end
@@ -319,7 +319,6 @@ def test_default_options
opts = command_line
assert_nil opts.classic_namespace
assert_nil opts.dryrun
- assert_nil opts.full_description
assert_nil opts.ignore_system
assert_nil opts.load_system
assert_nil opts.nosearch
@@ -345,16 +344,14 @@ def test_dry_run
def test_describe
flags('--describe') do |opts|
- assert opts.full_description
- assert opts.show_tasks
+ assert_equal :describe, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
end
end
def test_describe_with_pattern
flags('--describe=X') do |opts|
- assert opts.full_description
- assert opts.show_tasks
+ assert_equal :describe, opts.show_tasks
assert_equal(/X/.to_s, opts.show_task_pattern.to_s)
end
end
@@ -489,11 +486,11 @@ def test_trace_rules
def test_tasks
flags('--tasks', '-T') do |opts|
- assert opts.show_tasks
+ assert_equal :tasks, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
end
flags(['--tasks', 'xyz'], ['-Txyz']) do |opts|
- assert opts.show_tasks
+ assert_equal :tasks, opts.show_tasks
assert_equal(/xyz/, opts.show_task_pattern)
end
end

0 comments on commit e98aa21

Please sign in to comment.