Commit c4f3a5df authored by Fabio Pelosin's avatar Fabio Pelosin

[Subversion] Improved head support.

parent 4d85f946
...@@ -4,25 +4,26 @@ module Pod ...@@ -4,25 +4,26 @@ module Pod
executable :svn executable :svn
def download def download
if options[:revision] svn %|checkout "#{reference_url}" "#{target_path}"|
download_revision
elsif options[:tag]
download_tag
else
download_head
end
end end
def download_head def download_head
svn %|checkout "#{url}/#{options[:folder]}" "#{target_path}"| svn %|checkout "#{trunk_url}" "#{target_path}"|
end end
def download_revision def reference_url
svn %|checkout "#{url}/#{options[:folder]}" -r "#{options[:revision]}" "#{target_path}"| result = url.dup
result << '/' << options[:folder] if options[:folder]
result << '/tags/' << options[:tag] if options[:tag]
result << '" -r "' << options[:revision] if options[:revision]
result
end end
def download_tag def trunk_url
svn %|checkout "#{url}/tags/#{options[:tag]}/#{options[:folder]}" "#{target_path}"| result = url.dup
result << '/' << options[:folder] if options[:folder]
result << '/trunk'
result
end end
end end
end end
......
...@@ -253,6 +253,7 @@ module Pod ...@@ -253,6 +253,7 @@ module Pod
end end
describe "for Subversion" do describe "for Subversion" do
it "check's out a specific revision" do it "check's out a specific revision" do
@pod.top_specification.stubs(:source).returns( @pod.top_specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}", :revision => '1' :svn => "file://#{fixture('subversion-repo')}", :revision => '1'
...@@ -270,8 +271,18 @@ module Pod ...@@ -270,8 +271,18 @@ module Pod
downloader.download downloader.download
(@pod.root + 'README').read.strip.should == 'tag 1' (@pod.root + 'README').read.strip.should == 'tag 1'
end end
it "check's out the head version" do
@pod.top_specification.stubs(:source).returns(
:svn => "file://#{fixture('subversion-repo')}", :revision => '1'
)
downloader = Downloader.for_pod(@pod)
downloader.download_head
(@pod.root + 'README').read.strip.should == 'unintersting'
end
end end
describe "for HTTP" do describe "for HTTP" do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
......
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