Sha256: 0ec0aff5ca8e59b0271b33fd44ef50f50fdacdd97000245a73b5ffc417378414

Contents?: true

Size: 1.67 KB

Versions: 36

Compression:

Stored size: 1.67 KB

Contents

begin
  require 'rails'
rescue LoadError => error
  warn "rails could not be loaded, so Metasploit::Credential::Engine will not be defined: #{error}"
else
  module Metasploit
    module Credential
      # Rails engine for Metasploit::Credential.  Will automatically be used if `Rails` is defined when
      # 'metasploit/credential' is required, as should be the case in any normal Rails application Gemfile where
      # gem 'rails' is the first gem in the Gemfile.
      class 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

        config.paths.add 'app/concerns', autoload: true
        config.paths.add 'lib', 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
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
metasploit-credential-0.9.1 lib/metasploit/credential/engine.rb
metasploit-credential-0.9.0 lib/metasploit/credential/engine.rb
metasploit-credential-0.9.0-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.9 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.8 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.7-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.7 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.6 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.6.pre.realm.pre.uniqueness lib/metasploit/credential/engine.rb
metasploit-credential-0.8.4-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.4 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.3-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.3 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.2 lib/metasploit/credential/engine.rb
metasploit-credential-0.8.2-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.1-java lib/metasploit/credential/engine.rb
metasploit-credential-0.8.1 lib/metasploit/credential/engine.rb
metasploit-credential-0.7.17-java lib/metasploit/credential/engine.rb
metasploit-credential-0.7.17 lib/metasploit/credential/engine.rb
metasploit-credential-0.7.16-java lib/metasploit/credential/engine.rb