Sha256: f4e4147da67dfc0bd6ad1bcb6589bef3b4c24182a62cfc84a950a26dfd230399

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require "highline/import"

class UninstallCommand  < Command
  
  include Rcli::Installation
  
  description "Uninstalls rcli from your system, or uninstalls a specific rcli app"

  def main()
    
    if $verbose
      print "params : "
      pp @params
    end
      
    if _installed_rcli_base? && @params[:args].length > 0
      unless !File.exists? Rcli::RCLI_DOTFOLDER + DS + 'bin' + DS + @params[:args][0]
        puts "ERROR: The rcli app you provided does not exist. Please type 'rcli list' for list of installed apps."
      end

      FileUtils.rm(File.exists? Rcli::RCLI_DOTFOLDER + DS + 'bin' + DS + @params[:args][0])
      FileUtils.rm(File.exists? Rcli::RCLI_DOTFOLDER + DS + 'app_info' + DS + @params[:args][0] + '.yml')

    elsif @params[:args].length > 0 && !_installed_rcli_base?
      puts "You haven't installed the rcli base yet. Please run 'rcli install' first."
    elsif _installed_rcli_base?
      if agree('Are you sure you want to completely remove rcli from your system? (y/n)', true)
        puts "Deleting : " + Rcli::RCLI_DOTFOLDER if $verbose
        FileUtils.rm_rf(Rcli::RCLI_DOTFOLDER)
      end
    else
      puts "ERROR: rcli isn't installed"
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcli-0.1.2 lib/commands/uninstall.rb
rcli-0.1.0 lib/commands/uninstall.rb