Trying to merge in the pivots changes that we want in master
This commit is contained in:
parent
0459631d47
commit
a23df47dbc
16 changed files with 36 additions and 129 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
protect_from_forgery :except => :receive
|
protect_from_forgery :except => :receive
|
||||||
layout 'application'
|
|
||||||
|
|
||||||
before_filter :set_friends_and_status, :count_requests
|
before_filter :set_friends_and_status, :count_requests
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,19 +23,5 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
|
||||||
@user = User.instantiate(params[:user])
|
|
||||||
|
|
||||||
if @user.created_at && @user.person.created_at
|
|
||||||
flash[:notice] = "Successfully signed up."
|
|
||||||
redirect_to root_path
|
|
||||||
else
|
|
||||||
render :action => 'new'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@user = User.new
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ class User
|
||||||
|
|
||||||
many :groups, :class_name => 'Group'
|
many :groups, :class_name => 'Group'
|
||||||
|
|
||||||
before_validation_on_create :assign_key
|
after_validation_on_create :setup_person
|
||||||
before_validation :do_bad_things
|
|
||||||
|
|
||||||
######## Making things work ########
|
######## Making things work ########
|
||||||
key :email, String
|
key :email, String
|
||||||
|
|
@ -297,12 +296,6 @@ class User
|
||||||
|
|
||||||
###Helpers############
|
###Helpers############
|
||||||
|
|
||||||
def self.instantiate( opts = {} )
|
|
||||||
opts[:person][:email] = opts[:email]
|
|
||||||
opts[:person][:serialized_key] = generate_key
|
|
||||||
User.create( opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
def terse_url
|
def terse_url
|
||||||
terse= self.url.gsub(/https?:\/\//, '')
|
terse= self.url.gsub(/https?:\/\//, '')
|
||||||
terse.gsub!(/www\./, '')
|
terse.gsub!(/www\./, '')
|
||||||
|
|
@ -310,10 +303,6 @@ class User
|
||||||
terse
|
terse
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_bad_things
|
|
||||||
self.password_confirmation = self.password
|
|
||||||
end
|
|
||||||
|
|
||||||
def visible_person_by_id( id )
|
def visible_person_by_id( id )
|
||||||
id = ensure_bson id
|
id = ensure_bson id
|
||||||
return self.person if id == self.person.id
|
return self.person if id == self.person.id
|
||||||
|
|
@ -329,6 +318,13 @@ class User
|
||||||
id = ensure_bson person.id
|
id = ensure_bson person.id
|
||||||
groups.select {|group| group.person_ids.include? id}
|
groups.select {|group| group.person_ids.include? id}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setup_person
|
||||||
|
self.person.serialized_key ||= generate_key.export
|
||||||
|
self.person.email = email
|
||||||
|
self.person.save!
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def assign_key
|
def assign_key
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
= f.label :email
|
= f.label :email
|
||||||
%br/
|
%br/
|
||||||
= f.text_field :email
|
= f.text_field :email
|
||||||
%p= f.submit "Resend confirmation instructions"
|
%p
|
||||||
|
= f.submit "Resend confirmation instructions"
|
||||||
= render :partial => "devise/shared/links"
|
= render :partial => "devise/shared/links"
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,6 @@
|
||||||
= f.label :password_confirmation
|
= f.label :password_confirmation
|
||||||
%br/
|
%br/
|
||||||
= f.password_field :password_confirmation
|
= f.password_field :password_confirmation
|
||||||
%p= f.submit "Change my password"
|
%p
|
||||||
|
= f.submit "Change my password"
|
||||||
= render :partial => "devise/shared/links"
|
= render :partial => "devise/shared/links"
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
= f.label :email
|
= f.label :email
|
||||||
%br/
|
%br/
|
||||||
= f.text_field :email
|
= f.text_field :email
|
||||||
%p= f.submit "Send me reset password instructions"
|
%p
|
||||||
|
= f.submit "Send me reset password instructions"
|
||||||
= render :partial => "devise/shared/links"
|
= render :partial => "devise/shared/links"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
%i (we need your current password to confirm your changes)
|
%i (we need your current password to confirm your changes)
|
||||||
%br/
|
%br/
|
||||||
= f.password_field :current_password
|
= f.password_field :current_password
|
||||||
%p= f.submit "Update"
|
%p
|
||||||
|
= f.submit "Update"
|
||||||
%h3 Cancel my account
|
%h3 Cancel my account
|
||||||
%p
|
%p
|
||||||
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}.
|
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
= f.password_field :password_confirmation
|
= f.password_field :password_confirmation
|
||||||
|
|
||||||
= f.fields_for :person do |p|
|
= f.fields_for :person do |p|
|
||||||
= p.hidden_field :url, :value => request.path
|
= p.hidden_field :url, :value => request.host
|
||||||
|
|
||||||
= p.fields_for :profile do |pr|
|
= p.fields_for :profile do |pr|
|
||||||
%p
|
%p
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
||||||
%p
|
%p
|
||||||
|
= f.label :email
|
||||||
= f.text_field :email
|
= f.text_field :email
|
||||||
%br
|
%p
|
||||||
|
= f.label :password
|
||||||
= f.password_field :password
|
= f.password_field :password
|
||||||
/%p
|
/%p
|
||||||
/- if devise_mapping.rememberable?
|
/- if devise_mapping.rememberable?
|
||||||
/ = f.check_box :remember_me
|
/ = f.check_box :remember_me
|
||||||
/ = f.label :remember_me
|
/ = f.label :remember_me
|
||||||
|
= f.submit "Sign in"
|
||||||
%p
|
%p
|
||||||
= f.submit "Sign in"
|
|
||||||
= render :partial => "devise/shared/links"
|
= render :partial => "devise/shared/links"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
= f.label :email
|
= f.label :email
|
||||||
%br/
|
%br/
|
||||||
= f.text_field :email
|
= f.text_field :email
|
||||||
%p= f.submit "Resend unlock instructions"
|
%p
|
||||||
|
= f.submit "Resend unlock instructions"
|
||||||
= render :partial => "devise/shared/links"
|
= render :partial => "devise/shared/links"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
%h1
|
%h1
|
||||||
welcome home,
|
welcome,
|
||||||
= current_user.profile.first_name
|
= current_user.profile.first_name
|
||||||
|
|
||||||
- @group.nil? ? group_id = nil : group_id = @group.id
|
- @group.nil? ? group_id = nil : group_id = @group.id
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ Diaspora::Application.routes.draw do |map|
|
||||||
|
|
||||||
#routes for devise, not really sure you will need to mess with this in the future, lets put default,
|
#routes for devise, not really sure you will need to mess with this in the future, lets put default,
|
||||||
#non mutable stuff in anohter file
|
#non mutable stuff in anohter file
|
||||||
devise_for :users, :path_names => {:sign_up => "get_to_the_choppa", :sign_in => "login", :sign_out => "logout"}
|
devise_for :users
|
||||||
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
|
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
|
||||||
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
|
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
|
||||||
match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
|
match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
|
||||||
|
|
||||||
#public routes
|
#public routes
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package :nginx do
|
package :nginx, :provides=> :webserver do
|
||||||
description 'Nginx HTTP server'
|
description 'Nginx HTTP server'
|
||||||
version '0.7.67'
|
version '0.7.67'
|
||||||
source "http://nginx.org/download/nginx-#{version}.tar.gz"
|
source "http://nginx.org/download/nginx-#{version}.tar.gz"
|
||||||
requires :nginx_dependencies
|
requires :nginx_dependencies
|
||||||
end
|
end
|
||||||
|
|
||||||
package :nginx_conf, :provides=> :webserver do
|
package :nginx_conf do
|
||||||
description 'Nginx conf file'
|
description 'Nginx conf file'
|
||||||
transfer "#{File.dirname(__FILE__)}/../conf/nginx.conf", '/usr/local/conf/nginx.conf', :render => true do
|
transfer "#{File.dirname(__FILE__)}/../conf/nginx.conf", '/usr/local/conf/nginx.conf', :render => true do
|
||||||
pre :install, "mkdir -p /usr/local/sbin/conf/"
|
pre :install, "mkdir -p /usr/local/sbin/conf/"
|
||||||
end
|
end
|
||||||
requires :nginx
|
|
||||||
end
|
end
|
||||||
|
|
||||||
package :nginx_dependencies do
|
package :nginx_dependencies do
|
||||||
|
|
@ -18,35 +17,3 @@ package :nginx_dependencies do
|
||||||
apt %w( libc6 libpcre3 libpcre3-dev libssl0.9.8)
|
apt %w( libc6 libpcre3 libpcre3-dev libssl0.9.8)
|
||||||
source "http://zlib.net/zlib-1.2.5.tar.gz"
|
source "http://zlib.net/zlib-1.2.5.tar.gz"
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
|
||||||
package :mongrel do
|
|
||||||
description 'Mongrel Application Server'
|
|
||||||
gem 'mongrel'
|
|
||||||
version '1.1.5'
|
|
||||||
end
|
|
||||||
|
|
||||||
package :mongrel_cluster, :provides => :appserver do
|
|
||||||
description 'Cluster Management for Mongrel'
|
|
||||||
gem 'mongrel_cluster'
|
|
||||||
version '1.0.5'
|
|
||||||
requires :mongrel
|
|
||||||
end
|
|
||||||
|
|
||||||
package :apache, :provides => :webserver do
|
|
||||||
description 'Apache 2 HTTP Server'
|
|
||||||
version '2.2.15'
|
|
||||||
|
|
||||||
source "http://download.nextag.com/apache/httpd/httpd-#{version}.tar.bz2" do
|
|
||||||
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
|
|
||||||
prefix "/opt/local/apache2-#{version}"
|
|
||||||
post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults'
|
|
||||||
end
|
|
||||||
requires :apache_dependencies
|
|
||||||
end
|
|
||||||
|
|
||||||
package :apache_dependencies do
|
|
||||||
description 'Apache 2 HTTP Server Build Dependencies'
|
|
||||||
apt %w( openssl libtool mawk zlib1g-dev libssl-dev )
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,13 @@
|
||||||
#!/usr/bin/env sprinkle -s
|
#!/usr/bin/env sprinkle -s
|
||||||
|
|
||||||
# Annotated Example Sprinkle Rails deployment script
|
|
||||||
#
|
|
||||||
# This is an example Sprinkle script configured to install Rails from gems, Apache, Ruby,
|
|
||||||
# Sphinx and Git from source, and mysql and Git dependencies from apt on an Ubuntu system.
|
|
||||||
#
|
|
||||||
# Installation is configured to run via capistrano (and an accompanying deploy.rb recipe script).
|
|
||||||
# Source based packages are downloaded and built into /usr/local on the remote system.
|
|
||||||
#
|
|
||||||
# A sprinkle script is separated into 3 different sections. Packages, policies and deployment:
|
|
||||||
|
|
||||||
|
|
||||||
# Packages (separate files for brevity)
|
|
||||||
#
|
|
||||||
# Defines the world of packages as we know it. Each package has a name and
|
|
||||||
# set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have
|
|
||||||
# relationships to each other via dependencies.
|
|
||||||
|
|
||||||
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"
|
||||||
#require "#{File.dirname(__FILE__)}/packages/unfortunately_essential"
|
|
||||||
|
|
||||||
# Policies
|
policy :diaspora, :roles => [:tom,:backer] do
|
||||||
#
|
|
||||||
# Names a group of packages (optionally with versions) that apply to a particular set of roles:
|
|
||||||
#
|
|
||||||
# Associates the rails policy to the application servers. Contains rails, and surrounding
|
|
||||||
# packages. Note, appserver, database, webserver and search are all virtual packages defined above.
|
|
||||||
# If there's only one implementation of a virtual package, it's selected automatically, otherwise
|
|
||||||
# the user is requested to select which one to use.
|
|
||||||
|
|
||||||
policy :diaspora, :roles => [:tom, :backer] do
|
|
||||||
# requires :clean_dreamhost
|
# requires :clean_dreamhost
|
||||||
requires :tools
|
requires :tools
|
||||||
requires :rubygems
|
requires :rubygems
|
||||||
|
|
@ -43,16 +17,9 @@ policy :diaspora, :roles => [:tom, :backer] do
|
||||||
requires :webserver
|
requires :webserver
|
||||||
requires :scm
|
requires :scm
|
||||||
requires :vim
|
requires :vim
|
||||||
|
requires :nginx_conf
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deployment
|
|
||||||
#
|
|
||||||
# Defines script wide settings such as a delivery mechanism for executing commands on the target
|
|
||||||
# system (eg. capistrano), and installer defaults (eg. build locations, etc):
|
|
||||||
#
|
|
||||||
# Configures spinkle to use capistrano for delivery of commands to the remote machines (via
|
|
||||||
# the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear
|
|
||||||
# in /usr/local
|
|
||||||
|
|
||||||
deployment do
|
deployment do
|
||||||
|
|
||||||
|
|
@ -73,5 +40,3 @@ deployment do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
|
|
||||||
# deployment settings specified.
|
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,8 @@ describe PeopleController do
|
||||||
|
|
||||||
get :index, :q => "Eu"
|
get :index, :q => "Eu"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should go to the current_user show page' do
|
||||||
|
get :show, :id => @user.person.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,6 @@ describe User do
|
||||||
@group = @user.group(:name => 'heroes')
|
@group = @user.group(:name => 'heroes')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should instantiate with a person and be valid' do
|
|
||||||
user = User.instantiate(:email => "bob@bob.com",
|
|
||||||
:password => "password",
|
|
||||||
:password_confirmation => "password",
|
|
||||||
:person =>
|
|
||||||
{:profile => {
|
|
||||||
:first_name => "bob",
|
|
||||||
:last_name => "grimm"}})
|
|
||||||
|
|
||||||
user.save.should be true
|
|
||||||
user.person.should_not be nil
|
|
||||||
user.person.profile.should_not be nil
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'profiles' do
|
describe 'profiles' do
|
||||||
it 'should be able to update their profile and send it to their friends' do
|
it 'should be able to update their profile and send it to their friends' do
|
||||||
Factory.create(:person)
|
Factory.create(:person)
|
||||||
|
|
@ -32,6 +18,4 @@ describe User do
|
||||||
@user.profile.image_url.should == "http://clown.com"
|
@user.profile.image_url.should == "http://clown.com"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue