merge with diaspora and resolved a conflict

This commit is contained in:
Ariel Zavala 2010-09-16 20:42:45 -04:00
commit 0be3314e0a
18 changed files with 258 additions and 59 deletions

View file

@ -147,13 +147,13 @@ To install Git on **Mac OS X**, run the following:
### Rubygems ### Rubygems
On **Ubuntu**, run the following: On **Ubuntu** 10.04, run the following:
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz sudo add-apt-repository ppa:maco.m/ruby
tar -xf rubygems-1.3.7.tgz sudo apt-get update
cd rubygems-1.3.7 sudo apt-get install rubygems
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem This PPA is maintained by an Ubuntu Developer. For Ubuntu 10.10, this version of rubygems is in the repositories.
On **Fedora**, run the following: On **Fedora**, run the following:
@ -164,7 +164,7 @@ On **Mac OS X**, RubyGems comes preinstalled; however, you might need to update
### Bundler ### Bundler
After RubyGems is updated, simply run `sudo gem install bundler` to get Bundler. After RubyGems is updated, simply run `sudo gem install bundler` to get Bundler. If you're using Ubuntu repository .debs, bundler is found at /var/lib/gems/1.8/bin/bundle
## Getting Diaspora ## Getting Diaspora
@ -184,6 +184,8 @@ If you installed the Ubuntu package, MongoDB should already be running (if not,
If you installed the Fedora package, MongoDB will need to be started via `service mongodb start`. If you installed the binary manually, run `sudo mongod` from where mongo is installed to start mongo. If you installed the Fedora package, MongoDB will need to be started via `service mongodb start`. If you installed the binary manually, run `sudo mongod` from where mongo is installed to start mongo.
If you installed the OsX package through "brew", MongoDB will need to be started via `sudo launchctl load /Library/LaunchDaemons/org.mongodb.mongod.plist`. (before you have to go to /Library/LaunchDaemons and add a symlink to /usr/local/Cellar/mongodb/1.6.2-x86_64/org.mongodb.mongod.plist)
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. 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 app server ### Run the app server
@ -201,9 +203,9 @@ Diaspora's test suite uses [rspec](http://rspec.info/), a behavior driven testin
We are maintaining a [public tracker project](http://www.pivotaltracker.com/projects/61641) and a [roadmap](https://github.com/diaspora/diaspora/wiki/Roadmap). Also, you can file [bug reports](https://github.com/diaspora/diaspora/issues) right here on github. We are maintaining a [public tracker project](http://www.pivotaltracker.com/projects/61641) and a [roadmap](https://github.com/diaspora/diaspora/wiki/Roadmap). Also, you can file [bug reports](https://github.com/diaspora/diaspora/issues) right here on github.
Ongoing discussion: Ongoing discussion:
- [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev) - [Diaspora Developer Google Group](http://groups.google.com/group/diaspora-dev)
- [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss) - [Diaspora Discussion Google Group](http://groups.google.com/group/diaspora-discuss)
- [Diaspora Q&A site](http://diaspora.shapado.com/)
- [#diaspora-dev](irc://irc.freenode.net/#diaspora-dev) - [#diaspora-dev](irc://irc.freenode.net/#diaspora-dev)
More general info and updates about the project can be found on our [blog](http://joindiaspora.com), [twitter](http://twitter.com/joindiaspora). Also, be sure to join the official [mailing list](http://http://eepurl.com/Vebk). More general info and updates about the project can be found on our [blog](http://joindiaspora.com), [twitter](http://twitter.com/joindiaspora). Also, be sure to join the official [mailing list](http://http://eepurl.com/Vebk).

View file

@ -26,9 +26,15 @@ class AspectsController < ApplicationController
def destroy def destroy
@aspect = Aspect.find_by_id params[:id] @aspect = Aspect.find_by_id params[:id]
@aspect.destroy
flash[:notice] = "You are no longer sharing the aspect called #{@aspect.name}." begin
respond_with :location => aspects_url current_user.drop_aspect @aspect
flash[:notice] = "#{@aspect.name} was successfully removed."
rescue RuntimeError => e
flash[:error] = e.message
end
respond_with :location => aspects_manage_path
end end
def show def show

View file

@ -7,4 +7,12 @@ module AspectsHelper
def link_for_aspect( aspect ) def link_for_aspect( aspect )
link_to aspect.name, aspect link_to aspect.name, aspect
end end
def remove_link( aspect )
if aspect.people.size == 0
link_to "remove", aspect, :method => :delete
else
"<span class='grey' title='Aspect not empty'>remove</span>"
end
end
end end

View file

@ -65,6 +65,15 @@ class User
Aspect.create(opts) Aspect.create(opts)
end end
def drop_aspect( aspect )
if aspect.people.size == 0
aspect.destroy
else
raise "Aspect not empty"
end
end
def move_friend( opts = {}) def move_friend( opts = {})
return true if opts[:to] == opts[:from] return true if opts[:to] == opts[:from]
friend = Person.first(:_id => opts[:friend_id]) friend = Person.first(:_id => opts[:friend_id])

View file

@ -11,7 +11,7 @@
%h1=t('.requests') %h1=t('.requests')
.requests .requests
%ul %ul.dropzone
- for request in @remote_requests - for request in @remote_requests
%li.requested_person{:id => request.person.id, :request_id => request.id} %li.requested_person{:id => request.person.id, :request_id => request.id}
= person_image_tag(request.person) = person_image_tag(request.person)
@ -20,7 +20,7 @@
%h1=t('.ignore_remove') %h1=t('.ignore_remove')
%li.remove %li.remove
%ul %ul.dropzone
- content_for :publish do - content_for :publish do
= link_to(t('.add_a_new_aspect'), "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => t('.add_a_new_aspect')) = link_to(t('.add_a_new_aspect'), "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => t('.add_a_new_aspect'))
@ -34,12 +34,12 @@
.aspect_name .aspect_name
%h1{:contenteditable => true}= aspect.name %h1{:contenteditable => true}= aspect.name
.tools %ul.tools
= link_to t('.add_a_new_friend'), "#add_request_pane_#{aspect.id}", :class => 'add_request_button' %li= link_to t('.add_a_new_friend'), "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
| %li= link_to t('.show'), aspect_path(aspect)
= link_to t('.show'), aspect_path(aspect) %li!= remove_link(aspect)
%ul{:id => aspect.id} %ul.dropzone{:id => aspect.id}
-if aspect.people.size < 1 -if aspect.people.size < 1
%li.grey Drag to add people %li.grey Drag to add people

View file

@ -7,6 +7,9 @@
%h5 DEBUG INFO %h5 DEBUG INFO
#debug_more{ :style => "display:none;" } #debug_more{ :style => "display:none;" }
%ul %ul
%li
%b
= GIT_INFO
%li %li
%b params %b params
= params.inspect = params.inspect
@ -14,3 +17,4 @@
%b websocket status %b websocket status
#debug #debug
.msg .msg

View file

@ -6,9 +6,9 @@
require File.expand_path('../boot', __FILE__) require File.expand_path('../boot', __FILE__)
require "action_controller/railtie" require 'action_controller/railtie'
require "action_mailer/railtie" require 'action_mailer/railtie'
require "active_resource/railtie" require 'active_resource/railtie'
# If you have a Gemfile, require the gems listed there, including any gems # If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler) Bundler.require(:default, Rails.env) if defined?(Bundler)

View file

@ -7,6 +7,7 @@
# Load the rails application # Load the rails application
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5 Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true
# Initialize the rails application # Initialize the rails application
Diaspora::Application.initialize! Diaspora::Application.initialize!

View file

@ -0,0 +1,6 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
GIT_INFO = `git show`

View file

@ -5,7 +5,7 @@
require 'em-websocket' require 'em-websocket'
require 'eventmachine' require 'eventmachine'
require "lib/diaspora/websocket" require 'lib/diaspora/websocket'
EM.next_tick { EM.next_tick {
Diaspora::WebSocket.initialize_channels Diaspora::WebSocket.initialize_channels

View file

@ -7,11 +7,11 @@
require "#{File.dirname(__FILE__)}/packages/essential" require '#{File.dirname(__FILE__)}/packages/essential'
require "#{File.dirname(__FILE__)}/packages/database" require '#{File.dirname(__FILE__)}/packages/database'
require "#{File.dirname(__FILE__)}/packages/server" require '#{File.dirname(__FILE__)}/packages/server'
require "#{File.dirname(__FILE__)}/packages/scm" require '#{File.dirname(__FILE__)}/packages/scm'
require "#{File.dirname(__FILE__)}/packages/ruby" require '#{File.dirname(__FILE__)}/packages/ruby'
policy :diaspora, :roles => [:tom,:backer] do policy :diaspora, :roles => [:tom,:backer] do
# requires :clean_dreamhost # requires :clean_dreamhost

View file

@ -62,7 +62,7 @@ module Diaspora
def receive_friend_request(friend_request) def receive_friend_request(friend_request)
Rails.logger.info("receiving friend request #{friend_request.to_json}") Rails.logger.info("receiving friend request #{friend_request.to_json}")
if request_from_me?(friend_request) if request_from_me?(friend_request) && self.aspect_by_id(friend_request.aspect_id)
aspect = self.aspect_by_id(friend_request.aspect_id) aspect = self.aspect_by_id(friend_request.aspect_id)
activate_friend(friend_request.person, aspect) activate_friend(friend_request.person, aspect)

View file

@ -22,6 +22,7 @@ namespace :db do
require 'db/seeds/backer' require 'db/seeds/backer'
create create
end end
end end
desc 'Delete the collections in the current RAILS_ENV database' desc 'Delete the collections in the current RAILS_ENV database'
@ -53,4 +54,22 @@ namespace :db do
Rake::Task['db:seed:dev'].invoke Rake::Task['db:seed:dev'].invoke
puts "you did it!" puts "you did it!"
end end
task :fix_diaspora_handle do
puts "fixing the people in this seed"
require 'config/environment'
people = Person.all( '$where' => "function(){
return this.diaspora_handle.charAt(this.diaspora_handle.length-1) == '@'
}")
people.each do |person|
if person.owner
puts "Resetting diaspora handle for #{person.owner.username}"
person.diaspora_handle = person.owner.diaspora_handle
person.save
end
end
puts "everything should be peachy"
end
end end

View file

@ -39,6 +39,7 @@ $(function() {
}); });
$(".aspect ul").droppable({ $(".aspect ul").droppable({
hoverClass: 'active',
drop: function(event, ui) { drop: function(event, ui) {
if ($(ui.draggable[0]).hasClass('requested_person')){ if ($(ui.draggable[0]).hasClass('requested_person')){
@ -69,6 +70,7 @@ $(function() {
}); });
$(".remove ul").droppable({ $(".remove ul").droppable({
hoverClass: 'active',
drop: function(event, ui) { drop: function(event, ui) {
if ($(ui.draggable[0]).hasClass('requested_person')){ if ($(ui.draggable[0]).hasClass('requested_person')){
@ -91,7 +93,7 @@ $(function() {
}); });
}); });
$(".aspect h1").live( 'click', function() { $(".aspect h1").live( 'focus', function() {
var $this = $(this); var $this = $(this);
var id = $this.closest("li").children("ul").attr("id"); var id = $this.closest("li").children("ul").attr("id");

View file

@ -513,20 +513,33 @@ h1.big_text {
.requests .aspect_name, .requests .aspect_name,
.remove .aspect_name { .remove .aspect_name {
position: relative; } position: relative; }
.aspect .aspect_name .tools, .aspect .aspect_name ul.tools,
.requests .aspect_name .tools, .requests .aspect_name ul.tools,
.remove .aspect_name .tools { .remove .aspect_name ul.tools {
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 0; right: 0;
display: inline; } display: inline;
.aspect .aspect_name:hover .tools, padding: 0;
.requests .aspect_name:hover .tools, margin: 0;
.remove .aspect_name:hover .tools { list-style: none; }
display: inline; } .aspect .aspect_name ul.tools li,
.aspect ul, .requests .aspect_name ul.tools li,
.requests ul, .remove .aspect_name ul.tools li {
.remove ul { display: inline;
margin-right: 1em; }
.aspect .aspect_name ul.tools li:last-child,
.requests .aspect_name ul.tools li:last-child,
.remove .aspect_name ul.tools li:last-child {
margin-right: 0; }
.aspect .grey,
.requests .grey,
.remove .grey {
color: #999999;
cursor: default; }
.aspect ul.dropzone,
.requests ul.dropzone,
.remove ul.dropzone {
min-height: 20px; min-height: 20px;
margin: 0; margin: 0;
margin-bottom: 25px; margin-bottom: 25px;
@ -534,6 +547,10 @@ h1.big_text {
border: 1px solid #cccccc; border: 1px solid #cccccc;
list-style: none; list-style: none;
padding: 15px; } padding: 15px; }
.aspect ul.dropzone.active,
.requests ul.dropzone.active,
.remove ul.dropzone.active {
background-color: #fafafa; }
.aspect .person, .aspect .person,
.aspect .requested_person, .aspect .requested_person,
.requests .person, .requests .person,
@ -574,14 +591,6 @@ h1.big_text {
-webkit-box-shadow: 0 1px 3px #333333; -webkit-box-shadow: 0 1px 3px #333333;
-moz-box-shadow: 0 2px 4px #333333; -moz-box-shadow: 0 2px 4px #333333;
opacity: 0.9; } opacity: 0.9; }
.aspect .person .grey,
.aspect .requested_person .grey,
.requests .person .grey,
.requests .requested_person .grey,
.remove .person .grey,
.remove .requested_person .grey {
font-style: italic;
color: #666666; }
#notification_badge { #notification_badge {
position: fixed; position: fixed;

View file

@ -678,17 +678,29 @@ h1.big_text
.aspect_name .aspect_name
:position relative :position relative
.tools ul.tools
:position absolute :position absolute
:top 10px :top 10px
:right 0 :right 0
:display inline :display inline
:padding 0
&:hover :margin 0
.tools :list
:style none
li
:display inline :display inline
:margin
:right 1em
ul &:last-child
:margin
:right 0
.grey
:color #999
:cursor default
ul.dropzone
:min-height 20px :min-height 20px
:margin 0 :margin 0
:bottom 25px :bottom 25px
@ -699,6 +711,10 @@ h1.big_text
:style none :style none
:padding 15px :padding 15px
&.active
:background
:color #fafafa
.person, .person,
.requested_person .requested_person
:display inline-block :display inline-block
@ -726,12 +742,6 @@ h1.big_text
:-moz-box-shadow 0 2px 4px #333 :-moz-box-shadow 0 2px 4px #333
:opacity 0.9 :opacity 0.9
.grey
:font
:style italic
:color #666
#notification_badge #notification_badge
:position fixed :position fixed
:bottom 0 :bottom 0

View file

@ -22,4 +22,31 @@ describe User do
@user.profile.image_url.should == "http://clown.com" @user.profile.image_url.should == "http://clown.com"
end end
end end
describe 'aspects' do
it 'should delete an empty aspect' do
@user.aspects.include?(@aspect).should == true
@user.drop_aspect(@aspect)
@user.reload
@user.aspects.include?(@aspect).should == false
end
it 'should not delete an aspect with friends' do
user2 = Factory.create(:user)
aspect2 = user2.aspect(:name => 'stuff')
user2.reload
aspect2.reload
friend_users(@user, Aspect.find_by_id(@aspect.id), user2, Aspect.find_by_id(aspect2.id))
@aspect.reload
@user.aspects.include?(@aspect).should == true
proc{@user.drop_aspect(@aspect)}.should raise_error /Aspect not empty/
@user.reload
@user.aspects.include?(@aspect).should == true
end
end
end end

96
ubuntu-setup.bash Normal file
View file

@ -0,0 +1,96 @@
#!/bin/bash
# Author : hemanth.hm@gmail.com
# Site : www.h3manth.com
# This script helps to setup diaspora.
#
# Set extented globbing
shopt -s extglob
# Check if the user has sudo privileges.
[[ $( id -u) ]] && echo "$(whoami) has no sudo permissions on this machine" && exit 1
# Install build tools
echo "Installing build tools.."
sudo apt-get -y --no-install-recommends install build-essential libxslt1.1 libxslt1-dev libxml2
echo "..Done installing build tools"
# Install Ruby 1.8.7
echo "Installing ruby-full Ruby 1.8.7.."
sudo apt-get -y --no-install-recommends install ruby-full
echo "..Done installing Ruby"
# Install Rake
echo "Installing rake.."
sudo apt-get -y --no-install-recommends install rake
echo "..Done installing rake"
# Get the current release and install mongodb
lsb=$(lsb_release -rs)
ver=${lsb//.+(0)/.}
repo="deb http://downloads.mongodb.org/distros/ubuntu ${ver} 10gen"
echo "Setting up MongoDB.."
echo "."
echo ${repo} | sudo tee -a /etc/apt/sources.list
echo "."
echo "Fetching keys.."
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "."
sudo apt-get update
echo "."
sudo apt-get -y --no-install-recommends install mongodb-stable
echo "Done installing monngodb-stable.."
# Install imagemagick
echo "Installing imagemagick.."
sudo apt-get -y --no-install-recommends install imagemagick libmagick9-dev
echo "Installed imagemagick.."
# Install git-core
echo "Installing git-core.."
sudo apt-get -y --no-install-recommends install git-core
echo "Installed git-core.."
# Setting up ruby gems
echo "Fetching and installing ruby gems.."
(
echo "."
cd /tmp
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
echo "."
tar -xf rubygems-1.3.7.tgz
echo "."
cd rubygems-1.3.7
echo "."
sudo ruby setup.rb
echo "."
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
echo "."
)
echo "Done installing the gems.."
# Install blunder
echo "Installing blunder.."
sudo gem install bundler
echo "Installed blunder.."
# Take a clone of Diaspora
(
echo "Clone diaspora source.."
git clone http://github.com/diaspora/diaspora.git
echo "Cloned the source.."
# Install extra gems
cd diaspora
echo "Installing more gems.."
sudo bundle install
echo "Installed."
# Install DB setup
echo "Seting up DB.."
rake db:seed:tom
echo "DB ready. Login -> tom and password -> evankorth. More details ./diaspora/db/seeds/tom.rb."
# Run appserver
echo "Starting server"
bundle exec thin start
)