Class: Zencoder::CLI::Command::Plugins

Inherits:
Base
  • Object
show all
Defined in:
lib/zencoder-cli/commands/plugins.rb

Class Method Summary collapse

Methods inherited from Base

extract_id, provides

Methods included from Helpers

#ask, #confirm, #display, #error, #format_date, #home_directory, #running_on_a_mac?, #running_on_windows?, #truncate

Class Method Details

.install(args, global_options, command_options) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zencoder-cli/commands/plugins.rb', line 21

def install(args, global_options, command_options)
  plugin = Zencoder::CLI::Plugin.new(args.shift)
  if plugin.install
    begin
      Zencoder::CLI::Plugin.load_plugin(plugin.name)
    rescue Exception => e
      installation_failed(plugin, e.message)
    end
    display "#{plugin} installed."
  else
    error "Could not install #{plugin}. Please check the URL and try again."
  end
end

.run(args, global_options, command_options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/zencoder-cli/commands/plugins.rb', line 10

def run(args, global_options, command_options)
  if Zencoder::CLI::Plugin.list.any?
    puts "The following plugins are installed:"
    Zencoder::CLI::Plugin.list.each do |plugin|
      display "* #{plugin}"
    end
  else
    display "There are no plugins installed."
  end
end

.uninstall(args, global_options, command_options) ⇒ Object



35
36
37
38
39
# File 'lib/zencoder-cli/commands/plugins.rb', line 35

def uninstall(args, global_options, command_options)
  plugin = Zencoder::CLI::Plugin.new(args.shift)
  plugin.uninstall
  display "#{plugin} uninstalled."
end