<commit_before># Check the Ruby version
STDERR.puts "NOTICE: You are running Adhearsion in
(Ruby #{RUBY_VERSION} #{RUBY_RELEASE_DATE}).
We are not dropping #{RUBY_VERSION} support,
but we encourage you for an upgrade." if RUBY_VERSION < "1.8.5"

$: << File.expand_path(File.dirname(__FILE__))

%w{
  rubygems
  bundler/setup

  active_support/all
  uuid
  future-resource
  punchblock
  ostruct
  log4r
  theatre
  ruby_speech
  countdownlatch

  adhearsion/foundation/all
}.each { |f| require f }

module Adhearsion
  extend ActiveSupport::Autoload

  autoload :Asterisk
  autoload :Call
  autoload :CallRouting
  autoload :Calls
  autoload :Commands
  autoload :Components
  autoload :Configuration
  autoload :Console
  autoload :Constants
  autoload :Conveniences
  autoload :DialPlan
  autoload :Dispatcher
  autoload :DSL
  autoload :Events
  autoload :Initializer
  autoload :Logging
  autoload :OutboundCall
  autoload :Punchblock
  autoload :Version

  # Sets up the Gem require path.
  AHN_INSTALL_DIR = File.expand_path(File.dirname(__FILE__) + "/..")
  AHN_CONFIG = Configuration.new

  ##
  # This Array holds all the Threads whose life matters. Adhearsion will not exit until all of these have died.
  #
  IMPORTANT_THREADS = []

  mattr_accessor :status

  class << self

    ##
    # Shuts down the framework.
    #
    def shutdown!
      if self.status == :stopping
        # This is the second shutdown request we've received while attempting
        # to shut down gracefully.  At this point, let's pull the plug...
        ahn_log.warning "Shutting down immediately at #{Time.now}"
        exit
      end
      ahn_log "Shutting down gracefully at #{Time.now}."
      self.status = :stopping
      Events.trigger_immediately :shutdown
      Events.stop!
      exit
    end

    def active_calls
      @calls ||= Calls.new
    end

    def receive_call_from(offer)
      Call.new(offer).tap do |call|
        active_calls << call
      end
    end

    def remove_inactive_call(call)
      active_calls.remove_inactive_call(call)
    end
  end

  Hangup = Class.new StandardError # At the moment, we'll just use this to end a call-handling Thread
  PlaybackError = Class.new StandardError # Represents failure to play audio, such as when the sound file cannot be found
  RecordError = Class.new StandardError # Represents failure to record such as when a file cannot be written.
end
<commit_msg>Revert "Adding NOTICE message for 1.8.7"<commit_after># Check the Ruby version
STDERR.puts "WARNING: You are running Adhearsion in an unsupported
version of Ruby (Ruby #{RUBY_VERSION} #{RUBY_RELEASE_DATE})!
Please upgrade to at least Ruby v1.8.5." if RUBY_VERSION < "1.8.5"

$: << File.expand_path(File.dirname(__FILE__))

%w{
  rubygems
  bundler/setup

  active_support/all
  uuid
  future-resource
  punchblock
  ostruct
  log4r
  theatre
  ruby_speech
  countdownlatch

  adhearsion/foundation/all
}.each { |f| require f }

module Adhearsion
  extend ActiveSupport::Autoload

  autoload :Asterisk
  autoload :Call
  autoload :CallRouting
  autoload :Calls
  autoload :Commands
  autoload :Components
  autoload :Configuration
  autoload :Console
  autoload :Constants
  autoload :Conveniences
  autoload :DialPlan
  autoload :Dispatcher
  autoload :DSL
  autoload :Events
  autoload :Initializer
  autoload :Logging
  autoload :OutboundCall
  autoload :Punchblock
  autoload :Version

  # Sets up the Gem require path.
  AHN_INSTALL_DIR = File.expand_path(File.dirname(__FILE__) + "/..")
  AHN_CONFIG = Configuration.new

  ##
  # This Array holds all the Threads whose life matters. Adhearsion will not exit until all of these have died.
  #
  IMPORTANT_THREADS = []

  mattr_accessor :status

  class << self

    ##
    # Shuts down the framework.
    #
    def shutdown!
      if self.status == :stopping
        # This is the second shutdown request we've received while attempting
        # to shut down gracefully.  At this point, let's pull the plug...
        ahn_log.warning "Shutting down immediately at #{Time.now}"
        exit
      end
      ahn_log "Shutting down gracefully at #{Time.now}."
      self.status = :stopping
      Events.trigger_immediately :shutdown
      Events.stop!
      exit
    end

    def active_calls
      @calls ||= Calls.new
    end

    def receive_call_from(offer)
      Call.new(offer).tap do |call|
        active_calls << call
      end
    end

    def remove_inactive_call(call)
      active_calls.remove_inactive_call(call)
    end
  end

  Hangup = Class.new StandardError # At the moment, we'll just use this to end a call-handling Thread
  PlaybackError = Class.new StandardError # Represents failure to play audio, such as when the sound file cannot be found
  RecordError = Class.new StandardError # Represents failure to record such as when a file cannot be written.
end

{'fraction_non_alphanumeric': 0.07220961419434702, 'fraction_numerical': 0.0028883845677738808, 'mean_word_length': 3.1937716262975777, 'pattern_counts': {'":': 0, '<': 17, '<?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': '3051451', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1538, 'n_words': 494}