class Pod::Command::X::XC::Clean

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/cocoapods-x/command/xcode/clean.rb, line 24
def initialize(argv)
    @cache_files = Pod::X::Sandbox::xcode_cachefiles
    @wipe_all = argv.flag?('all')
    super
end
options() click to toggle source
Calls superclass method
# File lib/cocoapods-x/command/xcode/clean.rb, line 18
def self.options
    [
        ['--open', 'Open after Installation complete']
    ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-x/command/xcode/clean.rb, line 30
def run
    if @wipe_all
        remove_files ['Pods', 'Podfile.lock', 'DerivedData']
    else
        begin
            choices = ['Pods', 'Podfile.lock', 'Pods and Podfile.lock', 'DerivedData', 'All']
            index = UI.choose_from_array(choices, 'Which item do you want to remove?')
            case index
            when 0
                remove_files ['Pods']
            when 1
                remove_files ['Podfile.lock']
            when 2
                remove_files ['Pods', 'Podfile.lock']
            when 3
                remove_files ['DerivedData']
            when 4
                remove_files ['Pods', 'Podfile.lock', 'DerivedData']
            end
        rescue => exception
            UI.puts '[!] Pod::X '.magenta + "#{exception}".red
        end
    end
end

Private Instance Methods

remove_files(files) click to toggle source
# File lib/cocoapods-x/command/xcode/clean.rb, line 60
def remove_files files
    files.each do |file| 
        url = @cache_files[file]
        unless url.nil?
            UI.section("Removing #{file} => #{url}.") do
                rm! ['-rf', url]
            end
        end
    end
end