Commit e71b2188 authored by Eloy Durán's avatar Eloy Durán

Update previous patch to match code-style.

E.g. Use Pathname API.
parent fef5dada
......@@ -75,12 +75,11 @@ module Pod
end
# If the archive only contained a folder, move its contents to the target (#727)
contents = Dir[target_path.to_s+"/*"]
contents.delete(full_filename.to_s)
if contents.count == 1 && File.directory?(contents[0]) then
Dir[contents[0]+"/*"].each do |thing|
FileUtils.move thing, target_path
end
contents = target_path.children
contents.delete(full_filename)
entry = contents.first
if contents.count == 1 && entry.directory?
FileUtils.move(entry.children, target_path)
end
end
......
......@@ -92,15 +92,13 @@ describe Pod::Downloader::Http do
downloader.download
# Archive contains one folder, which contains 49 items. The archive is 1, and the
# parent folder that we moved stuff out of is 1.
Dir[downloader.target_path.to_s+"/*"].count.should == 49 + 1 + 1
Dir.glob(downloader.target_path + '*').count.should == 49 + 1 + 1
downloader = Pod::Downloader.for_pod(stub_pod_with_source(
:http => 'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.zip'
))
downloader.download
# Archive contains 4 files, and the archive is 1
Dir[downloader.target_path.to_s+"/*"].count.should == 4 + 1
Dir.glob(downloader.target_path + '*').count.should == 4 + 1
end
end
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