50 lines
1.8 KiB
Ruby
50 lines
1.8 KiB
Ruby
# Copyright (c) 2010, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3. See
|
|
# the COPYRIGHT file.
|
|
|
|
|
|
|
|
require 'config/environment'
|
|
|
|
def set_app_config username
|
|
current_config = YAML.load(Rails.root.join('config', 'app_config.yml')).symbolize_keys
|
|
current_config[Rails.env] ||= {}
|
|
current_config[Rails.env][:pod_url] = "#{username}.joindiaspora.com"
|
|
current_config[:default][:pod_url] = "#{username}.joindiaspora.com"
|
|
file = File.new(Rails.root.join('config','app_config.yml'),'w')
|
|
file.write(current_config.to_yaml)
|
|
file.close
|
|
end
|
|
|
|
set_app_config "tom"
|
|
require 'config/initializers/_load_app_config.rb'
|
|
|
|
|
|
# Create seed user
|
|
user = User.instantiate!( :email => "tom@tom.joindiaspora.com",
|
|
:username => "tom",
|
|
:password => "evankorth",
|
|
:password_confirmation => "evankorth",
|
|
:person => {
|
|
:profile => { :first_name => "Alexander", :last_name => "Hamiltom",
|
|
:image_url => "http://tom.joindiaspora.com/images/user/tom.jpg"}}
|
|
)
|
|
user.person.save!
|
|
|
|
user2 = User.instantiate!( :email => "korth@tom.joindiaspora.com",
|
|
:password => "evankorth",
|
|
:password_confirmation => "evankorth",
|
|
:username => "korth",
|
|
:person => {:profile => { :first_name => "Evan", :last_name => "Korth",
|
|
:image_url => "http://tom.joindiaspora.com/images/user/korth.jpg"}})
|
|
|
|
user2.person.save!
|
|
|
|
# friending users
|
|
aspect = user.aspect(:name => "other dudes")
|
|
request = user.send_friend_request_to(user2, aspect)
|
|
reversed_request = user2.accept_friend_request( request.id, user2.aspect(:name => "presidents").id )
|
|
user.receive reversed_request.to_diaspora_xml
|
|
user.aspect(:name => "Presidents")
|
|
|
|
|