Class: Pod::Source

Inherits:
Object
  • Object
show all
Extended by:
Executable
Defined in:
lib/cocoapods/sources_manager.rb

Defined Under Namespace

Classes: Manager

Updating Sources collapse

Methods included from Executable

capture_command, capture_command!, executable, execute_command, which, which!

Instance Method Details

#repo_git(args, include_error: false) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cocoapods/sources_manager.rb', line 166

def repo_git(args, include_error: false)
  Executable.capture_command('git', ['-C', repo] + args,
                             :capture => include_error ? :merge : :out,
                             :env => {
                               'GIT_CONFIG' => nil,
                               'GIT_DIR' => nil,
                               'GIT_WORK_TREE' => nil,
                             }
                            ).
    first.strip
end

#update_git_repo(show_output = false) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/cocoapods/sources_manager.rb', line 178

def update_git_repo(show_output = false)
  Config.instance.with_changes(:verbose => show_output) do
    args = %W(-C #{repo} fetch origin)
    args.push('--progress') if show_output
    git!(args)
    current_branch = git!(%W(-C #{repo} rev-parse --abbrev-ref HEAD)).strip
    git!(%W(-C #{repo} reset --hard origin/#{current_branch}))
  end
rescue
  raise Informative, 'CocoaPods was not able to update the ' \
    "`#{name}` repo. If this is an unexpected issue " \
    'and persists you can inspect it running ' \
    '`pod repo update --verbose`'
end