<commit_before>
$KCODE='u'

AUTHORIZATION_MIXIN = "object roles"
DEFAULT_REDIRECTION_HASH = { :controller => '/manage/access', :action => 'denied' }

# Be sure to restart your web server when you modify this file.


# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
ENV['RAILS_ENV'] ||= 'production' 
ENV['HOME'] ||= '/home/webiva'


# Specifies gem version of Rails to use when vendor/rails is not present
# RAILS_GEM_VERSION = '2.3.4'


require 'yaml'

# Set up some constants
  defaults_config_file = YAML.load_file(File.join(File.dirname(__FILE__), "defaults.yml"))
  
  CMS_DEFAULTS = defaults_config_file

  WEBIVA_LOGO_FILE = defaults_config_file['logo_override'] || nil 

  CMS_DEFAULT_LANGUAGE = defaults_config_file['default_language'] || 'en'
  CMS_DEFAULT_CONTRY = defaults_config_file['default_country'] || 'US'
  CMS_CACHE_ACTIVE = defaults_config_file['active_cache'] || true
  CMS_DEFAULT_DOMAIN = defaults_config_file['domain']
  
  CMS_SYSTEM_ADMIN_EMAIL = defaults_config_file['system_admin']

   CMS_EDITOR_LOGIN_SUPPORT = defaults_config_file['editor_login'] || false
  
  DEFAULT_DATETIME_FORMAT = defaults_config_file['default_datetime_format'] || "%m/%d/%Y %I:%M %p"
  DEFAULT_DATE_FORMAT = defaults_config_file['default_date_format'] || "%m/%d/%Y"
  
  BETA_CODE = defaults_config_file['enable_beta_code'] || false
  

 
  GIT_REPOSITORY = defaults_config_file['git_repository'] || nil 

  CMS_DEFAULT_TIME_ZONE = defaults_config_file['time_zone'] || 'Eastern Time (US & Canada)'

#RAILS_ROOT = File.dirname(__FILE__) + "../" unless defined?(RAILS_ROOT)

require File.join(File.dirname(__FILE__), 'boot')


class Rails::Plugin

  def webiva_remove_load_paths(file)
    dir =  File.dirname(file)
    begin
      load_paths.each do |path|
        ActiveSupport::Dependencies.load_once_paths.delete(path) if  path.include?(dir)
      end
    rescue Exception => e
      load_paths.each do |path|
        Dependencies.load_once_paths.delete(path) if  path.include?(dir)
      end
    end

  end

end

Rails::Initializer.run do |config|


  config.database_configuration_file = "#{RAILS_ROOT}/config/cms.yml"
  config.action_controller.session_store = :mem_cache_store
  config.plugin_paths = ["#{RAILS_ROOT}/vendor/plugins", "#{RAILS_ROOT}/vendor/modules" ]
  
  config.time_zone = CMS_DEFAULT_TIME_ZONE
  
 #config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| 
 #  File.directory?(lib = "#{dir}/lib") ? lib : dir
 #end
  
  config.gem 'mysql'
  config.gem 'mime-types', :lib => 'mime/types'
  config.gem 'radius'
  config.gem 'RedCloth', :lib => 'redcloth'
  config.gem 'BlueCloth', :lib => 'bluecloth'
  config.gem 'gruff'
  config.gem 'slave'
  config.gem 'hpricot'
  config.gem 'daemons'
  config.gem 'maruku'
  config.gem 'net-ssh', :lib => 'net/ssh'
  config.gem 'rmagick', :lib => 'RMagick'
  config.gem 'libxml-ruby', :lib => 'xml'
  config.gem 'soap4r', :lib => 'soap/soap'
  config.gem "json"



  if CMS_CACHE_ACTIVE
    config.gem 'memcache-client', :lib => 'memcache'
  end
  
end

# Only use X_SEND_FILE if it's enabled and we're not in test mode
USE_X_SEND_FILE =  (RAILS_ENV == 'test' || RAILS_ENV == 'cucumber' || RAILS_ENV == 'selenium') ? false : (defaults_config_file['use_x_send_file'] || false)

 memcache_options = {
    :c_threshold => 10_000,
    :compression => true,
    :debug => false,
    :namespace => 'Webiva',
    :readonly => false,
    :urlencode => false
  }

CACHE = MemCache.new memcache_options

# Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new
Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new
Workling::Return::Store::Base # Load the base module first
Workling::Return::Store.instance = CACHE
if RAILS_ENV == 'production'
  Workling::Base.logger = ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/../log/workling_#{RAILS_ENV}.log", ActiveSupport::BufferedLogger::INFO)
else
  Workling::Base.logger = DevelopmentLogger.new(File.dirname(__FILE__) + "/../log/workling_#{RAILS_ENV}.log", 0, 0)<commit_msg>Added factory gem requirement<commit_after>
$KCODE='u'

AUTHORIZATION_MIXIN = "object roles"
DEFAULT_REDIRECTION_HASH = { :controller => '/manage/access', :action => 'denied' }

# Be sure to restart your web server when you modify this file.


# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
ENV['RAILS_ENV'] ||= 'production' 
ENV['HOME'] ||= '/home/webiva'


# Specifies gem version of Rails to use when vendor/rails is not present
# RAILS_GEM_VERSION = '2.3.4'


require 'yaml'

# Set up some constants
  defaults_config_file = YAML.load_file(File.join(File.dirname(__FILE__), "defaults.yml"))
  
  CMS_DEFAULTS = defaults_config_file

  WEBIVA_LOGO_FILE = defaults_config_file['logo_override'] || nil 

  CMS_DEFAULT_LANGUAGE = defaults_config_file['default_language'] || 'en'
  CMS_DEFAULT_CONTRY = defaults_config_file['default_country'] || 'US'
  CMS_CACHE_ACTIVE = defaults_config_file['active_cache'] || true
  CMS_DEFAULT_DOMAIN = defaults_config_file['domain']
  
  CMS_SYSTEM_ADMIN_EMAIL = defaults_config_file['system_admin']

   CMS_EDITOR_LOGIN_SUPPORT = defaults_config_file['editor_login'] || false
  
  DEFAULT_DATETIME_FORMAT = defaults_config_file['default_datetime_format'] || "%m/%d/%Y %I:%M %p"
  DEFAULT_DATE_FORMAT = defaults_config_file['default_date_format'] || "%m/%d/%Y"
  
  BETA_CODE = defaults_config_file['enable_beta_code'] || false
  

 
  GIT_REPOSITORY = defaults_config_file['git_repository'] || nil 

  CMS_DEFAULT_TIME_ZONE = defaults_config_file['time_zone'] || 'Eastern Time (US & Canada)'

#RAILS_ROOT = File.dirname(__FILE__) + "../" unless defined?(RAILS_ROOT)

require File.join(File.dirname(__FILE__), 'boot')


class Rails::Plugin

  def webiva_remove_load_paths(file)
    dir =  File.dirname(file)
    begin
      load_paths.each do |path|
        ActiveSupport::Dependencies.load_once_paths.delete(path) if  path.include?(dir)
      end
    rescue Exception => e
      load_paths.each do |path|
        Dependencies.load_once_paths.delete(path) if  path.include?(dir)
      end
    end

  end

end

Rails::Initializer.run do |config|


  config.database_configuration_file = "#{RAILS_ROOT}/config/cms.yml"
  config.action_controller.session_store = :mem_cache_store
  config.plugin_paths = ["#{RAILS_ROOT}/vendor/plugins", "#{RAILS_ROOT}/vendor/modules" ]
  
  config.time_zone = CMS_DEFAULT_TIME_ZONE
  
 #config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| 
 #  File.directory?(lib = "#{dir}/lib") ? lib : dir
 #end
  
  config.gem 'mysql'
  config.gem 'mime-types', :lib => 'mime/types'
  config.gem 'radius'
  config.gem 'RedCloth', :lib => 'redcloth'
  config.gem 'BlueCloth', :lib => 'bluecloth'
  config.gem 'gruff'
  config.gem 'slave'
  config.gem 'hpricot'
  config.gem 'daemons'
  config.gem 'maruku'
  config.gem 'net-ssh', :lib => 'net/ssh'
  config.gem 'rmagick', :lib => 'RMagick'
  config.gem 'libxml-ruby', :lib => 'xml'
  config.gem 'soap4r', :lib => 'soap/soap'
  config.gem "json"

  if RAILS_ENV == 'test'
    config.gem 'factory_girl',:source => 'http://gemcutter.org'
  end  

  if CMS_CACHE_ACTIVE
    config.gem 'memcache-client', :lib => 'memcache'
  end
  
end

# Only use X_SEND_FILE if it's enabled and we're not in test mode
USE_X_SEND_FILE =  (RAILS_ENV == 'test' || RAILS_ENV == 'cucumber' || RAILS_ENV == 'selenium') ? false : (defaults_config_file['use_x_send_file'] || false)

 memcache_options = {
    :c_threshold => 10_000,
    :compression => true,
    :debug => false,
    :namespace => 'Webiva',
    :readonly => false,
    :urlencode => false
  }

CACHE = MemCache.new memcache_options

# Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new
Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new
Workling::Return::Store::Base # Load the base module first
Workling::Return::Store.instance = CACHE
if RAILS_ENV == 'production'
  Workling::Base.logger = ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/../log/workling_#{RAILS_ENV}.log", ActiveSupport::BufferedLogger::INFO)
else
  Workling::Base.logger = DevelopmentLogger.new(File.dirname(__FILE__) + "/../log/workling_#{RAILS_ENV}.log", 0, 0)
{'fraction_non_alphanumeric': 0.13955991389619707, 'fraction_numerical': 0.0026309495336044007, 'mean_word_length': 4.775552486187845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6113360', 'n_tokens_mistral': 3007, 'n_tokens_neox': 2894, 'n_words': 571}