Class: Pod::Command::Bin::Spec::Create
  
  
  
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  #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
  
  
  
  
  
  
  
  
  
  #binary_source, #code_source_list, #sources_manager, #sources_option, #valid_sources
  
  
  
  
  
  
  Constructor Details
  
    
  
  
    #initialize(argv)  ⇒ Create 
  
  
  
  
    
Returns a new instance of Create.
   
 
  
  
    
      
21
22
23
24
25
26
27 
     | 
    
      # File 'lib/cocoapods-mtxx-bin/command/bin/spec/create.rb', line 21
def initialize(argv)
  @platforms = argv.option('platforms', 'ios')
  @allow_overwrite = argv.flag?('overwrite', true)
  @template_podspec = argv.option('template-podspec')
  @podspec = argv.shift_argument
  super
end
     | 
  
 
  
 
  
    Class Method Details
    
      
  
  
    .options  ⇒ Object 
  
  
  
  
    
      
13
14
15
16
17
18
19 
     | 
    
      # File 'lib/cocoapods-mtxx-bin/command/bin/spec/create.rb', line 13
def self.options
  [
    ['--platforms=ios', '生成二进制 spec 支持的平台'],
    ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
    ['--no-overwrite', '不允许覆盖']
  ].concat(super)
end
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #run  ⇒ Object 
  
  
  
  
    
      
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 
     | 
    
      # File 'lib/cocoapods-mtxx-bin/command/bin/spec/create.rb', line 29
def run
  UI.puts "开始读取 podspec 文件...\n"
  code_spec = Pod::Specification.from_file(spec_file)
  if template_spec_file
    template_spec = Pod::Specification.from_file(template_spec_file)
  end
  if binary_spec && !@allow_overwrite
    UI.warn "二进制 podspec 文件 #{binary_spec_files.first} 已存在.\n"
  else
    UI.puts "开始生成二进制 podspec 文件...\n"
    spec_file = create_binary_spec_file(code_spec, template_spec)
    UI.puts "创建二进制 podspec 文件 #{spec_file} 成功.\n".green
  end
end
     | 
  
 
    
      
  
  
    #spec_file  ⇒ Object 
  
  
  
  
    
      
56
57
58
59
60
61
62
63
64
65
66
67
68 
     | 
    
      # File 'lib/cocoapods-mtxx-bin/command/bin/spec/create.rb', line 56
def spec_file
  @spec_file ||= begin
    if @podspec
      find_spec_file(@podspec)
    else
      if code_spec_files.empty?
        raise Informative, '当前目录下没有找到可用源码 podspec.'
      end
      code_spec_files.first
    end
  end
end
     | 
  
 
    
      
  
  
    #template_spec_file  ⇒ Object 
  
  
  
  
    
      
46
47
48
49
50
51
52
53
54 
     | 
    
      # File 'lib/cocoapods-mtxx-bin/command/bin/spec/create.rb', line 46
def template_spec_file
  @template_spec_file ||= begin
    if @template_podspec
      find_spec_file(@template_podspec)
    else
      binary_template_spec_file
    end
  end
end
     |