class Pod::Command::Bin::Lib::Lint

Public Class Methods

new(argv) click to toggle source
Calls superclass method Pod::Command::Bin::new
# File lib/cocoapods-lhj-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
options() click to toggle source

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

Calls superclass method
# File lib/cocoapods-lhj-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

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-lhj-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