Merge branch 'master' of http://github.com/sarahmei/diaspora
This commit is contained in:
commit
1ab536bf04
6 changed files with 57 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ class DevUtilitiesController < ApplicationController
|
|||
bkr_info.each do |backer|
|
||||
backer_email = "#{backer['username']}@#{backer['username']}.joindiaspora.com"
|
||||
rel_hash = relationship_flow(backer_email)
|
||||
logger.info "Zombefriending #{backer['given_name']} #{backer['family_name']}"
|
||||
logger.info "Zombiefriending #{backer['given_name']} #{backer['family_name']}"
|
||||
logger.info "Calling send_friend_request with #{rel_hash[:friend]} and #{current_user.aspects.first}"
|
||||
current_user.send_friend_request_to(rel_hash[:friend], current_user.aspects.first)
|
||||
end
|
||||
|
|
@ -29,11 +29,6 @@ class DevUtilitiesController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def backer_info
|
||||
config = YAML.load_file(File.dirname(__FILE__) + '/../../config/deploy_config.yml')
|
||||
config['servers']['backer']
|
||||
end
|
||||
|
||||
def set_backer_number
|
||||
render :nothing => true
|
||||
seed_num_hash = {:seed_number => params[:number]}
|
||||
|
|
@ -43,7 +38,6 @@ class DevUtilitiesController < ApplicationController
|
|||
end
|
||||
|
||||
def set_profile_photo
|
||||
|
||||
render :nothing => true
|
||||
album = Album.create(:person => current_user.person, :name => "Profile Photos")
|
||||
current_user.raw_visible_posts << album
|
||||
|
|
@ -52,7 +46,7 @@ class DevUtilitiesController < ApplicationController
|
|||
backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i
|
||||
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase
|
||||
|
||||
@fixture_name = File.dirname(__FILE__) + "/../../public/images/user/#{username}.jpg"
|
||||
@fixture_name = File.join(File.dirname(__FILE__), "..", "..", "public", "images", "user", "#{username}.jpg")
|
||||
|
||||
photo = Photo.new(:person => current_user.person, :album => album)
|
||||
photo.image.store! File.open(@fixture_name)
|
||||
|
|
@ -71,4 +65,11 @@ class DevUtilitiesController < ApplicationController
|
|||
|
||||
render "shared/log"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def backer_info
|
||||
config = YAML.load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "deploy_config.yml"))
|
||||
config['servers']['backer']
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||
# Mayor.create(:name => 'Daley', :city => citie
|
||||
|
||||
require File.dirname(__FILE__) + '/../../config/environment'
|
||||
require File.join(File.dirname(__FILE__), "..", "..", "config", "environment")
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||
# Mayor.create(:name => 'Daley', :city => citie
|
||||
|
||||
require File.dirname(__FILE__) + '/../../config/environment'
|
||||
require File.join(File.dirname(__FILE__), "..", "..", "config", "environment")
|
||||
|
||||
def create
|
||||
|
||||
config = YAML.load_file(File.dirname(__FILE__) + '/../../config/deploy_config.yml')
|
||||
config = YAML.load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "deploy_config.yml"))
|
||||
backer_info = config['servers']['backer']
|
||||
|
||||
backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i
|
||||
|
|
@ -22,7 +22,7 @@ def create
|
|||
#set pod url
|
||||
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase
|
||||
set_app_config username
|
||||
require File.dirname(__FILE__) + '/../../config/initializers/_load_app_config.rb'
|
||||
require File.join(File.dirname(__FILE__), "..", "..", "config", "initializers", "_load_app_config.rb")
|
||||
|
||||
# Create seed user
|
||||
user = User.instantiate!(:email => "#{username}@#{username}.joindiaspora.com",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require File.dirname(__FILE__) + '/../../config/environment'
|
||||
require File.join(File.dirname(__FILE__), "..", "..", "config", "environment")
|
||||
|
||||
def set_app_config username
|
||||
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require File.dirname(__FILE__) + '/../../config/environment'
|
||||
require File.join(File.dirname(__FILE__), "..", "..", "config", "environment")
|
||||
|
||||
def set_app_config username
|
||||
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
|
||||
|
|
|
|||
42
spec/controllers/dev_utilities_controller_spec.rb
Normal file
42
spec/controllers/dev_utilities_controller_spec.rb
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
||||
|
||||
describe DevUtilitiesController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
@tom = Factory.create(:user, :email => "tom@tom.joindiaspora.org")
|
||||
sign_in :user, @tom
|
||||
end
|
||||
|
||||
describe "#zombiefriends" do
|
||||
it "succeeds" do
|
||||
get :zombiefriends
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "#set_profile_photo" do
|
||||
# In case anyone wants their config/backer_number.yml to still exist after running specs
|
||||
before do
|
||||
@backer_number_file = File.join(File.dirname(__FILE__), "..", "..", "config", "backer_number.yml")
|
||||
@temp_file = File.join(File.dirname(__FILE__), "..", "..", "config", "backer_number.yml-tmp")
|
||||
FileUtils.mv(@backer_number_file, @temp_file, :force => true)
|
||||
end
|
||||
after do
|
||||
if File.exists?(@temp_file)
|
||||
FileUtils.mv(@temp_file, @backer_number_file, :force => true)
|
||||
else
|
||||
FileUtils.rm_rf(@backer_number_file)
|
||||
end
|
||||
end
|
||||
it "succeeds" do
|
||||
get :set_backer_number, 'number' => '3'
|
||||
get :set_profile_photo
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue