Skip to content

Commit

Permalink
Don't choke on unexpected output from Rake
Browse files Browse the repository at this point in the history
  • Loading branch information
njonsson committed Jan 30, 2012
1 parent 8f4a76f commit 2e04725
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cape/rake.rb
Expand Up @@ -50,7 +50,10 @@ def each_task(task_expression=nil)
task_expression = " #{task_expression}" if task_expression
command = "#{local_executable} --tasks #{task_expression}"
`#{command}`.each_line do |l|
matches = l.chomp.match(/^rake (.+?)(?:\[(.+?)\])?\s+# (.+)/)
unless (matches = l.chomp.match(/^rake (.+?)(?:\[(.+?)\])?\s+# (.+)/))
next
end

task = {}.tap do |t|
t[:name] = matches[1].strip
t[:parameters] = matches[2].split(',') if matches[2]
Expand Down

0 comments on commit 2e04725

Please sign in to comment.