Sha256: 9a0c39bf2f6b8781c85cacd26c10fb72da8172e39768276abba77e374e722806

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

#
# Core
#
require 'shellwords'

#
# Gems
#
require 'active_record'
require 'active_support'
require 'active_support/all'
require 'active_support/dependencies'

#
# Project
#
require 'mdm'
require 'mdm/module'
require 'metasploit_data_models/version'
require 'metasploit_data_models/serialized_prefs'
require 'metasploit_data_models/base64_serializer'

require 'metasploit_data_models/validators/ip_format_validator'
require 'metasploit_data_models/validators/password_is_strong_validator'

# Only include the Rails engine when using Rails.  This allows the non-Rails projects, like metasploit-framework to use
# the models by calling MetasploitDataModels.require_models.
if defined? Rails
  require 'metasploit_data_models/engine'
end

module MetasploitDataModels
  def self.models_pathname
    root.join('app', 'models')
  end

  def self.require_models
    models_globs = models_pathname.join('**', '*.rb')

    Dir.glob(models_globs) do |model_path|
      require model_path
    end
  end

  def self.root
    unless instance_variable_defined? :@root
      lib_pathname = Pathname.new(__FILE__).dirname

      @root = lib_pathname.parent
    end

    @root
  end
end

lib_pathname = MetasploitDataModels.root.join('lib')
# has to work under 1.8.7, so can't use to_path
lib_path = lib_pathname.to_s
# Add path to gem's lib so that concerns for models are loaded correctly if models are reloaded
ActiveSupport::Dependencies.autoload_paths << lib_path
ActiveSupport::Dependencies.autoload_once_paths << lib_path

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metasploit_data_models-0.12.1-java lib/metasploit_data_models.rb
metasploit_data_models-0.12.1 lib/metasploit_data_models.rb
metasploit_data_models-0.12.0-java lib/metasploit_data_models.rb
metasploit_data_models-0.12.0 lib/metasploit_data_models.rb
metasploit_data_models-0.11.2-java lib/metasploit_data_models.rb
metasploit_data_models-0.11.2 lib/metasploit_data_models.rb