Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (29 sloc) 1.539 kb
IOS_SIM_APP_SUPPORT = File.expand_path("~/Library/Application Support/iPhone Simulator")
SAVED_PHOTOS_ALBUM_FIXTURE_ROOT = File.expand_path("../Spec/fixtures/iOS-simulator-saved-photos-album", __FILE__)
# This assumes the photo album Apple provides doesn't change in future updates!
desc "Removes existing photo albums from the iOS simulator and moves the test fixtures in place."
task :prepare_ios_sim_photo_album_fixtures do
sdk_version = ENV['SDK']
media_dir = File.join(IOS_SIM_APP_SUPPORT, "#{sdk_version}/Media")
if sdk_version && File.exist?(media_dir)
puts "This will erase the current contents of the photo library. Continue? [Y/n]"
answer = $stdin.gets.strip
if answer.empty? || answer.downcase == 'y'
# First remove existing photos
rm_rf File.join(media_dir, 'DCIM')
rm_rf File.join(media_dir, 'PhotoData')
rm_rf File.join(media_dir, 'Photos')
# Now copy Apple supplied photo album
cp_r File.join(IOS_SIM_APP_SUPPORT, 'User/Media/Photos'), media_dir
# And the 'saved photos' album fixture
cp_r File.join(SAVED_PHOTOS_ALBUM_FIXTURE_ROOT, 'DCIM'), media_dir
cp_r File.join(SAVED_PHOTOS_ALBUM_FIXTURE_ROOT, 'PhotoData'), media_dir
end
else
puts "Please supply a valid SDK version for which the photo fixtures should be prepared."
puts "E.g.: $ rake prepare_ios_sim_photo_album_fixtures SDK=4.2"
exit 1
end
end
desc "Shortcut for :prepare_ios_sim_photo_album_fixtures"
task :prepare_fixtures => :prepare_ios_sim_photo_album_fixtures
Jump to Line
Something went wrong with that request. Please try again.