Sha256: 94ed19bf7327c7277cedb1c5de99aeb8929d062acba34bd5dc2f6d8bad6852cd

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Pod
  class Command
    class Trunk
      # @CocoaPods 1.0.0.beta.1
      #
      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
          body = {
            :in_favor_of => @in_favor_of,
          }.to_json
          response = request_path(:patch, "pods/#{@name}/deprecated", body, 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

2 entries across 2 versions & 1 rubygems

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