Method: Jax::PluginManager#uninstall

Defined in:
lib/jax/commands/plugin_manager.rb

#uninstall(name) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/jax/commands/plugin_manager.rb', line 47

def uninstall(name)
  catch :complete do
    message = catch :aborted do
      plugin_path = ::Rails.application.root.join("vendor/plugins/#{name}")
      if File.exist?(plugin_path.to_s)
        uninstall_plugin name, plugin_path
      else
        # see if it's a partial name
        matches = search installed_plugins, name
        throw :aborted, "Plugin '#{name}' does not seem to be installed." if matches.empty?

        if matches.length == 1 && match = matches.shift
          prompt_yn "Plugin '#{name}' is not installed, but '#{match[0]}' was. Delete it instead?"
          uninstall_plugin *match
        else
          say "Plugin '#{name}' is not installed, but the following partial matches are:"
          menu matches.keys.sort, :allow_all => true do |name,index|
            uninstall_plugin name, matches[name]
          end
        end
      end

      throw :complete
    end
    
    say_status :aborted, message, :yellow
  end
end