Class: Pod::Command::Setup

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

Setup steps collapse

Private helpers collapse

Instance Method Summary collapse

Methods included from Executable

capture_command, executable, execute_command, which, which!

Methods inherited from Pod::Command

#ensure_master_spec_repo_exists!, #initialize, options, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

This class inherits a constructor from Pod::Command

Class Method Details

.read_only_urlString

Returns the read only url of the master repo.

Returns:

  • (String)

    the read only url of the master repo.



92
93
94
# File 'lib/cocoapods/command/setup.rb', line 92

def self.read_only_url
  'https://github.com/CocoaPods/Specs.git'
end

Instance Method Details

#add_master_repovoid

This method returns an undefined value.

Adds the master repo from the remote.



52
53
54
55
# File 'lib/cocoapods/command/setup.rb', line 52

def add_master_repo
  cmd = ['master', url, 'master', '--progress']
  Repo::Add.parse(cmd).run
end

#master_repo_dirPathname

Returns the directory of the master repo.

Returns:

  • (Pathname)

    the directory of the master repo.



98
99
100
# File 'lib/cocoapods/command/setup.rb', line 98

def master_repo_dir
  config.sources_manager.master_repo_dir
end

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cocoapods/command/setup.rb', line 20

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
    else
      add_master_repo
    end
  end

  UI.puts 'Setup completed'.green
end

#set_master_repo_branchvoid

Note:

This is not needed anymore as it was used for CocoaPods 0.6 release candidates.

This method returns an undefined value.

Sets the repo to the master branch.



73
74
75
76
77
# File 'lib/cocoapods/command/setup.rb', line 73

def set_master_repo_branch
  Dir.chdir(master_repo_dir) do
    git %w(checkout master)
  end
end

#set_master_repo_urlvoid

This method returns an undefined value.

Sets the url of the master repo according to whether it is push.



42
43
44
45
46
# File 'lib/cocoapods/command/setup.rb', line 42

def set_master_repo_url
  Dir.chdir(master_repo_dir) do
    git('remote', 'set-url', 'origin', url)
  end
end

#update_master_repovoid

This method returns an undefined value.

Updates the master repo against the remote.



61
62
63
64
# File 'lib/cocoapods/command/setup.rb', line 61

def update_master_repo
  show_output = !config.silent?
  config.sources_manager.update('master', show_output)
end

#urlString

Returns the url to use according to whether push mode should be enabled.

Returns:

  • (String)

    the url to use according to whether push mode should be enabled.



86
87
88
# File 'lib/cocoapods/command/setup.rb', line 86

def url
  self.class.read_only_url
end