Class: Pod::Command::Binary::Lint::Spec

Inherits:
Pod::Command::Binary::Lint show all
Defined in:
lib/cocoapods-tdfire-binary/command/lint/spec.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Binary

#binary_config, #first_podspec, #private_sources

Constructor Details

#initialize(argv) ⇒ Spec

Returns a new instance of Spec.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cocoapods-tdfire-binary/command/lint/spec.rb', line 23

def initialize(argv)
  @clean = argv.flag?('clean')
  @sources = argv.option('sources')
  @subspec = argv.option('subspec')
  @binary_first = argv.flag?('binary-first')

  @spec_file = first_podspec
  @spec_name = @spec_file.split('/').last.split('.').first unless @spec_file.nil?
  # unzip_framework
  super
end

Class Method Details

.optionsObject



14
15
16
17
18
19
20
21
# File 'lib/cocoapods-tdfire-binary/command/lint/spec.rb', line 14

def self.options
  [
      ['--sources', '私有源地址'],
      # ['--clean', '执行成功后,删除 zip 文件外的所有生成文件'],
      ['--binary-first', '二进制优先'],
      ['--subspec', 'lint 特定 subspec']
  ].concat(super)
end

Instance Method Details

#runObject

def unzip_framework framework = “#@spec_name.framework” zip_name = “#framework.zip” if File.exist?(zip_name) && !File.exist?(“#@spec_name.framework”) system “unzip #zip_name” end end



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cocoapods-tdfire-binary/command/lint/spec.rb', line 50

def run
  if @binary_first
    Pod::Tdfire::BinaryStateStore.unpublished_pods = Pod::Tdfire::BinaryStateStore.unpublished_pods + Array(@spec_name)
    Pod::Tdfire::BinaryStateStore.set_use_binary
  end

  argvs = [
      "--sources=#{@sources || Pod::Tdfire::BinaryUrlManager.private_cocoapods_url}",
      '--allow-warnings',
      '--use-libraries',
      '--verbose'
  ]

  argvs << "--subspec=#{@subspec}" unless @subspec.nil?

  lint= Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
  lint.validate!
  lint.run

  # system "rm -fr #{@spec_name}.framework " if @clean
end

#validate!Object



35
36
37
38
39
40
# File 'lib/cocoapods-tdfire-binary/command/lint/spec.rb', line 35

def validate!
  super
  help! '当前目录下没有podspec文件.' if @spec_file.nil?
  # framework = "#{@spec_name}.framework"
  # help! "当前目录下没有#{framework}文件" unless File.exist?(framework)
end