Sha256: 3d5906dba165c7686c9e97efd8395565b6592591d294dfa0aa04354ce20cc93f

Contents?: true

Size: 1.62 KB

Versions: 14

Compression:

Stored size: 1.62 KB

Contents

require 'cocoapods'

require_relative '../source/util/sh_util'

module OrmDev
  class Command
    class Lint < Command
      self.summary = '验证本地插件pod仓库。'
      self.description = <<-DESC
          插件管理.
          验证本地插件。
      DESC

      self.arguments = [
          CLAide::Argument.new('PATH', false)
      ]

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

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

      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

      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
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ormdev-0.2.3 lib/ormdev/command/lint.rb
ormdev-0.2.2 lib/ormdev/command/lint.rb
ormdev-0.2.1 lib/ormdev/command/lint.rb
ormdev-0.2.0 lib/ormdev/command/lint.rb
ormdev-0.1.8 lib/ormdev/command/lint.rb
ormdev-0.1.7 lib/ormdev/command/lint.rb
ormdev-0.1.6 lib/ormdev/command/lint.rb
ormdev-0.1.5 lib/ormdev/command/lint.rb
ormdev-0.1.4 lib/ormdev/command/lint.rb
ormdev-0.1.3 lib/ormdev/command/lint.rb
ormdev-0.1.2 lib/ormdev/command/lint.rb
ormdev-0.1.1 lib/ormdev/command/lint.rb
ormdev-0.1.0 lib/ormdev/command/lint.rb
ormdev-0.0.9 lib/ormdev/command/lint.rb