Skip to content

Commit

Permalink
basic federation profile testing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwell committed Feb 14, 2012
1 parent 8307514 commit 54e8040
Show file tree
Hide file tree
Showing 8 changed files with 999 additions and 8 deletions.
6 changes: 6 additions & 0 deletions FederationProcfile
@@ -0,0 +1,6 @@
web1: env RAILS_ENV=integration1 bundle exec rails s -p 3001
worker1: env RAILS_ENV=integration1 VVERBOSE=1 QUEUE=* bundle exec rake resque:work
redis1: env RAILS_ENV=integration1 redis-server ./redis-integration1.conf
web2: env RAILS_ENV=integration2 bundle exec rails s -p 3002
worker2: env RAILS_ENV=integration2 VVERBOSE=1 QUEUE=* bundle exec rake resque:work
redis2: env RAILS_ENV=integration2 redis-server ./redis-integration2.conf
2 changes: 1 addition & 1 deletion app/controllers/publics_controller.rb
Expand Up @@ -24,9 +24,9 @@ class PublicsController < ApplicationController
respond_to :html
respond_to :xml, :only => :post

caches_page :host_meta, :if => Proc.new{ Rails.env == 'production'}

layout false
caches_page :host_meta

def hcard
@person = Person.find_by_guid_and_closed_account(params[:guid], false)
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/status_messages_controller.rb
Expand Up @@ -53,6 +53,11 @@ def create
receiving_services = Service.titles(services)

current_user.dispatch_post(@status_message, :url => short_post_url(@status_message.guid), :service_types => receiving_services)

@status_message.photos.each do |photo|
current_user.dispatch_post(photo)
end

current_user.participate!(@status_message)

if coming_from_profile_page? # if this is a post coming from a profile page
Expand Down
8 changes: 6 additions & 2 deletions config/database.yml.example
Expand Up @@ -26,11 +26,15 @@ common: &common
development:
<<: *common
database: diaspora_development

production:
<<: *common
database: diaspora_production

test:
<<: *common
database: "diaspora_test<%= ENV['TEST_ENV_NUMBER'] %>"
integration1:
<<: *common
database: diaspora_integration1
integration2:
<<: *common
database: diaspora_integration2
2 changes: 2 additions & 0 deletions config/initializers/resque.rb
Expand Up @@ -8,6 +8,8 @@
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
elsif AppConfig[:redis_url]
Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379)
elsif ENV['RAILS_ENV']== 'integration2'
Resque.redis = Redis.new(:host => 'localhost', :port => 6380)
end
end

Expand Down
12 changes: 7 additions & 5 deletions lib/tasks/db.rake
Expand Up @@ -20,12 +20,14 @@ namespace :db do
task :prepare => :environment do
abcs = ActiveRecord::Base.configurations
envs = abcs.keys.select{ |k| k.include?("integration") }
puts envs.inspect
envs.each do |env|
ActiveRecord::Base.establish_connection(env)
ActiveRecord::Base.connection.drop_database(abcs[env]["database"])
ActiveRecord::Base.connection.create_database(abcs[env]["database"])
ActiveRecord::Base.establish_connection(env)
ActiveRecord::Migrator.migrate("db/migrate", nil)
puts "dropping #{env}..."
`cd #{Rails.root} && RAILS_ENV=#{env} bundle exec rake db:drop`
puts "creating #{env}..."
`cd #{Rails.root} && RAILS_ENV=#{env} bundle exec rake db:create`
puts "migrating #{env}..."
`cd #{Rails.root} && RAILS_ENV=#{env} bundle exec rake db:migrate`
end
end
end
Expand Down

0 comments on commit 54e8040

Please sign in to comment.