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) ⇒ Object Also known as: show

Show tasks that don’t have comments’



499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/sake.rb', line 499

def display_tasks_and_comments(tasks = nil, pattern = 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
    printf "sake %-#{width}s#{comment}\n", t.name
  end
end

#have_rakefile(*args) ⇒ Object



518
519
520
521
# File 'lib/sake.rb', line 518

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

#printf(*args) ⇒ Object

Show the tasks as ‘sake’ tasks.



492
493
494
495
# File 'lib/sake.rb', line 492

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.



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

alias_method :sake_original_have_rakefile, :have_rakefile