class PMD::CLI
Public Class Methods
new(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
click to toggle source
# File lib/pmd/cli.rb, line 24 def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel) @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel end
Public Instance Methods
execute!()
click to toggle source
# File lib/pmd/cli.rb, line 28 def execute! before command_class = subcommand command_class.new().execute! end
Private Instance Methods
before()
click to toggle source
# File lib/pmd/cli.rb, line 37 def before if not File.directory? Config.base_dir FileUtils.mkdir_p Config.base_dir end end
subcommand()
click to toggle source
# File lib/pmd/cli.rb, line 45 def subcommand if not @argv.length > 0 return @@default end keyword = @argv[0].to_sym @@commands.each do |key, command_class| aliases = nil if @@aliases.has_key? key # grab the key and then fill the aliases hash properly value = @@aliases[key] if value.kind_of?(Symbol) aliases = [value] else aliases = value end end if keyword == key or (aliases and aliases.include?(keyword)) return command_class end end return @@default end