Module: Zencoder::CLI::Command
- Extended by:
- Helpers
- Defined in:
- lib/zencoder-cli/commands/base.rb,
lib/zencoder-cli/commands/jobs.rb,
lib/zencoder-cli/commands/setup.rb,
lib/zencoder-cli/commands/account.rb,
lib/zencoder-cli/commands/outputs.rb,
lib/zencoder-cli/commands/plugins.rb,
lib/zencoder-cli/command.rb
Defined Under Namespace
Classes: Account, Base, Job, Jobs, Output, Plugins, Setup, UnknownCommandName
Class Method Summary collapse
Methods included from Helpers
ask, confirm, display, error, format_date, home_directory, running_on_a_mac?, running_on_windows?, truncate
Class Method Details
.run(command, args, global_options = {}, command_options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/zencoder-cli/command.rb', line 12 def run(command, args, ={}, ={}) Zencoder::CLI::Auth.require_authentication([:environment]) unless command[/^setup/] names = command.split(":") klass_name = "Zencoder::CLI::Command::#{names.map(&:camelize).join("::")}" if klass_name.constant? method_name = :run klass = klass_name.constantize else method_name = names.pop klass = "Zencoder::CLI::Command::#{names.map(&:camelize).join("::")}".constantize end if klass.respond_to?(method_name) klass.send(method_name, args, , ) else raise UnknownCommandName end rescue UnknownCommandName, NameError => e if e.class == UnknownCommandName || e.[/uninitialized constant Zencoder::CLI::Command::/] error "There is no command named #{command}. Use --help for more information." else raise e end end |