Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
e1e4ce8e4f
6 changed files with 147 additions and 28 deletions
2
Gemfile
2
Gemfile
|
|
@ -35,7 +35,7 @@ gem 'newrelic_rpm'
|
||||||
gem "rpm_contrib", "~> 2.1.7"
|
gem "rpm_contrib", "~> 2.1.7"
|
||||||
|
|
||||||
group :production do # we don't install these on travis to speed up test runs
|
group :production do # we don't install these on travis to speed up test runs
|
||||||
gem 'rails_admin'
|
gem 'rails_admin', '~> 0.0.2'
|
||||||
gem 'rack-ssl', :require => 'rack/ssl'
|
gem 'rack-ssl', :require => 'rack/ssl'
|
||||||
gem 'rack-rewrite', '~> 1.2.1', :require => false
|
gem 'rack-rewrite', '~> 1.2.1', :require => false
|
||||||
gem 'rack-piwik', :require => 'rack/piwik'
|
gem 'rack-piwik', :require => 'rack/piwik'
|
||||||
|
|
|
||||||
16
Gemfile.lock
16
Gemfile.lock
|
|
@ -161,7 +161,7 @@ GEM
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.0.beta.4)
|
eventmachine (1.0.0.beta.4)
|
||||||
excon (0.13.2)
|
excon (0.13.2)
|
||||||
execjs (1.3.0)
|
execjs (1.3.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
factory_girl (2.6.4)
|
factory_girl (2.6.4)
|
||||||
activesupport (>= 2.3.9)
|
activesupport (>= 2.3.9)
|
||||||
|
|
@ -216,7 +216,7 @@ GEM
|
||||||
guard-spork (0.5.2)
|
guard-spork (0.5.2)
|
||||||
guard (>= 0.10.0)
|
guard (>= 0.10.0)
|
||||||
spork (>= 0.8.4)
|
spork (>= 0.8.4)
|
||||||
haml (3.1.4)
|
haml (3.1.5)
|
||||||
handlebars_assets (0.4.1)
|
handlebars_assets (0.4.1)
|
||||||
execjs (>= 1.2.9)
|
execjs (>= 1.2.9)
|
||||||
sprockets (>= 2.0.3)
|
sprockets (>= 2.0.3)
|
||||||
|
|
@ -250,7 +250,7 @@ GEM
|
||||||
jquery-ui-rails (0.2.2)
|
jquery-ui-rails (0.2.2)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
railties (>= 3.1.0)
|
railties (>= 3.1.0)
|
||||||
json (1.6.6)
|
json (1.7.1)
|
||||||
jwt (0.1.4)
|
jwt (0.1.4)
|
||||||
json (>= 1.2.4)
|
json (>= 1.2.4)
|
||||||
kaminari (0.13.0)
|
kaminari (0.13.0)
|
||||||
|
|
@ -357,13 +357,13 @@ GEM
|
||||||
railties (= 3.1.4)
|
railties (= 3.1.4)
|
||||||
rails-i18n (0.6.3)
|
rails-i18n (0.6.3)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
rails_admin (0.0.1)
|
rails_admin (0.0.2)
|
||||||
bbenezech-nested_form (~> 0.0.6)
|
bbenezech-nested_form (~> 0.0.6)
|
||||||
bootstrap-sass (~> 2.0)
|
bootstrap-sass (~> 2.0)
|
||||||
builder (~> 3.0)
|
builder (~> 3.0)
|
||||||
coffee-rails (~> 3.1)
|
coffee-rails (~> 3.1)
|
||||||
haml (~> 3.1)
|
haml (~> 3.1)
|
||||||
jquery-rails (>= 1.0)
|
jquery-rails (>= 1.0.17)
|
||||||
jquery-ui-rails (~> 0.2.2)
|
jquery-ui-rails (~> 0.2.2)
|
||||||
kaminari (~> 0.12)
|
kaminari (~> 0.12)
|
||||||
rack-pjax (~> 0.5)
|
rack-pjax (~> 0.5)
|
||||||
|
|
@ -424,7 +424,7 @@ GEM
|
||||||
ruby-oembed (0.8.7)
|
ruby-oembed (0.8.7)
|
||||||
ruby-progressbar (0.0.10)
|
ruby-progressbar (0.0.10)
|
||||||
rubyzip (0.9.8)
|
rubyzip (0.9.8)
|
||||||
sass (3.1.15)
|
sass (3.1.17)
|
||||||
sass-rails (3.1.4)
|
sass-rails (3.1.4)
|
||||||
actionpack (~> 3.1.0)
|
actionpack (~> 3.1.0)
|
||||||
railties (~> 3.1.0)
|
railties (~> 3.1.0)
|
||||||
|
|
@ -443,7 +443,7 @@ GEM
|
||||||
rack-protection (~> 1.2)
|
rack-protection (~> 1.2)
|
||||||
tilt (~> 1.3, >= 1.3.3)
|
tilt (~> 1.3, >= 1.3.3)
|
||||||
spork (1.0.0rc2)
|
spork (1.0.0rc2)
|
||||||
sprockets (2.0.3)
|
sprockets (2.0.4)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
|
|
@ -563,7 +563,7 @@ DEPENDENCIES
|
||||||
rack-ssl
|
rack-ssl
|
||||||
rails (= 3.1.4)
|
rails (= 3.1.4)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rails_admin
|
rails_admin (~> 0.0.2)
|
||||||
rails_autolink
|
rails_autolink
|
||||||
redcarpet (= 2.0.1)
|
redcarpet (= 2.0.1)
|
||||||
remotipart (~> 1.0)
|
remotipart (~> 1.0)
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class PostPresenter
|
||||||
end
|
end
|
||||||
|
|
||||||
def root
|
def root
|
||||||
PostPresenter.new(@post.root, current_user).as_json if @post.respond_to?(:root)
|
PostPresenter.new(@post.root, current_user).as_json if @post.respond_to?(:root) && @post.root.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_like
|
def user_like
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
# RailsAdmin config file. Generated on March 24, 2012 15:34
|
# RailsAdmin config file. Generated on March 24, 2012 15:34
|
||||||
# See github.com/sferik/rails_admin for more informations
|
# See github.com/sferik/rails_admin for more informations
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
|
# Recommended way to deal with Kaminari vs. WillPaginate issues
|
||||||
|
if defined?(WillPaginate)
|
||||||
|
Kaminari.configure do |config|
|
||||||
|
config.page_method_name = :per_page_kaminari
|
||||||
|
end
|
||||||
|
end
|
||||||
RailsAdmin.config do |config|
|
RailsAdmin.config do |config|
|
||||||
config.authorize_with do
|
config.authorize_with do
|
||||||
redirect_to main_app.root_path unless current_user.try(:admin?)
|
redirect_to main_app.root_path unless current_user.try(:admin?)
|
||||||
|
|
@ -1128,17 +1134,4 @@ RailsAdmin.config do |config|
|
||||||
# update do; end
|
# update do; end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
if defined?(WillPaginate)
|
|
||||||
module WillPaginate
|
|
||||||
module ActiveRecord
|
|
||||||
module RelationMethods
|
|
||||||
def per(value = nil) per_page(value) end
|
|
||||||
def total_count() count end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
module CollectionMethods
|
|
||||||
alias_method :num_pages, :total_pages
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
@ -54,6 +54,13 @@ D_DB_USER="diaspora"
|
||||||
|
|
||||||
D_DB_PASS="diaspora"
|
D_DB_PASS="diaspora"
|
||||||
|
|
||||||
|
D_RUBY_VERSION="1.9.2-p290"
|
||||||
|
|
||||||
|
#### INTERNAL VARS ####
|
||||||
|
|
||||||
|
RVM_DETECTED=false
|
||||||
|
JS_RUNTIME_DETECTED=false
|
||||||
|
|
||||||
#### ####
|
#### ####
|
||||||
# #
|
# #
|
||||||
# FUNCTIONS, etc. #
|
# FUNCTIONS, etc. #
|
||||||
|
|
@ -93,6 +100,11 @@ error() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check for functions
|
||||||
|
fn_exists() {
|
||||||
|
type -t $1 | grep -q 'function'
|
||||||
|
}
|
||||||
|
|
||||||
# shell interactive or not
|
# shell interactive or not
|
||||||
interactive_check() {
|
interactive_check() {
|
||||||
fd=0 #stdin
|
fd=0 #stdin
|
||||||
|
|
@ -133,8 +145,20 @@ For more details check out https://rvm.io//
|
||||||
EOT
|
EOT
|
||||||
rvm_check() {
|
rvm_check() {
|
||||||
echo -n "checking for rvm... "
|
echo -n "checking for rvm... "
|
||||||
rvm >/dev/null 2>&1
|
fn_exists rvm
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
|
RVM_DETECTED=true
|
||||||
|
|
||||||
|
# seems we don't have it loaded, try to do so
|
||||||
|
elif [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
||||||
|
source "$HOME/.rvm/scripts/rvm" >/dev/null 2>&1
|
||||||
|
RVM_DETECTED=true
|
||||||
|
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
||||||
|
source "/usr/local/rvm/scripts/rvm" >/dev/null 2>&1
|
||||||
|
RVM_DETECTED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $RVM_DETECTED ; then
|
||||||
echo "found"
|
echo "found"
|
||||||
else
|
else
|
||||||
echo "not found"
|
echo "not found"
|
||||||
|
|
@ -144,6 +168,97 @@ rvm_check() {
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# prepare ruby with rvm
|
||||||
|
install_or_use_ruby() {
|
||||||
|
if ! $RVM_DETECTED ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure we have the correct ruby version available
|
||||||
|
echo -n "checking your ruby version... "
|
||||||
|
rvm use $D_RUBY_VERSION >/dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo "not ok"
|
||||||
|
rvm install $D_RUBY_VERSION >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
echo "ok"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# trust and load rvmrc
|
||||||
|
# do this in a directory that has a .rvmrc, only :)
|
||||||
|
load_rvmrc() {
|
||||||
|
if ! $RVM_DETECTED ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# trust rvmrc
|
||||||
|
rvm rvmrc is_trusted
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
rvm rvmrc trust
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load .rvmrc
|
||||||
|
echo -n "loading .rvmrc ... "
|
||||||
|
rvm rvmrc load
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
echo "ok"
|
||||||
|
else
|
||||||
|
echo "not ok"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# we need a valid js runtime...
|
||||||
|
define JS_RT_MSG <<'EOT'
|
||||||
|
This script was unable to find a JavaScript runtime compatible to ExecJS on
|
||||||
|
your system. We recommend you install either Node.js or TheRubyRacer, since
|
||||||
|
those have been proven to work.
|
||||||
|
|
||||||
|
Node.js -- http://nodejs.org/
|
||||||
|
TheRubyRacer -- https://github.com/cowboyd/therubyracer
|
||||||
|
|
||||||
|
For more information on ExecJS, visit
|
||||||
|
-- https://github.com/sstephenson/execjs
|
||||||
|
EOT
|
||||||
|
js_runtime_check() {
|
||||||
|
echo -n "checking for a JavaScript runtime... "
|
||||||
|
|
||||||
|
# Node.js
|
||||||
|
which node >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
JS_RUNTIME_DETECTED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TheRubyRacer
|
||||||
|
gem which v8 >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
JS_RUNTIME_DETECTED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
|
# add your favourite js runtime here...
|
||||||
|
##
|
||||||
|
|
||||||
|
if $JS_RUNTIME_DETECTED ; then
|
||||||
|
echo "ok"
|
||||||
|
else
|
||||||
|
echo "not ok"
|
||||||
|
echo "$JS_RT_MSG"
|
||||||
|
error "can't continue without a JS runtime"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# make ourselves comfy
|
||||||
|
prepare_install_env() {
|
||||||
|
install_or_use_ruby
|
||||||
|
load_rvmrc
|
||||||
|
js_runtime_check
|
||||||
|
}
|
||||||
|
|
||||||
# do some sanity checking
|
# do some sanity checking
|
||||||
sane_environment_check() {
|
sane_environment_check() {
|
||||||
binaries_check
|
binaries_check
|
||||||
|
|
@ -250,6 +365,7 @@ git_stuff_check
|
||||||
|
|
||||||
# goto working directory
|
# goto working directory
|
||||||
run_or_error "cd \"$D_GIT_CLONE_PATH\""
|
run_or_error "cd \"$D_GIT_CLONE_PATH\""
|
||||||
|
prepare_install_env
|
||||||
|
|
||||||
|
|
||||||
# configure database setup
|
# configure database setup
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,16 @@ describe PostPresenter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#root' do
|
||||||
|
it 'does not raise if the root does not exists' do
|
||||||
|
reshare = Factory :reshare
|
||||||
|
reshare.root = nil
|
||||||
|
expect {
|
||||||
|
PostPresenter.new(reshare).root
|
||||||
|
}.to_not raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#next_post_path' do
|
describe '#next_post_path' do
|
||||||
it 'returns a string of the users next post' do
|
it 'returns a string of the users next post' do
|
||||||
@presenter.next_post_path.should == "#{Rails.application.routes.url_helpers.post_path(@sm)}/next"
|
@presenter.next_post_path.should == "#{Rails.application.routes.url_helpers.post_path(@sm)}/next"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue