Class: Pod::Command::Setup

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command

options, parse, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Setup

Returns a new instance of Setup.



18
19
20
# File 'lib/cocoapods/command/setup.rb', line 18

def initialize(argv)
  super unless argv.empty?
end

Class Method Details



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cocoapods/command/setup.rb', line 4

def self.banner
%{Setup CocoaPods environment:

    $ pod setup

Creates a directory at `~/.cocoapods' which will hold your spec-repos.
This is where it will create a clone of the public `master' spec-repo from:

    https://github.com/CocoaPods/Specs

If the clone already exists, it will ensure that it points to the correct
remote.}
end

Instance Method Details

#add_master_repo_commandObject



26
27
28
# File 'lib/cocoapods/command/setup.rb', line 26

def add_master_repo_command
  @command ||= Repo.new(ARGV.new(['add', 'master', master_repo_url]))
end

#master_repo_urlObject



22
23
24
# File 'lib/cocoapods/command/setup.rb', line 22

def master_repo_url
  'git://github.com/CocoaPods/Specs.git'
end

#runObject



34
35
36
37
38
39
40
# File 'lib/cocoapods/command/setup.rb', line 34

def run
  if (config.repos_dir + 'master').exist?
    update_master_repo_remote_command.run
  else
    add_master_repo_command.run
  end
end

#update_master_repo_remote_commandObject



30
31
32
# File 'lib/cocoapods/command/setup.rb', line 30

def update_master_repo_remote_command
  @command ||= Repo.new(ARGV.new(['set-url', 'master', master_repo_url]))
end