Class: Pod::Command::Deintegrate

Inherits:
Pod::Command show all
Includes:
ProjectDirectory
Defined in:
lib/cocoapods/command/deintegrate.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Deintegrate

Returns a new instance of Deintegrate.



20
21
22
23
24
# File 'lib/cocoapods/command/deintegrate.rb', line 20

def initialize(argv)
  path = argv.shift_argument
  @project_path = Pathname.new(path) if path
  super
end

Instance Method Details

#runObject



43
44
45
46
47
48
49
50
# File 'lib/cocoapods/command/deintegrate.rb', line 43

def run
  # We don't traverse a Podfile and try to de-intergrate each target.
  # Instead, we're just deintegrating anything CP could have done to a
  # project. This is so that it will clean stale, and modified projects.
  deintegrator = Deintegrator.new
  deintegrator.deintegrate_project(@project)
  @project.save
end

#validate!Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cocoapods/command/deintegrate.rb', line 26

def validate!
  super

  unless @project_path
    xcodeprojs = Pathname.glob('*.xcodeproj')
    @project_path = xcodeprojs.first if xcodeprojs.size == 1
  end

  help! 'A valid Xcode project file is required.' unless @project_path
  help! "#{@project_path} does not exist." unless @project_path.exist?
  unless @project_path.directory? && (@project_path + 'project.pbxproj').exist?
    help! "#{@project_path} is not a valid Xcode project."
  end

  @project = Xcodeproj::Project.open(@project_path)
end