Class: Rake::Application
- Inherits:
-
Object
- Object
- Rake::Application
- Defined in:
- lib/sake.rb
Instance Method Summary collapse
-
#display_tasks_and_comments(tasks = nil, pattern = nil, display_hidden = nil) ⇒ Object
(also: #show)
Show tasks that don’t have comments’.
- #have_rakefile(*args) ⇒ Object
-
#printf(*args) ⇒ Object
Show the tasks as ‘sake’ tasks.
-
#sake_original_have_rakefile ⇒ Object
Run Sake even if no Rakefile exists in the current directory.
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 ||= .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_rakefile ⇒ Object
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 |