Class: Pod::Command::Bin::Lib::Lint

Inherits:
Pod::Command::Bin::Lib show all
Defined in:
lib/cocoapods-tdf-bin/command/bin/lib/lint.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, #valid_sources

Constructor Details

#initialize(argv) ⇒ Lint

Returns a new instance of Lint.



28
29
30
31
32
33
34
35
36
37
# File 'lib/cocoapods-tdf-bin/command/bin/lib/lint.rb', line 28

def initialize(argv)
  @loose_options = argv.flag?('loose-options')
  @code_dependencies = argv.flag?('code-dependencies')
  @sources = argv.option('sources') || []
  @allow_prerelease = argv.flag?('allow-prerelease')
  @podspec = argv.shift_argument
  super

  @additional_args = argv.remainder!
end

Class Method Details

.optionsObject

lib lint 不会下载 source,所以不能进行二进制 lint 要 lint 二进制版本,需要进行 spec lint,此 lint 会去下载 source



20
21
22
23
24
25
26
# File 'lib/cocoapods-tdf-bin/command/bin/lib/lint.rb', line 20

def self.options
  [
    ['--code-dependencies', '使用源码依赖进行 lint'],
    ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
    ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
  ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
end

Instance Method Details

#runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cocoapods-tdf-bin/command/bin/lib/lint.rb', line 39

def run
  Podfile.execute_with_bin_plugin do
    Podfile.execute_with_allow_prerelease(@allow_prerelease) do
      Podfile.execute_with_use_binaries(!@code_dependencies) do
        argvs = [
          @podspec || code_spec_files.first,
          "--sources=#{sources_option(@code_dependencies, @sources)}",
          *@additional_args
        ]

        if @loose_options
          argvs << '--allow-warnings'
          if code_spec&.all_dependencies&.any?
            argvs << '--use-libraries'
          end
        end

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