Class: OrmDev::Command::Lint

Inherits:
OrmDev::Command show all
Defined in:
lib/ormdev/command/lint.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Lint

Returns a new instance of Lint.



23
24
25
26
27
# File 'lib/ormdev/command/lint.rb', line 23

def initialize(argv)
  @podspec_file = argv.shift_argument
  @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' }
  super
end

Class Method Details

.optionsObject



18
19
20
21
# File 'lib/ormdev/command/lint.rb', line 18

def self.options
  [
  ].concat(super)
end

Instance Method Details

#runObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/ormdev/command/lint.rb', line 41

def run
  super
  OrmDev::LogUtil.info '[插件管理] 验证Pod'.green
  @spec = Pod::Specification.from_file(@podspec_path)
  OrmDev::SHUtil.run_command("pod cache clean #{@spec.name} --all",'清除Pod缓存',false)
  pod_lint_command = ''
  pod_lint_command << "#{@spec.name}_SOURCE=1"
  pod_lint_command << ' pod lib lint --sources=orm,master --allow-warnings --use-libraries --verbose'
  OrmDev::SHUtil.run_command(pod_lint_command,'更验证Pod',false)
end

#validate!Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ormdev/command/lint.rb', line 29

def validate!
  super
  if @podspec_file
    help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file
    @podspec_path = @podspec_file
  else
    raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0
    raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1
    @podspec_path = @podspec_files.first
  end
end