Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
a4d7b25bac
8 changed files with 53 additions and 33 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
- socket_id: '1'
|
- port: '3001'
|
||||||
- socket_id: '2'
|
- port: '3002'
|
||||||
- socket_id: '3'
|
- port: '3003'
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,14 @@ end
|
||||||
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
|
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
|
||||||
|
|
||||||
config.each do |thin|
|
config.each do |thin|
|
||||||
id = thin["socket_id"]
|
id = thin["port"]
|
||||||
socket = "/tmp/thin_#{id}.sock"
|
#socket = "/tmp/thin_#{id}.sock"
|
||||||
dir = "/service/thin_#{id}"
|
dir = "/service/thin_#{port}"
|
||||||
flags = []
|
flags = []
|
||||||
flags << "-c /usr/local/app/diaspora" #directory to run from
|
flags << "-c /usr/local/app/diaspora" #directory to run from
|
||||||
flags << "-e production" #run in production mode
|
flags << "-e production" #run in production mode
|
||||||
flags << "-S #{socket}" #use a socket
|
#flags << "-S #{socket}" #use a socket
|
||||||
|
flags << "-p #{port}" #use a socket
|
||||||
execute "thin run" do
|
execute "thin run" do
|
||||||
command "mkdir -p #{dir} && echo '#!/bin/sh' > #{dir}/run && echo 'exec /usr/local/bin/ruby /usr/local/bin/thin start #{flags.join(" ")}' >> #{dir}/run"
|
command "mkdir -p #{dir} && echo '#!/bin/sh' > #{dir}/run && echo 'exec /usr/local/bin/ruby /usr/local/bin/thin start #{flags.join(" ")}' >> #{dir}/run"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,6 @@ end
|
||||||
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
|
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
|
||||||
template "/usr/local/nginx/conf/nginx.conf" do
|
template "/usr/local/nginx/conf/nginx.conf" do
|
||||||
source "nginx.conf.erb"
|
source "nginx.conf.erb"
|
||||||
variables :socket_paths => config.map{|thin| "/tmp/thin_#{thin["socket_id"]}.sock"}
|
#variables :socket_paths => config.map{|thin| "/tmp/thin_#{thin["socket_id"]}.sock"}
|
||||||
|
variables :ports => config.map{|thin| "thin["port"]"}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ http {
|
||||||
gzip_proxied any;
|
gzip_proxied any;
|
||||||
gzip_buffers 16 8k;
|
gzip_buffers 16 8k;
|
||||||
upstream thin_cluster {
|
upstream thin_cluster {
|
||||||
<% @socket_paths.each do |socket_path| %>
|
<% @ports.each do |port| %>
|
||||||
server unix:<%=socket_path%>;
|
server <%="localhost:#{port}"%>;
|
||||||
<% end %>
|
<% end %>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,6 @@ require File.expand_path('../application', __FILE__)
|
||||||
Haml::Template.options[:format] = :html5
|
Haml::Template.options[:format] = :html5
|
||||||
Haml::Template.options[:escape_html] = true
|
Haml::Template.options[:escape_html] = true
|
||||||
|
|
||||||
if File.exists?(File.expand_path("./config/fb_config.yml"))
|
|
||||||
# Load facebook connection application credentials
|
|
||||||
fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml")))
|
|
||||||
FB_API_KEY = fb_config['fb_api_key']
|
|
||||||
FB_SECRET = fb_config['fb_secret']
|
|
||||||
FB_APP_ID = fb_config['fb_app_id']
|
|
||||||
HOST = fb_config['host']
|
|
||||||
FACEBOOK = true
|
|
||||||
else
|
|
||||||
FACEBOOK = false
|
|
||||||
end
|
|
||||||
|
|
||||||
if File.exists?(File.expand_path("./config/languages.yml"))
|
if File.exists?(File.expand_path("./config/languages.yml"))
|
||||||
languages = YAML::load(File.open(File.expand_path("./config/languages.yml")))
|
languages = YAML::load(File.open(File.expand_path("./config/languages.yml")))
|
||||||
AVAILABLE_LANGUAGES = (languages['available'].length > 0) ? languages['available'] : { :en => 'English' }
|
AVAILABLE_LANGUAGES = (languages['available'].length > 0) ? languages['available'] : { :en => 'English' }
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ Diaspora::Application.configure do
|
||||||
|
|
||||||
# Disable Rails's static asset server
|
# Disable Rails's static asset server
|
||||||
# In production, Apache or nginx will already do this
|
# In production, Apache or nginx will already do this
|
||||||
#config.serve_static_assets = true
|
config.serve_static_assets = false
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
|
||||||
|
|
@ -50,29 +50,35 @@ var AspectEdit = {
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: "/requests/" + person.attr('data-guid'),
|
url: "/requests/" + person.attr('data-guid'),
|
||||||
data: {"accept" : true, "aspect_id" : dropzone.attr('data-aspect_id') },
|
data: {"accept" : true, "aspect_id" : dropzone.attr('data-aspect_id') },
|
||||||
success: function(data) {
|
success: function() { AspectEdit.onDeleteRequestSuccess(person); }
|
||||||
AspectEdit.decrementRequestsCounter();
|
|
||||||
person.removeClass('request');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
|
if (dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/aspects/move_friend/",
|
url: "/aspects/move_friend/",
|
||||||
data: {"friend_id" : person.attr('data-guid'),
|
data: {
|
||||||
|
"friend_id" : person.attr('data-guid'),
|
||||||
"from" : person.attr('data-aspect_id'),
|
"from" : person.attr('data-aspect_id'),
|
||||||
"to" : { "to" : dropzone.attr('data-aspect_id') }},
|
"to" : { "to" : dropzone.attr('data-aspect_id') }
|
||||||
success: function(data) {
|
},
|
||||||
person.attr('data-aspect_id', dropzone.attr('data-aspect_id'));
|
success: function() { AspectEdit.onMovePersonSuccess(person, dropzone); }
|
||||||
}});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dropzone.closest("ul").append(person);
|
dropzone.closest("ul").append(person);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onDeleteRequestSuccess: function(person) {
|
||||||
|
AspectEdit.decrementRequestsCounter();
|
||||||
|
person.removeClass('request');
|
||||||
|
},
|
||||||
|
|
||||||
|
onMovePersonSuccess: function(person, dropzone) {
|
||||||
|
person.attr('data-aspect_id', dropzone.attr('data-aspect_id'));
|
||||||
|
},
|
||||||
|
|
||||||
deletePersonFromAspect: function(person) {
|
deletePersonFromAspect: function(person) {
|
||||||
|
|
||||||
var person_id = person.attr('data-guid');
|
var person_id = person.attr('data-guid');
|
||||||
|
|
||||||
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
|
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,30 @@ describe("AspectEdit", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("onDropMove", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
$('#jasmine_content').html(
|
||||||
|
'<li class="person request ui-draggable" data-aspect_id="4cae42e12367bca44e000005" data-guid="4cae42d32367bca44e000003" style="top: 0px; left: 0px; ">' +
|
||||||
|
' <img alt="Alexander Hamiltom" class="avatar" data-person_id="4cae42d32367bca44e000003" src="/images/user/default.png?1287542906" original-title="Alexander Hamiltom" style="height: 70px; width: 70px; opacity: 1; display: inline; ">' +
|
||||||
|
'</li>' +
|
||||||
|
'<ul data-aspect_id="4cdae5ed2367bc30aa000007" class="dropzone ui-droppable">' +
|
||||||
|
'</ul>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
describe("when dragging a friend request", function() {
|
||||||
|
it("deletes the request object", function() {
|
||||||
|
spyOn($, "ajax");
|
||||||
|
AspectEdit.initialize();
|
||||||
|
$.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')});
|
||||||
|
expect($.ajax).toHaveBeenCalled();
|
||||||
|
var args = $.ajax.calls[0].args[0];
|
||||||
|
expect(args["type"]).toEqual("DELETE");
|
||||||
|
expect(args["url"]).toEqual("/requests/4cae42d32367bca44e000003");
|
||||||
|
expect(args["data"]).toEqual({"accept" : true, "aspect_id" : "4cdae5ed2367bc30aa000007" });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("decrementRequestsCounter", function() {
|
describe("decrementRequestsCounter", function() {
|
||||||
describe("when there is one request", function() {
|
describe("when there is one request", function() {
|
||||||
it("removes the counter from the new requests div", function() {
|
it("removes the counter from the new requests div", function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue