Class: Pod::Command::Repo::Add
- Inherits:
-
Pod::Command::Repo
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Repo
- Pod::Command::Repo::Add
- Defined in:
- lib/cocoapods/command/repo.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Add
constructor
A new instance of Add.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Repo
Methods included from Executable
Methods inherited from Pod::Command
options, parse, report_error, run
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Add
Returns a new instance of Add.
22 23 24 25 |
# File 'lib/cocoapods/command/repo.rb', line 22 def initialize(argv) @name, @url, @branch = argv.shift_argument, argv.shift_argument, argv.shift_argument super end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/cocoapods/command/repo.rb', line 34 def run UI.section("Cloning spec repo `#{@name}` from `#{@url}`#{" (branch `#{@branch}`)" if @branch}") do config.repos_dir.mkpath Dir.chdir(config.repos_dir) { git!("clone '#{@url}' #{@name}") } Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch SourcesManager.check_version_information(dir) end end |
#validate! ⇒ Object
27 28 29 30 31 32 |
# File 'lib/cocoapods/command/repo.rb', line 27 def validate! super unless @name && @url help! "Adding a repo needs a `NAME` and a `URL`." end end |