Class: Pod::Command::Repo::Add

Inherits:
Pod::Command::Repo show all
Defined in:
lib/cocoapods/command/repo.rb

Instance Method Summary collapse

Methods inherited from Pod::Command::Repo

#dir

Methods included from Executable

#executable, execute_command

Methods inherited from Pod::Command

options, parse, report_error, run

Methods included from Pod::Config::Mixin

#config

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

#runObject



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