rebasing
This commit is contained in:
parent
7ef89acf81
commit
0c8aca3ef8
4 changed files with 10 additions and 8 deletions
|
|
@ -371,8 +371,8 @@ DEPENDENCIES
|
||||||
em-websocket!
|
em-websocket!
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
fastercsv (= 1.5.4)
|
fastercsv (= 1.5.4)
|
||||||
haml (= 3.0.25)
|
|
||||||
fog
|
fog
|
||||||
|
haml (= 3.0.25)
|
||||||
http_accept_language!
|
http_accept_language!
|
||||||
jammit (= 0.5.4)
|
jammit (= 0.5.4)
|
||||||
jasmine!
|
jasmine!
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ class Photo < Post
|
||||||
require 'carrierwave/orm/activerecord'
|
require 'carrierwave/orm/activerecord'
|
||||||
mount_uploader :image, ImageUploader
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
xml_reader :remote_photo_path
|
xml_attr :remote_photo_path
|
||||||
xml_reader :remote_photo_name
|
xml_attr :remote_photo_name
|
||||||
|
|
||||||
xml_reader :caption
|
xml_reader :caption
|
||||||
xml_reader :status_message_id
|
xml_reader :status_message_id
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,14 @@ namespace :migrations do
|
||||||
Photo.all.each do |photo|
|
Photo.all.each do |photo|
|
||||||
unless photo.remote_photo_path
|
unless photo.remote_photo_path
|
||||||
# extract root
|
# extract root
|
||||||
pod_url = photo.person.url
|
#
|
||||||
pod_url.chop! if pod_url[-1,1] == '/'
|
pod = URI::parse(photo.person.url)
|
||||||
|
pod_url = "#{pod.scheme}://#{pod.host}"
|
||||||
|
|
||||||
if photo.image.url
|
if photo.image.url
|
||||||
remote_path = "#{pod_url}#{photo.image.url}"
|
remote_path = "#{pod_url}#{photo.image.url}"
|
||||||
else
|
else
|
||||||
|
puts pod_url
|
||||||
remote_path = "#{pod_url}#{photo.remote_photo_path}/#{photo.remote_photo_name}"
|
remote_path = "#{pod_url}#{photo.remote_photo_path}/#{photo.remote_photo_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ describe 'migrations' do
|
||||||
@fixture_name = File.join(File.dirname(__FILE__), '..', '..', 'fixtures', @fixture_filename)
|
@fixture_name = File.join(File.dirname(__FILE__), '..', '..', 'fixtures', @fixture_filename)
|
||||||
|
|
||||||
@photos = []
|
@photos = []
|
||||||
|
@user = Factory.create(:user)
|
||||||
|
|
||||||
5.times do |n|
|
5.times do |n|
|
||||||
if n % 2 == 0
|
if n % 2 == 0
|
||||||
photo = Photo.instantiate(:user_file => File.open(@fixture_name))
|
photo = Photo.diaspora_initialize(:user_file => File.open(@fixture_name), :person => @user.person)
|
||||||
photo.remote_photo_path = nil
|
photo.remote_photo_path = nil
|
||||||
photo.remote_photo_name = nil
|
photo.remote_photo_name = nil
|
||||||
photo.person = make_user.person
|
|
||||||
else
|
else
|
||||||
photo = Photo.new
|
photo = Photo.new
|
||||||
photo.person = Factory(:person, :url => "https://remote.com/")
|
photo.person = Factory(:person, :url => "https://remote.com/")
|
||||||
|
|
@ -35,7 +35,7 @@ describe 'migrations' do
|
||||||
end
|
end
|
||||||
|
|
||||||
@photos[n] = photo
|
@photos[n] = photo
|
||||||
@photos[n].save
|
@photos[n].save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue