Class: Pod::Command::Stable::Sync

Inherits:
Pod::Command::Stable show all
Extended by:
Executable
Defined in:
lib/cocoapods-bb-PodAssistant/command/stable/sync.rb

Instance Method Summary collapse

Methods inherited from Pod::Command::Stable

#validate!

Constructor Details

#initialize(argv) ⇒ Sync

Returns a new instance of Sync.



21
22
23
# File 'lib/cocoapods-bb-PodAssistant/command/stable/sync.rb', line 21

def initialize(argv)
  super
end

Instance Method Details

#clone_stable_gitObject

拉取stable仓库代码 ruby脚本内部调用



35
36
37
38
39
40
41
42
43
44
# File 'lib/cocoapods-bb-PodAssistant/command/stable/sync.rb', line 35

def clone_stable_git
  cache = BB::Cache.new()
  cachePath = cache.cachePath
  configGitPath(cachePath)
  unless Dir.exist?(File.join(cachePath))
    clonePath = File.dirname(cachePath)
    FileUtils.mkdir_p clonePath
    git_clone(@stable_source,clonePath)
  end
end

#fetch_stale_gitObject



46
47
48
49
50
51
52
# File 'lib/cocoapods-bb-PodAssistant/command/stable/sync.rb', line 46

def fetch_stale_git
  clone_stable_git
  # git操作
  git_reset
  git_fetch
  git_checkout_and_pull(@stable_source, @stable_branch, @stable_tag)
end

#runObject



25
26
27
28
29
30
31
32
# File 'lib/cocoapods-bb-PodAssistant/command/stable/sync.rb', line 25

def run
  puts "开始合并远端stable yml数据".yellow
  # 数据合并
  source_manager = BB::SourceManager.new()
  fetch_stale_git
  source_manager.merge_stable_data
  puts "[PodAssistant] `pod stable sync` complete! Please execute the [pod install/ pod update] command".green
end