<commit_before># The Capistrano tasks will use your **working copy**, compile the assets and deploy them to the server_address
# Execute one of the following to deploy into staging or production:
#   $ bundle exec cap staging deploy
#   $ bundle exec cap production deploy
# Rollback one step:
#   $ bundle exec cap [staging|production] deploy:rollback

require 'capistrano/ext/multistage'
require 'fileutils'

set :server_address, 'assets.malmo.se'
server server_address, :web
set :use_sudo, false

set :stages, %w(staging production staging_internal production_internal)

set :application, "assets"

set :deploy_via, :copy # Use local copy, be sure to update the stuff you want to deploy
set :copy_exclude, ["log/*", "**/.git*", "tmp/*", "doc", "bootstrap", "**/.DS_Store",
  "**/*.example", "config/database.yml*", "config/deploy.yml*", "config/app_config.yml*",
  ".bundle", ".ruby-version", ".gitignore", ".rspec", ".bowerrc", "package.json"]

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

set(:user) do
   Capistrano::CLI.ui.ask "Username for #{server_address}: "
end

before "deploy", "deploy:continue", "build"
after "deploy", "deploy:create_symlink", "deploy:cleanup", "build:cleanup"

namespace :deploy do
  desc "Deploy assets to server"
  task :default do
    run_locally "cd public && tar -jcf assets.tar.bz2 assets"
    top.upload "public/assets.tar.bz2", "#{releases_path}", :via => :scp
    run "cd #{releases_path} && tar -jxf assets.tar.bz2 && rm assets.tar.bz2 && mv assets #{release_name}"
  end

  task :continue do
    puts "This will use your **working copy**, compile the assets and deploy them to #{server_address} #{releases_path}/#{release_name}"
    continue = Capistrano::CLI.ui.ask "Do you want to continue [y/n]: "
    if continue.downcase != 'y' && continue.downcase != 'yes'
      Kernel.exit(1)
    end
  end
end

namespace :build do
  desc "Precompile assets locally"
  task :default do
    run_locally("RAILS_ENV=#{rails_env} rake build:masthead")
    run_locally("RAILS_ENV=#{rails_env} rake build:footer")
    run_locally("RAILS_ENV=#{rails_env} rake assets:clobber assets:precompile assets:remove_digests")
  end

  desc "Remove locally compiled assets"
  task :cleanup do
    run_locally("rake assets:clobber")
    run_locally("rm public/assets.tar.bz2")<commit_msg>Check for AUDIENCE in deploy<commit_after># The Capistrano tasks will use your **working copy**, compile the assets and deploy them to the server_address
# Execute one of the following to deploy into staging or production:
#   $ bundle exec cap staging deploy
#   $ bundle exec cap production deploy
# Rollback one step:
#   $ bundle exec cap [staging|production] deploy:rollback

require 'capistrano/ext/multistage'
require 'fileutils'

set :server_address, 'assets.malmo.se'
server server_address, :web
set :use_sudo, false

set :stages, %w(staging production staging_internal production_internal)

set :application, "assets"

set :deploy_via, :copy # Use local copy, be sure to update the stuff you want to deploy
set :copy_exclude, ["log/*", "**/.git*", "tmp/*", "doc", "bootstrap", "**/.DS_Store",
  "**/*.example", "config/database.yml*", "config/deploy.yml*", "config/app_config.yml*",
  ".bundle", ".ruby-version", ".gitignore", ".rspec", ".bowerrc", "package.json"]

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

set(:user) do
   Capistrano::CLI.ui.ask "Username for #{server_address}: "
end

before "deploy", "deploy:continue", "build"
after "deploy", "deploy:create_symlink", "deploy:cleanup", "build:cleanup"

namespace :deploy do
  desc "Deploy assets to server"
  task :default do
    run_locally "cd public && tar -jcf assets.tar.bz2 assets"
    top.upload "public/assets.tar.bz2", "#{releases_path}", :via => :scp
    run "cd #{releases_path} && tar -jxf assets.tar.bz2 && rm assets.tar.bz2 && mv assets #{release_name}"
  end

  task :continue do
    if ENV["AUDIENCE"].nil?
      puts "\033[1;31mYou must set to AUDIENCE=internal or AUDIENCE=external in your command, e.g.:\033[0m"
      puts "  \033[0;32m$ AUDIENCE=internal bundle exec cap staging deploy\033[0m"
      Kernel.exit(1)
    end
    puts "This will use your **working copy**, compile the assets and deploy them to #{server_address} #{releases_path}/#{release_name}"
    continue = Capistrano::CLI.ui.ask "Do you want to continue [y/n]: "
    if continue.downcase != 'y' && continue.downcase != 'yes'
      Kernel.exit(1)
    end
  end
end

namespace :build do
  desc "Precompile assets locally"
  task :default do
    run_locally("RAILS_ENV=#{rails_env} rake build:masthead")
    run_locally("RAILS_ENV=#{rails_env} rake build:footer")
    run_locally("RAILS_ENV=#{rails_env} rake assets:clobber assets:precompile assets:remove_digests")
  end

  desc "Remove locally compiled assets"
  task :cleanup do
    run_locally("rake assets:clobber")
    run_locally("rm public/assets.tar.bz2")
{'fraction_non_alphanumeric': 0.13676082097134729, 'fraction_numerical': 0.006705954074375127, 'mean_word_length': 4.729918509895227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3692571', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1617, 'n_words': 483}