Class: Pod::Command::Reinstall

Inherits:
Pod::Command show all
Includes:
ProjectDirectory, RepoUpdate
Defined in:
lib/cocoapods-dongjia/command/reinstall.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Reinstall

Returns a new instance of Reinstall.



21
22
23
24
25
# File 'lib/cocoapods-dongjia/command/reinstall.rb', line 21

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

Instance Method Details

#runObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cocoapods-dongjia/command/reinstall.rb', line 44

def run

  deintegrator = Deintegrator.new
  deintegrator.deintegrate_project(@project)
  @project.save

  verify_podfile_exists!
  installer = installer_for_config
  installer.repo_update = repo_update?(:default => false)
  installer.update = false
  installer.deployment = @deployment
  installer.clean_install = @clean_install
  installer.install!

end

#validate!Object



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

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