Skip to content
Permalink
Browse files

Merge branch 'dc-master'

# Conflicts:
#	config/server/scripts/create-ami-commands.sh
  • Loading branch information...
DavidLemayian committed Apr 22, 2017
2 parents a2a9952 + 04db7a8 commit 4bda2a80ac1e794503395457a9917461f90977ae
@@ -46,6 +46,8 @@ gem 'stripe', '~> 1.56.2'

gem 'active_model_serializers', '~>0.9.0'
gem 'passenger'
gem 'descriptive_statistics'
gem 'user_agent_parser'

group :development, :test do
gem 'guard-bundler'
@@ -1,6 +1,6 @@
GIT
remote: git@github.com:documentcloud/bull_proof_china_shop
revision: 64abcde27387c080fa58e79289f4a2632660f54d
revision: 648729a16dd568d286ae0343429632fe20f68537
branch: master
specs:
bull_proof_china_shop (0.0.1)
@@ -119,6 +119,7 @@ GEM
curb (0.8.8)
currencies (0.4.2)
daemons (1.2.4)
descriptive_statistics (2.5.1)
docsplit (0.8.0.alpha1)
domain_name (0.5.20161129)
unf (>= 0.0.5, < 1.0.0)
@@ -371,6 +372,7 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unicode_utils (1.4.0)
user_agent_parser (2.3.0)
vcr (3.0.3)
webmock (2.3.1)
addressable (>= 2.3.6)
@@ -391,6 +393,7 @@ DEPENDENCIES
cloud-crowd (~> 0.7.6)
country_select (~> 2.2.0)
curb (~> 0.8.4)
descriptive_statistics
docsplit (= 0.8.0.alpha1)
factory_girl_rails
google_drive (~> 1.0.0)
@@ -428,8 +431,9 @@ DEPENDENCIES
sunspot-rails-tester
sunspot_rails (= 2.2.0)
sunspot_solr (= 2.2.0)
user_agent_parser
vcr
webmock

BUNDLED WITH
1.12.5
1.14.4
@@ -3,6 +3,7 @@
class ReindexEverything < CloudCrowd::Action

def process
outcomes = {:succeeded=>[], :failed => []}
docs = Document.where({:id => input}).includes(:pages, :docdata)
ids = []
docs.find_each do |document|
@@ -13,12 +14,37 @@ def process
ids << document.id
rescue Exception => e
counter += 1
retry if counter < 5
(sleep(0.25) and retry) if counter < 5
LifecycleMailer.exception_notification(e,options).deliver_now
outcomes[:failed].push(:id=>doc.id)
end
end
Sunspot.commit
outcomes
end

def merge
# Upon completion email us a manifest of success/failure
successes = []
failures = []
input.each do |result|
successes += result["succeeded"]
failures += result["failed"]
end

duplicate_projects(successes) if options['projects']

data = {:successes => successes, :failures => failures}
LifecycleMailer.logging_email("Reindexing batch manifest", data).deliver_now
true
end

end

=begin
ids = Document.pluck(:id); ids.size
blocks = ids.each_slice(100).to_a; blocks.size
blocks.each_slice(10){ |block| RestClient.post ProcessingJob.endpoint, { job: { action: "reindex_everything", inputs: block }.to_json } }; ""
=end
@@ -155,7 +155,7 @@ def create_project

def update_project
data = pick(params, :title, :description, :document_ids)
ids = (data.delete(:document_ids) || []).map(&:to_i)
ids = [(data.delete(:document_ids) || [])].flatten.map(&:to_i)
doc_ids = Document.accessible(current_account, current_organization).where({ :id => ids }).pluck( 'id' )
current_project.set_documents( doc_ids )
current_project.update_attributes data
@@ -29,7 +29,9 @@ def show
format.html do
@embed_options = {
container: '#viewer',
sidebar: !(params[:sidebar] || '').match(/no|false/) # For Overview
sidebar: !(params[:sidebar] || '').match(/no|false/), # For Overview
responsive: !(params[:responsive] || '').match(/no|false/),
responsiveOffset: 0
}
merge_embed_config if params[:embed] == 'true'
populate_editor_data if current_account && current_organization
@@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="ClearType" content="true">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><%= @current_document && @current_document.title %></title>
<%= render partial: 'accounts/language_settings' if @edits_enabled %>
<%= render partial: 'common/oembed' if @oembeddable_resource %>
@@ -18,7 +18,7 @@
get '/search', to: 'workspace#index', as: 'search'
get '/search/preview', to: 'search#preview', as: 'preview'
get '/search/restricted_count', to: 'search#restricted_count'
get '/search(/:query)(/p:page)', to: 'workspace#index'
get '/search(/:query)(/p:page)', to: 'workspace#index', query: /[^\/]+/
get '/help', to: 'workspace#help'
get '/help/:page', to: 'workspace#help'
get '/results', to: 'workspace#index', as: 'results'
@@ -20,6 +20,8 @@ sudo mount $DEVICE /mnt/ami/
# 3) Set up the application.
# For DocumentCloud the process goes like this (after you've scp'd up the scripts dir & github key)

vim .ssh/id_rsa # now copypasta the private key which has access to your github repos in.
chmod 600 .ssh/id_rsa
sudo ./scripts/setup_common_dependencies.sh
source /etc/profile.d/chruby.sh
gem install bundler
@@ -32,6 +34,12 @@ rails runner -e production "puts Organization.count" # check for human eyeballs
sudo mkdir /mnt/cloud_crowd
sudo chown ubuntu:ubuntu /mnt/cloud_crowd

sudo mkdir /mnt/log
sudo mount /dev/xvdc /mnt/log
sudo chown ubuntu:ubuntu /mnt/log
rm -r log
ln -s /mnt/log log

# 4) Install the AWS command line tools:

# Install the AMI and API tools
@@ -51,7 +59,8 @@ ec2-bundle-vol \
--cert /home/ubuntu/sourceAFRICA/secrets/keys/ami_signing.pem \
--user $(egrep "aws_account_id" /home/ubuntu/sourceAFRICA/secrets/secrets.yml | awk '{print $NF}') \
--arch x86_64 --destination /mnt/ami \
--include /mnt/cloud_crowd --no-filter
--exclude /home/ubuntu/.ssh \
--include /mnt/cloud_crowd,/mnt/log --no-filter
exit

AMI_NAME=dc-worker-ephemeral-$(date +'%Y-%m-%d')
@@ -36,26 +36,4 @@ def test_logout
assert_nil session['account_id']
end

# Tests that don't matter in read-only mode
unless Rails.application.config.read_only

def test_logs_in_from_omniauth_callback
request.env['omniauth.auth'] = {
'provider' => 'twitter',
'uid' => '424',
'info' =>{
'email' => 'test@test.com',
'name' => 'Testing Tester'
}
}
assert_empty Account.with_identity( 'twitter', '424' )
assert_difference( 'Account.count' ) do
get :callback
end
account = Account.where( email: 'test@test.com' ).first
assert_equal 'Testing', account.first_name
end

end

end
@@ -1,7 +1,7 @@
require File.join(__dir__, '..', 'test_helper')

class StatisticsTest < ActiveSupport::TestCase

=begin
DAY_DATE = Date.today - 1.day
WEEK_DATE = Date.today - 1.week - 2.day
MONTH_DATE = Date.today - 1.month - 2.day
@@ -128,6 +128,6 @@ def test_count_total_collaborators
assert_equal 0, DC::Statistics.count_total_collaborators
end

=end
end

@@ -99,25 +99,6 @@ class AccountTest < ActiveSupport::TestCase
assert_equal Account::ADMINISTRATOR, membership.role
end

it "can have multiple identities" do
ids = { 'facebook'=>'12' }
louis.identities = ids
assert louis.save
louis.reload
assert_kind_of Hash, louis.identities
assert_equal ids, louis.identities
assert_equal louis, Account.with_identity( 'facebook', 12 ).first
end

it "ensures only one account has identity" do
ids = { 'facebook'=>'12' }
louis.identities = ids
assert louis.save
acct = Account.new({ :identities=> ids })
refute acct.save
assert acct.errors.include?(:identities)
end

it "has a canonical representation" do
assert louis.canonical( :include_organization=>true, :include_document_counts=>true)
end

0 comments on commit 4bda2a8

Please sign in to comment.
You can’t perform that action at this time.