class Pod::Command::Setup

def self.options

def self.options
  [["--push", "Use this option to enable push access once granted"]].concat(super)
end

def add_master_repo

Returns:
  • (void) -
def add_master_repo
  @command ||= Repo::Add.parse(['master', url, 'master']).run
end

def initialize(argv)

def initialize(argv)
  @push_option  = argv.flag?('push')
  super
end

def master_repo_dir

Returns:
  • (Pathname) - the directory of the master repo.
def master_repo_dir
  SourcesManager.master_repo_dir
end

def master_repo_is_push?

Returns:
  • (Bool) - if the master repo is already configured in push mode.
def master_repo_is_push?
  return false unless master_repo_dir.exist?
  Dir.chdir(master_repo_dir) do
    url = git('config --get remote.origin.url')
    url.chomp == read_write_url
  end
end

def migrate_repos

Returns:
  • (void) -
def migrate_repos
  config.repos_dir.mkpath
  Dir.foreach old_master_repo_dir.parent do |repo_dir|
    source_repo_dir = old_master_repo_dir.parent + repo_dir
    target_repo_dir = config.repos_dir + repo_dir
    if not repo_dir =~ /\.+/ and source_repo_dir != config.repos_dir
      FileUtils.mv source_repo_dir, target_repo_dir
    end
  end
end

def old_master_repo_dir

Returns:
  • (Pathname) - the directory of the old master repo.
def old_master_repo_dir
  Pathname.new('~/.cocoapods/master').expand_path
end

def push?

Returns:
  • (String) - whether the master repo should be set up in push mode.
def push?
  @push ||= (@push_option || master_repo_is_push?)
end

def read_only_url

Returns:
  • (String) - the read only url of the master repo.
def read_only_url
  'https://github.com/CocoaPods/Specs.git'
end

def read_write_url

Returns:
  • (String) - the read-write url of the master repo.
def read_write_url
  'git@github.com:CocoaPods/Specs.git'
end

def run

def run
  UI.section "Setting up CocoaPods master repo" do
    if master_repo_dir.exist?
      set_master_repo_url
      set_master_repo_branch
      update_master_repo
    elsif old_master_repo_dir.exist?
      migrate_repos
    else
      add_master_repo
    end
  end
  access_type = push? ? "push" : "read-only"
  UI.puts "Setup completed (#{access_type} access)".green
end

def set_master_repo_branch

Returns:
  • (void) -

Other tags:
    Note: - This is not needed anymore as it was used for CocoaPods 0.6
def set_master_repo_branch
  Dir.chdir(master_repo_dir) do
    git("checkout master")
  end
end

def set_master_repo_url

Returns:
  • (void) -
def set_master_repo_url
  Dir.chdir(master_repo_dir) do
    git("remote set-url origin '#{url}'")
  end
end

def update_master_repo

Returns:
  • (void) -
def update_master_repo
  SourcesManager.update('master', true)
end

def url

Returns:
  • (String) - the url to use according to whether push mode should
def url
  (push?) ? read_write_url : read_only_url
end