Land #3681, restore rake and rspec functionality

Since this is a more complete fix than #3678 and #3679, this merge
closes #3678 and closes #3679. Lets see if that magic syntax works!
This commit is contained in:
Tod Beardsley
2014-08-20 11:27:09 -05:00
2 changed files with 26 additions and 5 deletions
+25
View File
@@ -34,6 +34,31 @@ module Metasploit
end
end
# Tries to `require 'active_record/railtie'` to define the activerecord Rails initializers and rake tasks.
#
# @example Optionally requiring 'active_record/railtie'
# require 'metasploit/framework/require'
#
# class MyClass
# def setup
# if database_enabled
# Metasploit::Framework::Require.optionally_active_record_railtie
# end
# end
# end
#
# @return [void]
def self.optionally_active_record_railtie
if ::File.exist?(Rails.application.config.paths['config/database'].first)
optionally(
'active_record/railtie',
'activerecord not in the bundle, so database support will be disabled.'
)
else
warn 'Could not find database.yml, so database support will be disabled.'
end
end
# Tries to `require 'metasploit/credential/creation'` and include it in the `including_module`.
#
# @param including_module [Module] `Class` or `Module` that wants to `include Metasploit::Credential::Creation`.
+1 -5
View File
@@ -1,13 +1,9 @@
#!/usr/bin/env ruby
# -*- coding: binary -*-
#
# $Id$
#
# This user interface provides users with a command console interface to the
# framework.
#
# $Revision$
#
#
# Standard Library
@@ -20,7 +16,7 @@ require 'pathname'
#
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
require Pathname.new(__FILE__).expand_path.parent.join('config', 'boot')
require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
require 'metasploit/framework/command/console'
Metasploit::Framework::Command::Console.start