Class: Pod::Command::Bin::Dup

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Bin

#validate!

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, #sources_optionV2, #valid_sources, #valid_sourcesV2

Constructor Details

#initialize(argv) ⇒ Dup

Returns a new instance of Dup.



26
27
28
29
30
31
32
# File 'lib/cocoapods-bb-bin/command/bin/dup.rb', line 26

def initialize(argv)
  @codeSource =  argv.option('source') || nil

  @config = Pod::Config.instance

  super
end

Class Method Details

.optionsObject



17
18
19
20
21
22
23
24
# File 'lib/cocoapods-bb-bin/command/bin/dup.rb', line 17

def self.options
  [
      ['--all-clean', '删除所有已经下载的源码'],
      ['--clean', '删除所有指定下载的源码'],
      ['--list', '展示所有一级下载的源码以及其大小'],
      ['--source', '源码路径,本地路径,会去自动链接本地源码']
  ]
end

Instance Method Details

#runObject



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
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cocoapods-bb-bin/command/bin/dup.rb', line 35

def run
  target_definition = Pod::Config.instance.podfile.target_definition_list[1]

  user_build_configurations = target_definition.build_configurations || Target::DEFAULT_BUILD_CONFIGURATIONS
  aggregateTarget = AggregateTarget.new(Pod::Config.instance.sandbox,
                                        target_definition.uses_frameworks?,
                                        user_build_configurations ,
                                        nil,
                                        target_definition.platform,
                                        target_definition,
                                        Pod::Config.instance.installation_root,
                                        nil,
                                        nil ,
                                        user_build_configurations)
  input_file = aggregateTarget.copy_resources_script_path
  output_pods_suffix_txt = File.join(Pod::Config.instance.project_root,"output_pods_suffix.txt")
  output_pods_uniq_txt = File.join(Pod::Config.instance.project_root,"output_pods_uniq.txt")
  ignore_array = ["bundle","mp3"]
  resources_path = File.join(File.dirname(File.dirname(File.dirname(__FILE__))),"resources")
  shell_file = File.join(resources_path,"Pods-check-deduplication-resources.sh")
  #ruby 调用shell 文件、命令传入
  # stdout shell 脚本输出的文本
  # status 退出的状态
  stdout, status = Open3.capture2('/bin/sh',
                                  "#{shell_file}",
                                  "#{input_file}",
                                  "#{output_pods_suffix_txt}",
                                  "#{output_pods_uniq_txt}",
                                  "#{ignore_array}")

  #重复资源 抛出异常
  if status.to_i != 0
    raise "由于权限不足,请手动创建 后重试"
  else #重复资源,警告
    raise "由于权限不足,请手动创建 后重试"

  end
end