Class: Rake::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/sake.rb

Instance Method Summary collapse

Instance Method Details

#display_tasks_and_comments(tasks = nil, pattern = nil, display_hidden = nil) ⇒ Object Also known as: show

Show tasks that don’t have comments’



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/sake.rb', line 541

def display_tasks_and_comments(tasks = nil, pattern = nil, display_hidden = nil)
  tasks ||= self.tasks

  if pattern ||= options.show_task_pattern
    tasks = tasks.select { |t| t.name[pattern] || t.comment.to_s[pattern] }
  end

  width = tasks.collect { |t| t.name.length }.max

  tasks.each do |t|
    comment = "   # #{t.comment}" if t.comment
    if display_hidden
      printf "sake %-#{width}s#{comment}\n", t.name
    else
      printf "sake %-#{width}s#{comment}\n", t.name if t.name && t.comment
    end
  end
end

#have_rakefile(*args) ⇒ Object



564
565
566
567
# File 'lib/sake.rb', line 564

def have_rakefile(*args)
  @rakefile ||= ''
  sake_original_have_rakefile(*args) || true
end

#printf(*args) ⇒ Object

Show the tasks as ‘sake’ tasks.



534
535
536
537
# File 'lib/sake.rb', line 534

def printf(*args)
  args[0].sub!('rake', 'sake') if args[0].is_a? String
  super
end

#sake_original_have_rakefileObject

Run Sake even if no Rakefile exists in the current directory.



563
# File 'lib/sake.rb', line 563

alias_method :sake_original_have_rakefile, :have_rakefile