Class: Pod::Command::Bin::Batch

Inherits:
Pod::Command::Bin show all
Defined in:
lib/cocoapods-tdf-bin/command/bin/batch.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CBin::SpecFilesHelper

#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files

Methods included from CBin::SourcesHelper

#binary_source, #code_source, #sources_manager, #sources_option, #valid_sources

Constructor Details

#initialize(argv) ⇒ Batch

Returns a new instance of Batch.



24
25
26
27
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 24

def initialize(argv)
  @arguments = argv.arguments
  super
end

Class Method Details

.optionsObject



16
17
18
19
20
21
22
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 16

def self.options
  [
    ['clone', '本地库全部 clone 到指定本地目录'],
    ['done', '完成本地库,自动将本地的 local 依赖改为remote依赖'],
    ['{ git 命令 }', '本地库全部执行 git 命令,比如 pod bin batch pull, pod bin batch checkout -b feature/***'],
  ]
end

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 29

def run
  podfile = File.join(Pathname.pwd, "Podfile")
  podfile_instance = Pod::Podfile.from_file(podfile)
  if podfile_instance.get_batch_local_pods == nil
    help! "没有本地依赖的组件"
  end
  if @arguments.size == 1 && @arguments[0] == "clone"
    clone_all(podfile_instance)
  elsif @arguments.size == 1 && @arguments[0] == "done"
    done_all(podfile_instance)
  else
    run_git(podfile_instance)
  end
end

#validate!Object



44
45
46
47
48
49
50
51
52
# File 'lib/cocoapods-tdf-bin/command/bin/batch.rb', line 44

def validate!
  if @arguments.size < 1
    help! "命令参数不够"
  end
  git = `which git`
  if git.empty?
    help! "没有安装 git 命令"
  end
end