class Pod::Command::Demo

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-dongjia/command/demo.rb, line 15
def run

  dir = Dir.new('.')

  is_pod_root = false
  has_demo = false
  dir.each do |name|
    if name.end_with?('podspec') || name.end_with?('podspec.json')
      is_pod_root = true
    end
    if name == 'Demo'
      has_demo = true
    end
  end

  if is_pod_root
    if has_demo
      Pod::UI.warn('已存在 Demo')
    else
      `git clone git@code.kaipao.cc:ios-team/AppSpecDemo.git Demo`
      `rm -fr ./Demo/.git` if File.exist?('./Demo/.git')
    end
  else 
    Pod::UI.warn('当前不在一个 Pod 的根目录')
  end

end