Class: Pod::Command::Bin::OutputSource

Inherits:
Pod::Command::Bin show all
Defined in:
lib/cocoapods-meitu-bin/command/bin/output_source.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_list, #sources_manager, #sources_option, #valid_sources

Constructor Details

#initialize(argv) ⇒ OutputSource

Returns a new instance of OutputSource.



25
26
27
28
29
# File 'lib/cocoapods-meitu-bin/command/bin/output_source.rb', line 25

def initialize(argv)
  @error_source = argv.flag?('error-source', false)
  @export_file = argv.flag?('export-file', false)
  super
end

Class Method Details

.optionsObject



18
19
20
21
22
23
# File 'lib/cocoapods-meitu-bin/command/bin/output_source.rb', line 18

def self.options
  [
    %w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证],
    %w[--export-file 导出当前所有tag版本的podspec]
  ].concat(super).uniq
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cocoapods-meitu-bin/command/bin/output_source.rb', line 31

def run
  # 开始时间
  @start_time = Time.now.to_i
  # 更新repo仓库
  repo_update
  # 分析依赖
  @analyze_result = analyse

  if  @error_source
    # 打印source
    show_cost_source
  end

  if  @export_file
    pod_targets = @analyze_result.pod_targets.uniq
    pod_targets.map { |pod_target|
      current_path = Dir.pwd
      spec_path = "#{current_path}/podfile_shell/#{pod_target.root_spec.name}/#{pod_target.root_spec.version.version}/"
      `mkdir -p  #{spec_path}`
      if system("cp #{pod_target.root_spec.defined_in_file.to_s}  #{spec_path} > /dev/null 2>&1")
        puts "#{pod_target.root_spec.name}#{pod_target.root_spec.version.version} 已经导出"
      else
        `rm -rf #{current_path}/podfile_shell/#{pod_target.root_spec.name} > /dev/null 2>&1`
      end
      # puts pod_target.root_spec.name pod_target.root_spec.version.version pod_target.root_spec.defined_in_file
    }
  end
  # 计算耗时
  show_cost_time
end