Module: PodTools

Defined in:
lib/version.rb,
lib/pod-tools.rb

Constant Summary collapse

VERSION =
'0.1.2'

Class Method Summary collapse

Class Method Details

.delete_derived_dataObject

Delete all derived data



21
22
23
24
25
# File 'lib/pod-tools.rb', line 21

def self.delete_derived_data
  puts 'Cleaning derived data...'
  deletion = `rm -rf ~/Library/Developer/Xcode/DerivedData/*`
  puts '  Derived data deleted!'.green
end

.delete_podfiles(current_path) ⇒ Object

Delete podfiles



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pod-tools.rb', line 47

def self.delete_podfiles(current_path)

  # Check if you are on a project with Podfile
  bool = File.exist?("#{current_path}/Podfile")

  unless bool
    puts "You're not on a XCode project...".red
    exit 1
  end

  remove_podfiles(current_path)

end

.reinstall(path) ⇒ Object

Reinstall Pods



14
15
16
17
18
# File 'lib/pod-tools.rb', line 14

def self.reinstall(path)
  puts 'Reinstalling pods...'
  `pod install`

end

.remove_file(path) ⇒ Object

Remove a file



7
8
9
10
11
# File 'lib/pod-tools.rb', line 7

def self.remove_file(path)
  puts "  #{path.green}"
  to_remove = "rm -rf #{path}"
  FileUtils.rm_rf("#{path}", secure: true)
end

.remove_podfiles(path) ⇒ Object

Remove Cocoapods’ files



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pod-tools.rb', line 28

def self.remove_podfiles(path)
  puts 'Cleaning Podfile related data...'

  # add items
  disposables = Array.new

  disposables << 'Podfile.lock'
  disposables << 'Pods/'
  disposables << '*.xcworkspace'

  # Iterate the disposables
  disposables.each do |item|
    full_path = "#{path}/#{item}"
    # remove item
    remove_file (full_path)
  end
end