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’



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

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



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

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

#printf(*args) ⇒ Object

Show the tasks as ‘sake’ tasks.



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

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.



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

alias_method :sake_original_have_rakefile, :have_rakefile