Sha256: f51a30bad4611bfbf53a8edb91eff2e25dd3ba8503c3bee9ca61c6e844cbc884

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

module Pod
  class Command
    class Trunk
      class RemoveOwner < Trunk
        self.summary = 'Remove an owner from a pod'
        self.description = <<-DESC
          Removes the user with specified `OWNER-EMAIL` from being an owner
          of the given `POD`.
          An ‘owner’ is a registered user whom is allowed to make changes to a
          pod, such as pushing new versions and adding and removing other ‘owners’.
        DESC

        self.arguments = [
          CLAide::Argument.new('POD', true),
          CLAide::Argument.new('OWNER-EMAIL', true),
        ]

        def initialize(argv)
          @pod = argv.shift_argument
          @email = argv.shift_argument
          super
        end

        def validate!
          super
          unless token
            help! 'You need to register a session first.'
          end
          unless @pod && @email
            help! 'Specify the pod name and the owner’s email address.'
          end
        end

        def run
          json = json(request_path(:delete, "pods/#{@pod}/owners/#{@email}", auth_headers))
          UI.labeled 'Owners', json.map { |o| "#{o['name']} <#{o['email']}>" }
        rescue REST::Error => e
          raise Informative, "There was an error removing #{@email} from " \
                                   "#{@pod} on trunk: #{e.message}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cocoapods-trunk-1.0.0.rc.1 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-1.0.0.beta.4 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-1.0.0.beta.3 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-1.0.0.beta.2 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-1.0.0.beta.1 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-0.6.4 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-0.6.3 lib/pod/command/trunk/remove_owner.rb
cocoapods-trunk-0.6.2 lib/pod/command/trunk/remove_owner.rb