<commit_before>require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/config'

set :term_mode, :system
set :forward_agent, true
set :rvm_path, '/usr/local/rvm/scripts/rvm'

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use[ruby-1.9.3-p125@default]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[mkdir -p "#{deploy_to}/shared/public/system"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/public/system"]

  queue! %[touch "#{deploy_to}/shared/config/app_config.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/app_config.yml'."]

  queue! %[touch "#{deploy_to}/shared/config/secrets.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/secrets.yml'."]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    # queue! "RAILS_ENV=#{rails_env} bundle exec rake db:create"
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      invoke :'resque:stop'
      queue "mkdir -p #{deploy_to}/#{current_path}/tmp"
      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
      invoke :'resque:start'
    end

    invoke :'seed'
    invoke :'deploy:cleanup'
  end
end

desc "Seed data to the database"
task :seed => :environment do
  puts "-----> Seeding Database"
  queue "cd #{release_path}/"
  queue "RAILS_ENV=#{rails_env} bundle exec rake db:seed"
  puts "-----> Seeding Completed."
end

desc "Populate database.yml"
task :'setup:db:database_yml' => :environment do
  puts "-----> Configuring database.yml"
  queue! %[touch "#{deploy_to}/shared/config/database.yml"]<commit_msg>No need to run resque workers<commit_after>require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/config'

set :term_mode, :system
set :forward_agent, true
set :rvm_path, '/usr/local/rvm/scripts/rvm'

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use[ruby-1.9.3-p125@default]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[mkdir -p "#{deploy_to}/shared/public/system"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/public/system"]

  queue! %[touch "#{deploy_to}/shared/config/app_config.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/app_config.yml'."]

  queue! %[touch "#{deploy_to}/shared/config/secrets.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/secrets.yml'."]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    # queue! "RAILS_ENV=#{rails_env} bundle exec rake db:create"
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      #invoke :'resque:stop'
      queue "mkdir -p #{deploy_to}/#{current_path}/tmp"
      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
      #invoke :'resque:start'
    end

    invoke :'seed'
    invoke :'deploy:cleanup'
  end
end

desc "Seed data to the database"
task :seed => :environment do
  puts "-----> Seeding Database"
  queue "cd #{release_path}/"
  queue "RAILS_ENV=#{rails_env} bundle exec rake db:seed"
  puts "-----> Seeding Completed."
end

desc "Populate database.yml"
task :'setup:db:database_yml' => :environment do
  puts "-----> Configuring database.yml"
  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
{'fraction_non_alphanumeric': 0.15186028853454822, 'fraction_numerical': 0.002277904328018223, 'mean_word_length': 3.86070110701107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '2174370', 'n_tokens_mistral': 1911, 'n_tokens_neox': 1816, 'n_words': 540}