class Pod::Command::RepoSq::Add

Subclass of {RepoSq} Provides support for the `pod repo-sq add` which adds a Square SDK repository to the user's cocoapods local repositories store.

Constants

DEFAULT_URL

Default Square SDK repositories server URL. This URL can be customized by providing a fourth undocumented parameter to this command but not intended for public use.

@return [String]

default Square SDK repositories server URL.

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/pod/command/repo_sq/add.rb, line 50
def initialize(argv)
  @name = argv.shift_argument
  @username = argv.shift_argument
  @password = argv.shift_argument
  @url = argv.shift_argument || DEFAULT_URL
  super
end

Public Instance Methods

run() click to toggle source

Registers a Square SDK repository on the current user {CocoapodsRepoSq::RepositoryStore}. It checks that the user name and password are valid and that the repository exists on the Square server.

# File lib/pod/command/repo_sq/add.rb, line 71
def run
  section = "Adding Square SDK repository `#{@name}`"
  UI.section(section) do
    repository = repository_store.register(@name, @username, @password, @url)
    begin
      repository.update_specs
    rescue => e
      repository_store.remove(@name)
      raise Informative, "Could not add `#{@name}`.\n" \
                         "#{e.class.name}: #{e.message}"
    end
  end
end
validate!() click to toggle source

Validates that all required arguments are present: `NAME`, `USERNAME` and `PASSWORD`

Calls superclass method
# File lib/pod/command/repo_sq/add.rb, line 60
def validate!
  super
  unless @name && @username && @password
    help! 'Adding a Square SDK repository needs a `NAME`, `USERNAME` and a `PASSWORD`.'
  end
end