Sha256: f6a69a89e9864984ad6fdd05d76e6cb07c8985fc5f5a761f3a71abcf83b918f4

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

module Pod
    class Command
      class Repo < Command
        class Push < Repo
            attr_accessor :skip_validate, :skip_build
            
            class_alias_method(:old_options, :options)
            def self.options
              [
                ['--skip-validate', '跳过整个验证,不验证推送的podspec文件,默认为验证'],
                ['--skip-build', '跳过编译过程,还是会校验pod下载和依赖']
              ].concat(self.old_options)
            end

            # 调用原方法的两种方式
            old_validate_podspec_files = instance_method(:validate_podspec_files)
            define_method(:validate_podspec_files) do
                Pod::Validator.skip_build = @skip_build
                old_validate_podspec_files.bind(self).() unless @skip_validate
                Pod::Validator.skip_build = false
            end

            alias_method :old_check_repo_status, :check_repo_status
            def check_repo_status
                old_check_repo_status unless @skip_validate
            end
        end
      end
    end
end

module Pod
  class Validator
    class_attr_accessor :skip_build

    alias_method :old_build_pod, :build_pod
    def build_pod
      old_build_pod unless Pod::Validator.skip_build
    end

    alias_method :old_test_pod, :test_pod
    def test_pod
      old_test_pod unless Pod::Validator.skip_build
    end

    alias_method :old_validated?, :validated?
    def validated?
      Pod::Validator.skip_build || old_validated?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cocoapods-util-0.2.2 lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb
cocoapods-util-0.2.1 lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb
cocoapods-util-0.2.0 lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb
cocoapods-util-0.0.16 lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb
cocoapods-util-0.0.15 lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb