Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake --tasks full description (not cut)

Tags:

ruby

rake

Maybe it's one of those code 18,

but when I run rake -T on my Rakefile, the long descriptions of my tasks are always cut. Is there any way to display the full description without having to make the desc shorter?

Thanks

like image 520
jfabre Avatar asked Aug 24 '11 20:08

jfabre


People also ask

What are Rake tasks?

Rake is a software task management and build automation tool created by Jim Weirich. It allows the user to specify tasks and describe dependencies as well as to group tasks in a namespace. It is similar in to SCons and Make.

Why do we need Rake tasks?

Rake is a popular task runner for Ruby and Rails applications. For example, Rails provides the predefined Rake tasks for creating databases, running migrations, and performing tests. You can also create custom tasks to automate specific actions - run code analysis tools, backup databases, and so on.

How do I run a rake task?

Go to Websites & Domains and click Ruby. After gems installation you can try to run a Rake task by clicking Run rake task. In the opened dialog, you can provide some parameters and click OK - this will be equivalent to running the rake utility with the specified parameters in the command line.


4 Answers

The format is slightly different (description starts on the next line instead of as a comment on the current line), but this will give you the full descriptions:

rake -D

Also, if you really want the other format, you can pipe the output to cat instead:

rake -T | cat
like image 149
Dylan Markow Avatar answered Oct 11 '22 05:10

Dylan Markow


-D, --describe [PATTERN] Describe the tasks (matching optional PATTERN), then exit.

rake -D

like image 42
Vasiliy Ermolovich Avatar answered Oct 11 '22 07:10

Vasiliy Ermolovich


Three solutions:

1) You may define your own '-T'

task :longT do
  app = Rake.application
  app.tasks.each{|task|
    puts "%-20s  # %s" % [task.name, task.comment] if task.comment
  }
end

2) fool, there is no tty:

Rake.application.tty_output= false    

3) Modify a rake command

module Rake
  class Application
    def truncate_output?
      #tty_output? || ENV['RAKE_COLUMNS']
      false
    end
  end
end

I would recommend version 2)

(Tested with rake-0.8.7)

like image 35
knut Avatar answered Oct 11 '22 06:10

knut


There's an environment variable you can set:

export RAKE_COLUMNS=200
like image 35
dwilkins Avatar answered Oct 11 '22 07:10

dwilkins