Class: Pod::Command::RepoSq::Add
- Inherits:
-
Pod::Command::RepoSq
- Object
- Pod::Command
- Pod::Command::RepoSq
- Pod::Command::RepoSq::Add
- Defined in:
- lib/pod/command/repo_sq/add.rb
Overview
Subclass of Pod::Command::RepoSq Provides support for the ‘pod repo-sq add` which adds a Square SDK repository to the user’s cocoapods local repositories store.
Constant Summary collapse
- 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.
'https://sdk.squareup.com/ios'
Instance Method Summary collapse
-
#initialize(argv) ⇒ Add
constructor
A new instance of Add.
-
#run ⇒ Object
Registers a Square SDK repository on the current user CocoapodsRepoSq::RepositoryStore.
-
#validate! ⇒ Object
Validates that all required arguments are present: ‘NAME`, `USERNAME` and `PASSWORD`.
Constructor Details
#initialize(argv) ⇒ Add
Returns a new instance of Add.
50 51 52 53 54 55 56 |
# 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 |
Instance Method Details
#run ⇒ Object
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.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# 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! ⇒ Object
Validates that all required arguments are present: ‘NAME`, `USERNAME` and `PASSWORD`
60 61 62 63 64 65 |
# 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 |