Class: Pod::Command::X::XC::Clean

Inherits:
Pod::Command::X::XC show all
Extended by:
Executable
Defined in:
lib/cocoapods-x/command/xcode/clean.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Clean

Returns a new instance of Clean.



24
25
26
27
28
# 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

Class Method Details

.optionsObject



18
19
20
21
22
# File 'lib/cocoapods-x/command/xcode/clean.rb', line 18

def self.options
    [
        ['--open', 'Open after Installation complete']
    ].concat(super)
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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 '.blue + "#{exception}".red
        end
    end
end