<commit_before>#############################################################
#	Multi-staging
#############################################################

set :stages, %w(production staging)
set :default_stage, 'staging'
require 'capistrano/ext/multistage'



load 'deploy/assets'
require "bundler/capistrano"

set :application, 'openreader'
set :repository,  'git://github.com/amatriain/openreader.git'
set :scm, :git
set :deploy_via, :remote_cache
set :deploy_to, '/var/rails/openreader'
default_environment['TERM'] = 'xterm'

set :rvm_ruby_string, 'ruby-1.9.3-p429@openreader'
require 'rvm/capistrano'
set :rvm_type, :system
set :rvm_path, '/usr/local/rvm'


set :user, 'openreader'
set :use_sudo, false
ssh_options[:keys] = '/home/amatriain/Openreader/Staging/Openreaderstaging.pem'

namespace :openreader_secret_data do
  task :copy, roles: :app, except: {no_release: true} do
    run 'ln -sf /home/openreader/config/secret_token.rb ' \
        "#{release_path}/config/initializers/secret_token.rb"
    run 'ln -sf /home/openreader/config/database.yml ' \
        "#{release_path}/config/database.yml"
  end
end

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
#   task :start do ; end
#   task :stop do ; end
#   task :restart, :roles => :app, :except => { :no_release => true } do
#     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
#   end
# end

# copy secret files just before running database migrations
before 'deploy:assets:precompile', 'openreader_secret_data:copy'

# run database migrations on each deploy, just after copying the new code
after 'deploy:update_code', 'deploy:migrate'

# clean up old releases on each deploy, keep only 5 most recent releases
after 'deploy:restart', 'deploy:cleanup'<commit_msg>Better organization of the deployment script. On deploy, tell Passenger to restart the app.<commit_after>#############################################################
#	Multi-staging
#############################################################

set :stages, %w(production staging)
set :default_stage, 'staging'
require 'capistrano/ext/multistage'

#############################################################
#	Application
#############################################################

set :application, 'openreader'

#############################################################
#	Settings
#############################################################

# runs 'bundle install' during deployment
require 'bundler/capistrano'

# precompiles assets in production
load 'deploy/assets'

default_environment['TERM'] = 'xterm'

#############################################################
#	Servers
#############################################################

set :user, 'openreader'
# We use a non-privileged user for security reasons
set :use_sudo, false
ssh_options[:keys] = '/home/amatriain/Openreader/Staging/Openreaderstaging.pem'
set :deploy_to, '/var/rails/openreader'

#############################################################
#	Git
#############################################################

set :scm, :git
set :repository,  'git://github.com/amatriain/openreader.git'
set :branch, 'master'
set :deploy_via, :remote_cache

#############################################################
#	RVM
#############################################################

set :rvm_ruby_string, 'ruby-1.9.3-p429@openreader'
require 'rvm/capistrano'
set :rvm_type, :system
set :rvm_path, '/usr/local/rvm'

#############################################################
#	Passenger
#############################################################

namespace :openreader_passenger do
  task :restart do
    # Tell passenger to restart the app
    run "touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

#############################################################
#	Copy secret token and database credentials to deployment
#############################################################

namespace :openreader_secret_data do
  task :copy, roles: :app, except: {no_release: true} do
    run 'ln -sf /home/openreader/config/secret_token.rb ' \
        "#{release_path}/config/initializers/secret_token.rb"
    run 'ln -sf /home/openreader/config/database.yml ' \
        "#{release_path}/config/database.yml"
  end
end

#############################################################
#	Deployment start/stop/restart hooks
#############################################################

namespace :deploy do
  task :restart, roles: :app, except: {no_release: true} do
    openreader_passenger.restart
  end
end

# copy secret files just before compiling assets
before 'deploy:assets:precompile', 'openreader_secret_data:copy'

# run database migrations on each deploy, just after copying the new code
after 'deploy:update_code', 'deploy:migrate'

# clean up old releases on each deploy, keep only 5 most recent releases
after 'deploy:restart', 'deploy:cleanup'
{'fraction_non_alphanumeric': 0.3305637982195846, 'fraction_numerical': 0.0027695351137487635, 'mean_word_length': 6.625942684766215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3256302', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1379, 'n_words': 356}