Sha256: 170b819dfd458b34cbee8a626ce44a93c581ae900bfc013057e4d943df5cb70c

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module Pod
  class Command
    class Trunk
      class Deprecate < Trunk
        self.summary = 'Deprecates a pod.'
        self.arguments = [
          CLAide::Argument.new('NAME', true),
        ]

        def options
          [
            ['--in-favor-of=OTHER_NAME', 'The pod to deprecate this pod in favor of.'],
          ].concat(super)
        end

        def initialize(argv)
          @name = argv.shift_argument
          @in_favor_of = argv.option('in-favor-of')
          super
        end

        def validate!
          super
          help! 'Please specify a pod name.' unless @name
        end

        def run
          json = deprecate
          print_messages(json['data_url'], json['messages'])
        end

        def deprecate
          response = request_path(:patch, "pods/#{@name}/deprecated", auth_headers)
          url = response.headers['location'].first
          json(request_url(:get, url, default_headers))
        rescue REST::Error => e
          raise Informative, 'There was an error deprecating the pod ' \
                                   "via trunk: #{e.message}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-trunk-1.0.0.beta.1 lib/pod/command/trunk/deprecate.rb