# class Puppet::ModuleTool::Applications::Uninstaller

### Public Class Methods

new(name, options) click to toggle source

    # File lib/puppet/module_tool/applications/uninstaller.rb, line 6
    def initialize(name, options)
      @name        = name
      @options     = options
      @errors      = Hash.new {|h, k| h[k] = {}}
      @unfiltered  = []
      @installed   = []
      @suggestions = []
      @environment = Puppet::Node::Environment.new(options[:environment])
    end

### Public Instance Methods

run() click to toggle source

    # File lib/puppet/module_tool/applications/uninstaller.rb, line 16
    def run
      results = {
        :module_name       => @name,
        :requested_version => @version,
      }

      begin
        find_installed_module
        validate_module
        FileUtils.rm_rf(@installed.first.path, :secure => true)

        results[:affected_modules] = @installed
        results[:result] = :success
      rescue ModuleToolError => err
        results[:error] = {
          :oneline   => err.message,
          :multiline => err.multiline,
        }
      rescue => e
        results[:error] = {
          :oneline => e.message,
          :multiline => e.respond_to?(:multiline) ? e.multiline : [e.to_s, e.backtrace].join("\n")
        }
      ensure
        results[:result] ||= :failure
      end

      results
    end