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

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



25
26
27
28
29
30
31
32
33
34
# File 'lib/cocoapods-tj/command/bin/lib/lint.rb', line 25

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



17
18
19
20
21
22
23
# File 'lib/cocoapods-tj/command/bin/lib/lint.rb', line 17

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



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

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