class Azuki::Command::Plugins

manage plugins to the azuki gem

Public Instance Methods

index() click to toggle source
plugins

list installed plugins

Example:

$ azuki plugins
=== Installed Plugins
azuki-accounts
# File lib/azuki/command/plugins.rb, line 18
def index
  validate_arguments!

  plugins = ::Azuki::Plugin.list

  if plugins.length > 0
    styled_header("Installed Plugins")
    styled_array(plugins)
  else
    display("You have no installed plugins.")
  end
end
install() click to toggle source
plugins:install URL

install a plugin

Example:

$ azuki plugins:install https://github.com/ddollar/azuki-accounts.git
Installing azuki-accounts... done
# File lib/azuki/command/plugins.rb, line 40
def install
  plugin = Azuki::Plugin.new(shift_argument)
  validate_arguments!

  action("Installing #{plugin.name}") do
    if plugin.install
      unless Azuki::Plugin.load_plugin(plugin.name)
        plugin.uninstall
        exit(1)
      end
    else
      error("Could not install #{plugin.name}. Please check the URL and try again.")
    end
  end
end
uninstall() click to toggle source
plugins:uninstall PLUGIN

uninstall a plugin

Example:

$ azuki plugins:uninstall azuki-accounts
Uninstalling azuki-accounts... done
# File lib/azuki/command/plugins.rb, line 65
def uninstall
  plugin = Azuki::Plugin.new(shift_argument)
  validate_arguments!

  action("Uninstalling #{plugin.name}") do
    plugin.uninstall
  end
end
update() click to toggle source
plugins:update [PLUGIN]

updates all plugins or a single plugin by name

Example:

$ azuki plugins:update
Updating azuki-accounts... done

$ azuki plugins:update azuki-accounts
Updating azuki-accounts... done
# File lib/azuki/command/plugins.rb, line 86
def update
  plugins = if plugin = shift_argument
    [plugin]
  else
    ::Azuki::Plugin.list
  end
  validate_arguments!

  plugins.each do |plugin|
    begin
      action("Updating #{plugin}") do
        begin
          Azuki::Plugin.new(plugin).update
        rescue Azuki::Plugin::ErrorUpdatingSymlinkPlugin
          status "skipped symlink"
        end
      end
    rescue SystemExit
      # ignore so that other plugins still update
    end
  end
end