lib/acquia_toolbelt/thor.rb in acquia_toolbelt-2.3.1 vs lib/acquia_toolbelt/thor.rb in acquia_toolbelt-2.3.2
- old
+ new
@@ -1,6 +1,6 @@
-$:.unshift(File.expand_path('../vendor/thor/lib/', File.dirname(__FILE__)))
+$LOAD_PATH.unshift(File.expand_path('../vendor/thor/lib/', File.dirname(__FILE__)))
require 'thor'
module AcquiaToolbelt
module UtilityMethods
protected
@@ -13,19 +13,19 @@
class Thor < ::Thor
include UtilityMethods
no_tasks do
def self.help(shell, subcommand = false)
- list = printable_commands(true, subcommand).sort!{ |a,b| a[0] <=> b[0] }
+ list = printable_commands(true, subcommand).sort! { |a, b| a[0] <=> b[0] }
shell.say "Type 'acquia [COMMAND] help' for more details on subcommands or to show example usage."
if @package_name
shell.say "#{@package_name} commands:"
else
shell.say
- shell.say "Commands:"
+ shell.say 'Commands:'
end
shell.print_table(list, :indent => 2, :truncate => true)
shell.say unless subcommand
class_options_help(shell)
@@ -35,18 +35,18 @@
(all ? all_commands : commands).map do |_, command|
# Don't show the hidden commands or the help commands.
next if command.hidden? || next if command.name.include? 'help'
item = []
item << banner(command, false, subcommand)
- item << (command.description ? "# #{command.description.gsub(/\s+/m,' ')}" : "") unless command.description.empty?
+ item << (command.description ? "# #{command.description.gsub(/\s+/m,' ')}" : '') unless command.description.empty?
item
end.compact
end
# Define a base for the commands.
def self.banner_base
- "acquia"
+ 'acquia'
end
def self.banner(task, task_help = false, subcommand = false)
subcommand_banner = to_s.split(/::/).map{|s| s.downcase}[2..-1]
subcommand_banner = if subcommand_banner.size > 0
@@ -54,11 +54,11 @@
else
nil
end
task = (task_help ? task.formatted_usage(self, false, subcommand) : task.name)
- banner_base + " " + [subcommand_banner, task].compact.join(":")
+ banner_base + ' ' + [subcommand_banner, task].compact.join(':')
end
def self.handle_no_task_error(task)
raise UndefinedTaskError, "Could not find command #{task.inspect}."
end
@@ -90,6 +90,6 @@
error.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ ||
error.message =~ /undefined method `#{name}' on an instance of #{Regexp.escape(instance.class.name)}/
)
end
end
-end
\ No newline at end of file
+end