Skip to content

Commit

Permalink
Removed all_tasks alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed May 26, 2009
1 parent 4d1f689 commit a50b5b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/thor.rb
Expand Up @@ -22,7 +22,7 @@ def help(task = nil)
else
puts "Options"
puts "-------"
self.class.all_tasks.each do |_, task|
self.class.tasks.each do |_, task|
format = "%-" + (self.class.maxima.usage + self.class.maxima.opt + 4).to_s + "s"
print format % ("#{task.formatted_usage(self, false)}")
puts task.description.split("\n").first
Expand Down
7 changes: 3 additions & 4 deletions lib/thor/base.rb
Expand Up @@ -135,7 +135,6 @@ def subclasses
def tasks
@tasks ||= from_superclass(:tasks, Thor::CoreExt::OrderedHash.new)
end
alias :all_tasks :tasks

# A shortcut to retrieve a specific task from this Thor class.
#
Expand Down Expand Up @@ -179,9 +178,9 @@ def default_options(options=nil)

def maxima
@maxima ||= begin
max_usage = all_tasks.map {|_, t| t.usage}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
max_desc = all_tasks.map {|_, t| t.description}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
max_opts = all_tasks.map {|_, t| t.full_options(self).formatted_usage}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
max_usage = tasks.map {|_, t| t.usage}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
max_desc = tasks.map {|_, t| t.description}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
max_opts = tasks.map {|_, t| t.full_options(self).formatted_usage}.max {|x,y| x.to_s.size <=> y.to_s.size}.size
Struct.new(:description, :usage, :opt).new(max_desc, max_usage, max_opts)
end
end
Expand Down

0 comments on commit a50b5b1

Please sign in to comment.