This file is indexed.

/usr/lib/ruby/vendor_ruby/database_cleaner/configuration.rb is in ruby-database-cleaner 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
require 'database_cleaner/base'

module DatabaseCleaner

  class NoORMDetected < StandardError;   end
  class UnknownStrategySpecified < ArgumentError;   end

  class << self
    def init_cleaners
      @cleaners ||= {}
      # ghetto ordered hash.. maintains 1.8 compat and old API
      @connections ||= []
    end

    def [](orm,opts = {})
      raise NoORMDetected unless orm
      init_cleaners
      # TODO: deprecate
      # this method conflates creation with lookup.  Both a command and a query. Yuck.
      if @cleaners.has_key? [orm, opts]
        @cleaners[[orm, opts]]
      else
        add_cleaner(orm, opts)
      end
    end

    def add_cleaner(orm,opts = {})
      init_cleaners
      cleaner = DatabaseCleaner::Base.new(orm,opts)
      @cleaners[[orm, opts]] = cleaner
      @connections << cleaner
      cleaner
    end

    def app_root=(desired_root)
      @app_root = desired_root
    end

    def app_root
      @app_root ||= Dir.pwd
    end

    def connections
      # double yuck.. can't wait to deprecate this whole class...
      unless @cleaners
        autodetected = ::DatabaseCleaner::Base.new
        add_cleaner(autodetected.orm)
      end
      @connections
    end

    def logger=(log_source)
      @logger = log_source
    end

    def logger
      return @logger if @logger

      @logger = Logger.new(STDOUT)
      @logger.level = Logger::ERROR
      @logger
    end

    def strategy=(stratagem)
      connections.each { |connect| connect.strategy = stratagem }
      remove_duplicates
    end

    def orm=(orm)
      connections.each { |connect| connect.orm = orm }
      remove_duplicates
    end

    def start
      connections.each { |connection| connection.start }
    end

    def clean
      connections.each { |connection| connection.clean }
    end

    alias clean! clean

    def cleaning(&inner_block)
      connections.inject(inner_block) do |curr_block, connection|
        proc { connection.cleaning(&curr_block) }
      end.call
    end

    def clean_with(*args)
      connections.each { |connection| connection.clean_with(*args) }
    end

    alias clean_with! clean_with

    def remove_duplicates
      temp = []
      connections.each do |connect|
        temp.push connect unless temp.include? connect
      end
      @connections = temp
    end

    def orm_module(symbol)
      case symbol
        when :active_record
          DatabaseCleaner::ActiveRecord
        when :data_mapper
          DatabaseCleaner::DataMapper
        when :mongo
          DatabaseCleaner::Mongo
        when :mongoid
          DatabaseCleaner::Mongoid
        when :mongo_mapper
          DatabaseCleaner::MongoMapper
        when :moped
          DatabaseCleaner::Moped
        when :couch_potato
          DatabaseCleaner::CouchPotato
        when :sequel
          DatabaseCleaner::Sequel
        when :ohm
          DatabaseCleaner::Ohm
        when :redis
          DatabaseCleaner::Redis
      end
    end
  end
end