Merge branch 'master' into half-decent
Conflicts: app/controllers/dashboard_controller.rb
This commit is contained in:
commit
7f795e05cb
23 changed files with 354 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
|||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
.bundle
|
||||
db/*.sqlite3
|
||||
log/*.log
|
||||
|
|
|
|||
4
Capfile
Normal file
4
Capfile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
||||
7
Gemfile
7
Gemfile
|
|
@ -3,16 +3,15 @@ source 'http://rubygems.org'
|
|||
gem 'rails', '3.0.0.beta4'
|
||||
gem 'mongrel'
|
||||
gem 'thin'
|
||||
gem 'em-http-request'
|
||||
gem 'addressable'
|
||||
gem 'em-http-request', :require => "em-http", :git => "git://github.com/igrigorik/em-http-request.git"
|
||||
gem 'addressable', :require => "addressable/uri"
|
||||
gem "mongoid", :git => "git://github.com/durran/mongoid.git"
|
||||
gem "bson_ext", "1.0.1"
|
||||
gem "haml"
|
||||
gem "devise", :git => "git://github.com/plataformatec/devise.git"
|
||||
gem 'roxml', :git => "git://github.com/Empact/roxml.git"
|
||||
|
||||
gem 'dm-core'
|
||||
|
||||
|
||||
group :test do
|
||||
gem 'rspec', '>= 2.0.0.beta.12'
|
||||
gem 'rspec-rails', ">= 2.0.0.beta.8"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ class DashboardController < ApplicationController
|
|||
include ApplicationHelper
|
||||
|
||||
def index
|
||||
@posts = Post.all
|
||||
posts = Post.all.order_by( [:created_at, :desc] )
|
||||
@posts = posts
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class StatusMessagesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xml { render :xml => @status_message }
|
||||
format.xml { render :xml => Post.build_xml_for(@status_message) }
|
||||
format.json { render :json => @status_message }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
class StatusMessage < Post
|
||||
include StatusMessagesHelper
|
||||
require 'lib/net/curl'
|
||||
|
||||
xml_name :status_message
|
||||
|
||||
|
|
@ -19,9 +18,6 @@ class StatusMessage < Post
|
|||
StatusMessage.newest(User.first.email)
|
||||
end
|
||||
|
||||
def self.retrieve_from_friend(friend)
|
||||
StatusMessages.from_xml Curl.get(friend.url+"status_messages.xml")
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
(self.message == other.message) && (self.owner == other.owner)
|
||||
|
|
|
|||
|
|
@ -16,4 +16,5 @@ Diaspora::Application.configure do
|
|||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
config.threadsafe!
|
||||
end
|
||||
|
|
|
|||
|
|
@ -43,4 +43,5 @@ Diaspora::Application.configure do
|
|||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
config.i18n.fallbacks = true
|
||||
config.threadsafe!
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ Diaspora::Application.configure do
|
|||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
# like if you have constraints or database-specific column types
|
||||
# config.active_record.schema_format = :sql
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
||||
begin
|
||||
|
|
|
|||
15
config/sprinkle/README
Normal file
15
config/sprinkle/README
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
= Example Rails Sprinkle Deployment Script
|
||||
|
||||
The following example shows how you can provision Rails and associated packages onto a remote server (or set of servers).
|
||||
|
||||
== Usage:
|
||||
|
||||
$> sprinkle -s rails.rb
|
||||
|
||||
or in test mode:
|
||||
|
||||
$> sprinkle -t -s rails.rb
|
||||
|
||||
== Information
|
||||
|
||||
For more information, please see: http://github.com/crafterm/sprinkle/tree/master/README.markdown
|
||||
66
config/sprinkle/conf/nginx.conf
Normal file
66
config/sprinkle/conf/nginx.conf
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
worker_processes 1;
|
||||
pid /tmp/pids/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 8192;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
sendfile on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
gzip on;
|
||||
gzip_http_version 1.0;
|
||||
gzip_comp_level 2;
|
||||
gzip_proxied any;
|
||||
gzip_buffers 16 8k;
|
||||
#gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
# gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||
upstream thin_cluster {
|
||||
server unix:/tmp/thin.0.sock;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
server_name babycakes.sofaer.net www.babycakes.sofaer.net;
|
||||
root /usr/local/app/diaspora/current;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
proxy_buffering off;
|
||||
|
||||
if (-f $request_filename/index.html) {
|
||||
rewrite (.*) $1/index.html break;
|
||||
}
|
||||
if (-f $request_filename.html) {
|
||||
rewrite (.*) $1.html break;
|
||||
}
|
||||
if (!-f $request_filename) {
|
||||
proxy_pass http://thin_cluster;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
22
config/sprinkle/packages/database.rb
Normal file
22
config/sprinkle/packages/database.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#package :mongo, :provides => :database do
|
||||
# description 'Mongodb'
|
||||
# version '1.4.3'
|
||||
# source "http://downloads.mongodb.org/src/mongodb-src-r#{version}.tar.gz"
|
||||
#end
|
||||
|
||||
package :mongodb, :provides => :database do
|
||||
description 'Mongodb debian package.'
|
||||
version '1.4.3'
|
||||
|
||||
binary "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-static-legacy-#{version}.tgz" do
|
||||
post :install, "ln -s -f /usr/local/bin/mongodb-linux-x86_64-static-#{version}/bin/mongod /usr/bin/mongod"
|
||||
end
|
||||
end
|
||||
|
||||
package :mongo_driver do
|
||||
description 'Ruby mongo database driver'
|
||||
gem 'mongo'
|
||||
gem 'bson'
|
||||
gem 'bson_ext'
|
||||
requires :rubygems
|
||||
end
|
||||
14
config/sprinkle/packages/essential.rb
Normal file
14
config/sprinkle/packages/essential.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
## Special package, anything that defines a 'source' package means build-essential should be installed for Ubuntu
|
||||
|
||||
package :build_essential do
|
||||
description 'Build tools'
|
||||
apt 'build-essential' do
|
||||
# Update the sources and upgrade the lists before we build essentials
|
||||
pre :install, 'apt-get update'
|
||||
end
|
||||
end
|
||||
|
||||
package :tools do
|
||||
description 'Useful tools'
|
||||
apt 'psmisc htop'
|
||||
end
|
||||
47
config/sprinkle/packages/ruby.rb
Normal file
47
config/sprinkle/packages/ruby.rb
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
## Defines available packages
|
||||
|
||||
package :ruby do
|
||||
description 'Ruby Virtual Machine'
|
||||
version '1.8.7'
|
||||
patchlevel '249'
|
||||
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p#{patchlevel}.tar.gz" # implicit :style => :gnu
|
||||
requires :ruby_dependencies
|
||||
end
|
||||
|
||||
package :ruby_dependencies do
|
||||
description 'Ruby Virtual Machine Build Dependencies'
|
||||
apt %w( bison zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev file )
|
||||
end
|
||||
|
||||
package :rubygems do
|
||||
description 'Ruby Gems Package Management System'
|
||||
version '1.3.7'
|
||||
source "http://production.cf.rubygems.org/rubygems/rubygems-#{version}.tgz" do
|
||||
custom_install 'ruby setup.rb'
|
||||
end
|
||||
run( "PATH=$PATH:/var/lib/gems/1.8/bin")
|
||||
run( "export PATH")
|
||||
requires :ruby
|
||||
end
|
||||
|
||||
package :bundler do
|
||||
description 'bundler'
|
||||
version '0.9.26'
|
||||
gem 'bundler'
|
||||
requires :rubygems
|
||||
end
|
||||
|
||||
package :diaspora_dependencies do
|
||||
description 'random dependencies'
|
||||
apt %w(libxslt1.1 libxslt1-dev libxml2)
|
||||
end
|
||||
#package :diaspora do
|
||||
# description 'Diaspora'
|
||||
|
||||
=begin
|
||||
package :rails do
|
||||
description 'Ruby on Rails'
|
||||
gem 'rails'
|
||||
version '>=3.0.0b4'
|
||||
end
|
||||
=end
|
||||
12
config/sprinkle/packages/scm.rb
Normal file
12
config/sprinkle/packages/scm.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package :git, :provides => :scm do
|
||||
description 'Git Distributed Version Control'
|
||||
apt %w( git-core )
|
||||
#version '1.6.3.3'
|
||||
#source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
||||
#requires :git_dependencies
|
||||
end
|
||||
|
||||
package :git_dependencies do
|
||||
description 'Git Build Dependencies'
|
||||
apt 'git-core', :dependencies_only => true
|
||||
end
|
||||
52
config/sprinkle/packages/server.rb
Normal file
52
config/sprinkle/packages/server.rb
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package :nginx do
|
||||
description 'Nginx HTTP server'
|
||||
version '0.7.67'
|
||||
source "http://nginx.org/download/nginx-#{version}.tar.gz"
|
||||
requires :nginx_dependencies
|
||||
end
|
||||
|
||||
package :nginx_conf, :provides=> :webserver do
|
||||
description 'Nginx conf file'
|
||||
transfer "#{File.dirname(__FILE__)}/../conf/nginx.conf", '/usr/local/conf/nginx.conf', :render => true do
|
||||
pre :install, "mkdir -p /usr/local/sbin/conf/"
|
||||
end
|
||||
requires :nginx
|
||||
end
|
||||
|
||||
package :nginx_dependencies do
|
||||
description 'Nginx build dependencies'
|
||||
apt %w( libc6 libpcre3 libpcre3-dev libssl0.9.8)
|
||||
source "http://zlib.net/zlib-1.2.5.tar.gz"
|
||||
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
|
||||
9
config/sprinkle/packages/unfortunately_essential.rb
Normal file
9
config/sprinkle/packages/unfortunately_essential.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#Fix dreamhost
|
||||
#
|
||||
|
||||
package :clean_dreamhost do
|
||||
description 'removes roadblocks in the standard DH PS image'
|
||||
run 'apt-get -fy install'
|
||||
run 'apt-get -y remove ruby'
|
||||
run 'apt-get -y remove ruby1.8 --purge'
|
||||
end
|
||||
77
config/sprinkle/provision.rb
Normal file
77
config/sprinkle/provision.rb
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#!/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/database"
|
||||
require "#{File.dirname(__FILE__)}/packages/server"
|
||||
require "#{File.dirname(__FILE__)}/packages/scm"
|
||||
require "#{File.dirname(__FILE__)}/packages/ruby"
|
||||
#require "#{File.dirname(__FILE__)}/packages/unfortunately_essential"
|
||||
|
||||
# Policies
|
||||
#
|
||||
# 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 => :app do
|
||||
# requires :clean_dreamhost
|
||||
requires :tools
|
||||
requires :rubygems
|
||||
requires :bundler
|
||||
requires :diaspora_dependencies
|
||||
requires :database
|
||||
requires :webserver
|
||||
requires :scm
|
||||
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
|
||||
|
||||
# mechanism for deployment
|
||||
delivery :capistrano do
|
||||
recipes "#{File.dirname(__FILE__)}/../deploy"
|
||||
end
|
||||
|
||||
# source based package installer defaults
|
||||
source do
|
||||
prefix '/usr/local'
|
||||
archives '/usr/local/sources'
|
||||
builds '/usr/local/build'
|
||||
end
|
||||
binary do
|
||||
prefix '/usr/local/bin'
|
||||
archives '/usr/local/sources'
|
||||
end
|
||||
end
|
||||
|
||||
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
|
||||
# deployment settings specified.
|
||||
15
config/thin.yml
Normal file
15
config/thin.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
rackup: /usr/local/app/diaspora/current/config.ru
|
||||
pid: /tmp/pids/thin.pid
|
||||
wait: 30
|
||||
timeout: 600
|
||||
log: /usr/local/log/thin
|
||||
max_conns: 1024
|
||||
require: []
|
||||
|
||||
max_persistent_conns: 512
|
||||
#environment: production
|
||||
servers: 1
|
||||
daemonize: true
|
||||
#chdir: /usr/applications/localhash/current
|
||||
socket: /tmp/thin.sock
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
require 'addressable/uri'
|
||||
require 'eventmachine'
|
||||
require 'em-http'
|
||||
# require 'addressable/uri'
|
||||
# require 'eventmachine'
|
||||
# require 'em-http'
|
||||
|
||||
class MessageHandler
|
||||
|
||||
|
|
|
|||
5
science
Executable file
5
science
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
`sprinkle -s config/sprinkle/provision.rb -v`
|
||||
`cap deploy:setup`
|
||||
`cap deploy:cold`
|
||||
puts 'bababababa bababababa'
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe Bookmark do
|
||||
describe Bookmark do
|
||||
it "should have a link" do
|
||||
bookmark = Factory.build(:bookmark, :link => nil)
|
||||
bookmark.valid?.should be false
|
||||
|
|
@ -61,7 +61,7 @@ describe Bookmark do
|
|||
describe "XML" do
|
||||
it 'should serialize to XML' do
|
||||
Factory.create(:user)
|
||||
message = Factory.create(:bookmark, :title => "Reddit", :link => "http://reddit.com")
|
||||
message = Factory.create(:bookmark, :title => "Reddit", :link => "http://reddit.com/")
|
||||
message.to_xml.to_s.should include "<title>Reddit</title>"
|
||||
message.to_xml.to_s.should include "<link>http://reddit.com/</link>"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Rspec.configure do |config|
|
|||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
#this is a dumb hax TODO
|
||||
config.mock_with :mocha
|
||||
#config.mock_with :mocha
|
||||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
config.mock_with :rspec
|
||||
|
|
@ -41,5 +41,5 @@ Rspec.configure do |config|
|
|||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, comment the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = false
|
||||
config.use_transactional_fixtures = true
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue