Merge branch 'master' of github.com:diaspora/diaspora into production

This commit is contained in:
Raphael 2010-09-17 11:57:36 -07:00
commit ce2260b747
7 changed files with 26 additions and 13 deletions

View file

@ -3,7 +3,7 @@ You are welcome to contribute, add and extend Diaspora however you see fit. We
We need you to fill out a [contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq) before we can accept your patches. The agreement gives Diaspora joint ownership of the patch so the copyright isn't scattered. You can find it [here](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq).
All commits must be tested, and after each commit, all tests should be green before a pull request is sent. Please write your tests in Rspec or Test-Unit.
All commits must be tested, and after each commit, all tests should be green before a pull request is sent. Please write your tests in Rspec.
GEMS: We would like to keep external dependencies unduplicated. We're using Nokogiri, and Mongomapper, and EM::HttpRequest as much as possible. We have a few gems in the project we'd rather not use, but if you can, use dependencies we already have.
@ -195,9 +195,15 @@ If you installed the OsX package through "brew", MongoDB will need to be started
Diaspora will not run unless mongo is running. Mongo will not run by default, and will need to be started every time you wish to use or run the test suite for Diaspora.
### Run the server
`./script/server` will start both thin and the websocket server. If you want to run a different app server, you will have to run them separately. See below for instructions.
### Run the app server
Once mongo is running and bundler has finished, run `bundle exec thin start` from the root Diaspora directory. This will start the app server in development mode[.](http://bit.ly/9mwtUw)
### Run the websocket server
run `bundle exec ruby ./script/websocket_server` to start the websocket server on port 8080. Change the port in config/app_config.yml.
### Logging in
Run `rake db:seed:tom`, then login with user `tom` and password `evankorth`. More details in db/seeds/tom.rb.

View file

@ -7,13 +7,6 @@ class UsersController < ApplicationController
before_filter :authenticate_user!, :except => [:new, :create]
respond_to :html
respond_to :json, :only => :show
def show
@user = User.find_by_id params[:id]
@user_profile = @user.person.profile
respond_with @user
end
def edit
@user = current_user
@ -23,7 +16,7 @@ class UsersController < ApplicationController
end
def update
@user = User.find_by_id params[:id]
@user = current_user
prep_image_url(params[:user])
@user.update_profile params[:user]

View file

@ -85,7 +85,7 @@ class Person
local_person
elsif !identifier.include?("localhost") && !opts[:local]
begin
puts "begin finger"
Rails.logger.info("Webfingering #{identifier}")
f = Redfinger.finger(identifier)
rescue SocketError => e
raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/

View file

@ -6,7 +6,7 @@
Diaspora::Application.routes.draw do
resources :people, :only => [:index, :show, :destroy]
resources :users, :except => [:create, :new]
resources :users, :except => [:create, :new, :show]
resources :status_messages, :only => [:create, :destroy, :show]
resources :comments, :except => [:index]
resources :requests, :except => [:edit, :update]

5
script/server Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
mkdir -p -v log/thin/
bundle exec ruby ./script/websocket_server.rb&
bundle exec thin start $@

View file

@ -19,6 +19,7 @@ def process_message
end
begin
EM.run {
Diaspora::WebSocket.initialize_channels
@ -35,6 +36,13 @@ end
ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) }
}
end
puts "Websocket server started."
process_message
}
rescue RuntimeError => e
raise e unless e.message.include?("no acceptor")
puts "Are you sure the websocket server isn't already running?"
puts "Just start thin with bundle exec thin start."
Process.exit
end

View file

@ -17,8 +17,9 @@ describe Diaspora::WebSocket do
end
it 'The queued job should reach Magent' do
Magent.should_receive(:push)
@post.socket_to_uid(@user.id, :aspect_ids => @aspect.id)
channel = Magent::GenericChannel.new('websocket')
channel.message_count.should == 1
end
end