Sha256: 198eaafad8bfc43e073d6f7ed32a860b30fb307c1e6701525ba96ad21e9ec0f5
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module Bukkit class Plugin def self.uninstall(name) # First check if in root dir. abort "You're not in a server's root directory!".red unless File.exists? "craftbukkit.jar" if Dir.exists?("plugins") # The plugins dir exists and is not empty. Dir.chdir("plugins") plugins = Dir.glob("*") delete = [] # Case insensitively checks each file/dir for a match. plugins.each do |plugin| if /#{name}/i =~ plugin # Make the plugin name look the way the plugin dev wanted. name = plugin if File.ftype(plugin) == "directory" delete << plugin end end # Delete each matching file. if delete.empty? abort "No plugins found matching '#{name}'".yellow else delete.each do |file| if File.ftype(file) == "directory" file = "#{file}/" end FileUtils.rm_rf file puts file.light_red + " deleted".red end puts "#{name} has been successfully uninstalled.".green end else abort "You have no plugins to uninstall." end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bukkit-2.5.2 | lib/bukkit/uninstall.rb |
bukkit-2.5.1 | lib/bukkit/uninstall.rb |
bukkit-2.5.0 | lib/bukkit/uninstall.rb |