Sha256: 73c272517282e99ab4b1a8915f4528557f1cc774ff9c9ca59a33f9e6d288cfea

Contents?: true

Size: 1.7 KB

Versions: 21

Compression:

Stored size: 1.7 KB

Contents

require 'rails'

# Rails engine for Metasploit::Credential.
class Metasploit::Credential::Engine < Rails::Engine
  # @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
  config.generators do |g|
    g.assets false
    g.fixture_replacement :factory_girl, dir: 'spec/factories'
    g.helper false
    g.test_framework :rspec, fixture: false
  end

  # Remove ActiveSupport::Dependencies loading paths to save time during constant resolution and to ensure that
  # metasploit_data_models is properly declaring all autoloads and not falling back on ActiveSupport::Dependencies
  config.paths.values.each do |path|
    path.skip_autoload!
    path.skip_autoload_once!
    path.skip_eager_load!
    path.skip_load_path!
  end

  # metasploit-concern only works with ActiveSupport::Dependencies.autoloading because the extended class only
  # knows about the concerns from the load hooks and so the extended class can't use Kernel.autoload to load the
  # concerns.
  config.paths.add 'app/concerns', autoload: true

  initializer 'metasploit_credential.prepend_factory_path',
              # factory paths from the final Rails.application
              after: 'factory_girl.set_factory_paths',
              # before metasploit_data_models because it prepends
              before: 'metasploit_data_models.prepend_factory_path' do
    if defined? FactoryGirl
      relative_definition_file_path = config.generators.options[:factory_girl][:dir]
      definition_file_path = root.join(relative_definition_file_path)

      # unshift so that projects that use metasploit-credential can modify metasploit_credential_* factories
      FactoryGirl.definition_file_paths.unshift definition_file_path
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
metasploit-credential-2.0.14 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.13 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.12 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.11 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.10 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.9 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.8 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.7 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.6 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.5 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.4 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.3 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.2 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.1 lib/metasploit/credential/engine.rb
metasploit-credential-2.0.0 lib/metasploit/credential/engine.rb
metasploit-credential-1.1.0 lib/metasploit/credential/engine.rb
metasploit-credential-1.0.1 lib/metasploit/credential/engine.rb
metasploit-credential-1.0.0 lib/metasploit/credential/engine.rb
metasploit-credential-1.0.0.pre.rails.pre.4.0c lib/metasploit/credential/engine.rb
metasploit-credential-1.0.0.pre.rails.pre.4.0b lib/metasploit/credential/engine.rb