Merge pull request #750 from dcutting/master

Added support for pre-download over Mercurial.
This commit is contained in:
Eloy Durán
2013-01-23 01:59:51 -08:00
14 changed files with 39 additions and 14 deletions

View File

@@ -136,6 +136,8 @@ module Pod
return unless name && params
if params.key?(:git)
GitSource.new(name, params)
elsif params.key?(:hg)
MercurialSource.new(name, params)
elsif params.key?(:svn)
SvnSource.new(name, params)
elsif params.key?(:podspec)
@@ -193,7 +195,7 @@ module Pod
end
end
class GitSource < AbstractExternalSource
class DownloaderSource < AbstractExternalSource
def copy_external_source_into_sandbox(sandbox, platform)
UI.info("->".green + " Pre-downloading: '#{name}'") do
target = sandbox.root + name
@@ -206,7 +208,9 @@ module Pod
end
end
end
end
class GitSource < DownloaderSource
def description
"from `#{@params[:git]}'".tap do |description|
description << ", commit `#{@params[:commit]}'" if @params[:commit]
@@ -216,20 +220,15 @@ module Pod
end
end
class SvnSource < AbstractExternalSource
def copy_external_source_into_sandbox(sandbox, platform)
UI.info("->".green + " Pre-downloading: '#{name}'") do
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Downloader.for_target(sandbox.root + name, @params)
downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
if local_pod = sandbox.installed_pod_named(name, platform)
local_pod.downloaded = true
end
class MercurialSource < DownloaderSource
def description
"from `#{@params[:hg]}'".tap do |description|
description << ", revision `#{@params[:revision]}'" if @params[:revision]
end
end
end
class SvnSource < DownloaderSource
def description
"from `#{@params[:svn]}'".tap do |description|
description << ", folder `#{@params[:folder]}'" if @params[:folder]

Binary file not shown.

View File

@@ -1 +1 @@
Second commit
Removed comments.

View File

@@ -1 +1,2 @@
data/MercurialSource.podspec.i
data/README.i

View File

@@ -0,0 +1 @@
1 3d2759856083e6dbb5b5d0b702aa625b5b21a10a

Binary file not shown.

View File

@@ -0,0 +1 @@
1 3d2759856083e6dbb5b5d0b702aa625b5b21a10a

View File

@@ -1,2 +1,2 @@
1
3
commit

Binary file not shown.

View File

@@ -0,0 +1,10 @@
Pod::Spec.new do |s|
s.name = "MercurialSource"
s.version = "0.0.1"
s.summary = "A short description of MercurialSource."
s.homepage = "http://EXAMPLE/MercurialSource"
s.license = 'MIT (example)'
s.author = { "Dan Cutting" => "dcutting@gmail.com" }
s.source = { :git => "http://EXAMPLE/MercurialSource.git", :tag => "0.0.1" }
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end

View File

@@ -106,6 +106,19 @@ module Pod
path.should.exist?
end
it "marks a LocalPod as downloaded if it's from MercurialSource" do
dependency = Dependency.new("MercurialSource", :hg => fixture('mercurial-repo'))
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
@sandbox.installed_pod_named('MercurialSource', Platform.ios).downloaded.should.be.true
end
it "creates a copy of the podspec (MercurialSource)" do
dependency = Dependency.new("MercurialSource", :hg => fixture('mercurial-repo'))
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
path = @sandbox.root + 'Local Podspecs/MercurialSource.podspec'
path.should.exist?
end
it "marks a LocalPod as downloaded if it's from SvnSource" do
dependency = Dependency.new("SvnSource", :svn => "file://#{fixture('subversion-repo/trunk')}")
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)