<commit_before>require 'capistrano/ext/multistage'
require 'capistrano_colors'
load 'recipes/prompt'
load 'recipes/stack'
load 'recipes/passenger'

set :application, "fat-free-crm"
set :default_stage, "preview"
set :passenger_version, "2.2.15"

#
# To get going from scratch:
#
# cap deploy:cold
# cap crm:settings ( or cap crm:demo )
# cap crm:setup:admin
# 

namespace :crm do

  desc "Load crm settings"
  task :settings do
    run "cd #{current_path} && RAILS_ENV=production rake crm:settings:load"
  end
  
  namespace :setup do

    desc "Load crm settings"
    task :admin do
      prompt_with_default("Username", :admin_username, "admin")
      prompt_with_default("Password", :admin_password, "<PASSWORD>")
      prompt_with_default("Email", :admin_email, "<EMAIL>")
      run "cd #{current_path} && RAILS_ENV=production rake crm:setup:admin USERNAME=#{admin_username} PASSWORD=#{<PASSWORD>} EMAIL=#{admin_email}"
    end
  end

  desc "Load demo data (wipes database)"
  task :demo do
    run "cd #{current_path} && RAILS_ENV=production rake crm:demo:load"
  end

end

namespace :git do
  namespace :submodules do
    task :update do
      run "cd #{release_path} && git submodule init"
      run "cd #{release_path} && git submodule update"
    end
  end
end
before 'deploy:finalize_update', 'git:submodules:update'<commit_msg>Add support for server specific settings.<commit_after>require 'capistrano/ext/multistage'
require 'capistrano_colors'
load 'recipes/prompt'
load 'recipes/stack'
load 'recipes/passenger'

set :application, "fat-free-crm"
set :default_stage, "preview"
set :passenger_version, "2.2.15"

#
# To get going from scratch:
#
# cap deploy:cold
# cap crm:settings ( or cap crm:demo )
# cap crm:setup:admin
# 

namespace :crm do

  desc "Load crm settings"
  task :settings do
    run "cd #{current_path} && RAILS_ENV=production rake crm:settings:load"
  end
  
  namespace :setup do

    desc "Load crm settings"
    task :admin do
      prompt_with_default("Username", :admin_username, "admin")
      prompt_with_default("Password", :admin_password, "<PASSWORD>")
      prompt_with_default("Email", :admin_email, "<EMAIL>")
      run "cd #{current_path} && RAILS_ENV=production rake crm:setup:admin USERNAME=#{admin_username} PASSWORD=#{<PASSWORD>} EMAIL=#{admin_email}"
    end
  end

  desc "Load demo data (wipes database)"
  task :demo do
    run "cd #{current_path} && RAILS_ENV=production rake crm:demo:load"
  end

end

namespace :git do
  namespace :submodules do
    task :update do
      run "cd #{release_path} && git submodule init"
      run "cd #{release_path} && git submodule update"
    end
  end
end
before 'deploy:finalize_update', 'git:submodules:update'

namespace :deploy do
  desc "Update settings file with server specific attributes (runs a server-side sed script)"
  task :update_settings do
    run "if [ -f #{shared_path}/settings.sed ]; then sed -i -f #{shared_path}/settings.sed #{release_path}/config/settings.yml; fi"
  end
end
after 'deploy:update_code', 'deploy:update_settings'
{'fraction_non_alphanumeric': 0.11965811965811966, 'fraction_numerical': 0.0026298487836949377, 'mean_word_length': 4.532727272727273, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2046372', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1023, 'n_words': 287}