<commit_before>require 'rubygems'
require 'fileutils'
require 'yaml'
require 'erb'

# should be run from the projects rails root.
# Update: this doesn't seem to be working anymore..
APPLICATION = "'RITES Investigations'"
puts "\nInitial setup of #{APPLICATION} Rails application ...\n"

JRUBY = defined? RUBY_ENGINE && RUBY_ENGINE == 'jruby'
RAILS_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
APP_DIR_NAME = File.basename(RAILS_ROOT)

# Add the unpacked gems in vendor/gems to the $LOAD_PATH
Dir["#{RAILS_ROOT}/vendor/gems/**"].each do |dir| 
  $LOAD_PATH << File.expand_path(File.directory?(lib = "#{dir}/lib") ? lib : dir)
end

require 'uuidtools'
require 'highline/import'

def jruby_system_command
  JRUBY ? "jruby -S" : ""
end

def gem_install_command_strings(missing_gems)
  command = JRUBY ? "  jruby -S gem install " : "  sudo ruby gem install "
  command + missing_gems.collect {|g| "#{g[0]} -v'#{g[1]}'"}.join(' ') + "\n"
end

def rails_file_path(*args)
  File.join([RAILS_ROOT] + args)
end

def rails_file_exists?(*args)
  File.exists?(rails_file_path(args))
end

@db_config_path                = rails_file_path(%w{config database.yml})
@db_config_sample_path         = rails_file_path(%w{config database.sample.yml})
@settings_config_path          = rails_file_path(%w{config settings.yml})
@settings_config_sample_path   = rails_file_path(%w{config settings.sample.yml})
@rinet_data_config_path        = rails_file_path(%w{config rinet_data.yml})
@rinet_data_config_sample_path = rails_file_path(%w{config rinet_data.sample.yml})
@mailer_config_path            = rails_file_path(%w{config mailer.yml})
@mailer_config_sample_path     = rails_file_path(%w{config mailer.sample.yml})
@sds_config_path               = rails_file_path(%w{config sds.yml})
@sds_config_sample_path        = rails_file_path(%w{config sds.sample.yml})

@db_config_sample              = YAML::load_file(@db_config_sample_path)
@settings_config_sample        = YAML::load_file(@settings_config_sample_path)
@rinet_data_config_sample      = YAML::load_file(@rinet_data_config_sample_path)
@mailer_config_sample          = YAML::load_file(@mailer_config_sample_path)
@sds_config_sample             = YAML::load_file(@sds_config_sample_path)

@new_database_yml_created = false
@new_settings_yml_created = false<commit_msg>comment out sds.sample.yml loading for now.<commit_after>require 'rubygems'
require 'fileutils'
require 'yaml'
require 'erb'

# should be run from the projects rails root.
# Update: this doesn't seem to be working anymore..
APPLICATION = "'RITES Investigations'"
puts "\nInitial setup of #{APPLICATION} Rails application ...\n"

JRUBY = defined? RUBY_ENGINE && RUBY_ENGINE == 'jruby'
RAILS_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
APP_DIR_NAME = File.basename(RAILS_ROOT)

# Add the unpacked gems in vendor/gems to the $LOAD_PATH
Dir["#{RAILS_ROOT}/vendor/gems/**"].each do |dir| 
  $LOAD_PATH << File.expand_path(File.directory?(lib = "#{dir}/lib") ? lib : dir)
end

require 'uuidtools'
require 'highline/import'

def jruby_system_command
  JRUBY ? "jruby -S" : ""
end

def gem_install_command_strings(missing_gems)
  command = JRUBY ? "  jruby -S gem install " : "  sudo ruby gem install "
  command + missing_gems.collect {|g| "#{g[0]} -v'#{g[1]}'"}.join(' ') + "\n"
end

def rails_file_path(*args)
  File.join([RAILS_ROOT] + args)
end

def rails_file_exists?(*args)
  File.exists?(rails_file_path(args))
end

@db_config_path                = rails_file_path(%w{config database.yml})
@db_config_sample_path         = rails_file_path(%w{config database.sample.yml})
@settings_config_path          = rails_file_path(%w{config settings.yml})
@settings_config_sample_path   = rails_file_path(%w{config settings.sample.yml})
@rinet_data_config_path        = rails_file_path(%w{config rinet_data.yml})
@rinet_data_config_sample_path = rails_file_path(%w{config rinet_data.sample.yml})
@mailer_config_path            = rails_file_path(%w{config mailer.yml})
@mailer_config_sample_path     = rails_file_path(%w{config mailer.sample.yml})
@sds_config_path               = rails_file_path(%w{config sds.yml})
@sds_config_sample_path        = rails_file_path(%w{config sds.sample.yml})

@db_config_sample              = YAML::load_file(@db_config_sample_path)
@settings_config_sample        = YAML::load_file(@settings_config_sample_path)
@rinet_data_config_sample      = YAML::load_file(@rinet_data_config_sample_path)
@mailer_config_sample          = YAML::load_file(@mailer_config_sample_path)
# @sds_config_sample             = YAML::load_file(@sds_config_sample_path)

@new_database_yml_created = false
@new_settings_yml_created = false
{'fraction_non_alphanumeric': 0.12360992301112061, 'fraction_numerical': 0.000855431993156544, 'mean_word_length': 5.074025974025974, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '296814', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1637, 'n_words': 292}