Commit bc2473ea authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #672 from lassebm/podfile-svn-pre-download

Subversion pre-download support
parents c261fe98 5f12ff7c
...@@ -136,6 +136,8 @@ module Pod ...@@ -136,6 +136,8 @@ module Pod
return unless name && params return unless name && params
if params.key?(:git) if params.key?(:git)
GitSource.new(name, params) GitSource.new(name, params)
elsif params.key?(:svn)
SvnSource.new(name, params)
elsif params.key?(:podspec) elsif params.key?(:podspec)
PodspecSource.new(name, params) PodspecSource.new(name, params)
elsif params.key?(:local) elsif params.key?(:local)
...@@ -214,6 +216,29 @@ module Pod ...@@ -214,6 +216,29 @@ module Pod
end end
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
end
end
def description
"from `#{@params[:svn]}'".tap do |description|
description << ", folder `#{@params[:folder]}'" if @params[:folder]
description << ", tag `#{@params[:tag]}'" if @params[:tag]
description << ", revision `#{@params[:revision]}'" if @params[:revision]
end
end
end
# can be http, file, etc # can be http, file, etc
class PodspecSource < AbstractExternalSource class PodspecSource < AbstractExternalSource
def copy_external_source_into_sandbox(sandbox, _) def copy_external_source_into_sandbox(sandbox, _)
......
...@@ -9,16 +9,20 @@ module Pod ...@@ -9,16 +9,20 @@ module Pod
def download def download
UI.section(' > Exporting subversion repo', '', 3) do UI.section(' > Exporting subversion repo', '', 3) do
svn! %|export "#{reference_url}" "#{target_path}"| svn! %|#{export_subcommand} "#{reference_url}" "#{target_path}"|
end end
end end
def download_head def download_head
UI.section(' > Exporting subversion repo', '', 3) do UI.section(' > Exporting subversion repo', '', 3) do
svn! %|export "#{trunk_url}" "#{target_path}"| svn! %|#{export_subcommand} "#{trunk_url}" "#{target_path}"|
end end
end end
def export_subcommand
result = 'export --non-interactive --trust-server-cert'
end
def reference_url def reference_url
result = url.dup result = url.dup
result << '/' << options[:folder] if options[:folder] result << '/' << options[:folder] if options[:folder]
......
K 10
svn:author
V 3
lbm
K 8
svn:date
V 27
2012-12-03T12:33:18.707618Z
K 7
svn:log
V 24
Added SvnSource podspec
END
...@@ -106,6 +106,19 @@ module Pod ...@@ -106,6 +106,19 @@ module Pod
path.should.exist? path.should.exist?
end 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)
@sandbox.installed_pod_named('SvnSource', Platform.ios).downloaded.should.be.true
end
it "creates a copy of the podspec (SvnSource)" do
dependency = Dependency.new("SvnSource", :svn => "file://#{fixture('subversion-repo/trunk')}")
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
path = @sandbox.root + 'Local Podspecs/SvnSource.podspec'
path.should.exist?
end
it "creates a copy of the podspec (PodspecSource)" do it "creates a copy of the podspec (PodspecSource)" do
dependency = Dependency.new("Reachability", :podspec => fixture('integration/Reachability/Reachability.podspec').to_s) dependency = Dependency.new("Reachability", :podspec => fixture('integration/Reachability/Reachability.podspec').to_s)
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios) 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