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

Inherits:
Pod::Command::Bin::Lib show all
Defined in:
lib/cocoapods-bb-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.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods-bb-bin/command/bin/lib/lint.rb', line 32

def initialize(argv)
  @loose_options = argv.flag?('loose-options')
  @code_dependencies = argv.flag?('code-dependencies', true)
  @sources = argv.option('sources') || []
  @allow_prerelease = argv.flag?('allow-prerelease')
  @bb_env = argv.flag?('bb-env', false)
  @podspec = argv.shift_argument
  super
  @additional_args = argv.remainder!
  @verbose = argv.flag?('verbose', false)
end

Class Method Details

.optionsObject

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



23
24
25
26
27
28
29
30
# File 'lib/cocoapods-bb-bin/command/bin/lib/lint.rb', line 23

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

Instance Method Details

#runObject



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
73
74
75
76
# File 'lib/cocoapods-bb-bin/command/bin/lib/lint.rb', line 44

def run
  # @bb_env = false
  if @bb_env
    Podfile.execute_with_bin_plugin do
      Podfile.execute_with_use_binaries(!@code_dependencies) do
        build_bb_lint
      end
    end
  else
    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
end