Commit 0fb0d9a4 authored by Eloy Durán's avatar Eloy Durán

Merge pull request #750 from dcutting/master

Added support for pre-download over Mercurial.
parents f89d71f5 e4eda40f
......@@ -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]
......
Second commit
\ No newline at end of file
Removed comments.
\ No newline at end of file
1 3d2759856083e6dbb5b5d0b702aa625b5b21a10a
1 3d2759856083e6dbb5b5d0b702aa625b5b21a10a
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
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment