Module: Pod::Source::Manager::AnkerArExtensions

Included in:
Pod::Source::Manager
Defined in:
lib/cocoapods_plugin.rb

Overview

Use prepend instead of alias_method to safely monkey-patch without infinite recursion when the plugin is loaded more than once.

Instance Method Summary collapse

Instance Method Details

#create_source_with_url(url) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cocoapods_plugin.rb', line 65

def create_source_with_url(url)
  require 'coding_ar_util'

  name = name_for_url(url)
  if CodingArUtil.coding_ar_service?(url)
    Command::Repo::AddCodingAr.parse([name, url]).run
  else
    super
  end

  source = source_with_url(url)
  raise "Unable to create a source with URL #{url}" unless source
  source
end

#source_from_path(path) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cocoapods_plugin.rb', line 48

def source_from_path(path)
  @sources_by_path ||= Hash.new do |hash, key|
    hash[key] = case
                when key.basename.to_s == Pod::TrunkSource::TRUNK_REPO_NAME
                  TrunkSource.new(key)
                when (key + '.url').exist?
                  CDNSource.new(key)
                when (key + '.coding_ar_url').exist?
                  CodingArSource.new(key)
                else
                  Source.new(key)
                end
  end

  @sources_by_path[path]
end