Merges #1728, makes some gems optional for bundler

Verified that pcap, db, and test can be skipped now, should make
Zero_Chaos happy.
unstable
Tod Beardsley 2013-04-12 11:03:00 -05:00
commit e5a7c38f66
3 changed files with 39 additions and 23 deletions

22
Gemfile
View File

@ -2,22 +2,28 @@ source 'http://rubygems.org'
# Need 3+ for ActiveSupport::Concern
gem 'activesupport', '>= 3.0.0'
# Needed for Msf::DbManager
gem 'activerecord'
# Needed for some admin modules (scrutinizer_add_user.rb)
gem 'json'
# Database models shared between framework and Pro.
gem 'metasploit_data_models', '~> 0.6.14'
# Needed by msfgui and other rpc components
gem 'msgpack'
# Needed by anemone crawler
gem 'nokogiri'
# Needed for module caching in Mdm::ModuleDetails
gem 'pg', '>= 0.11'
# Needed by anemone crawler
gem 'robots'
# For sniffer and raw socket modules
gem 'pcaprub'
group :db do
# Needed for Msf::DbManager
gem 'activerecord'
# Database models shared between framework and Pro.
gem 'metasploit_data_models', '~> 0.6.14'
# Needed for module caching in Mdm::ModuleDetails
gem 'pg', '>= 0.11'
end
group :pcap do
# For sniffer and raw socket modules
gem 'pcaprub'
end
group :development do
# Markdown formatting for yard

View File

@ -1,7 +1,5 @@
require 'bundler/setup'
require 'metasploit_data_models'
pathname = Pathname.new(__FILE__)
root = pathname.parent
@ -18,6 +16,8 @@ $LOAD_PATH.unshift(lib_pathname.to_s)
rakefile_glob = root.join('lib', 'tasks', '**', '*.rake').to_path
Dir.glob(rakefile_glob) do |rakefile|
# Skip database tasks, will load them later if MDM is present
next if rakefile =~ /database\.rake$/
load rakefile
end
@ -36,6 +36,28 @@ else
task :default => :spec
end
begin
require 'metasploit_data_models'
rescue LoadError
puts "metasploit_data_models not in bundle, so can't set up db tasks. " \
"To run database tasks, ensure to install the db bundler group."
print_without = true
else
load 'lib/tasks/database.rake'
metasploit_data_models_task_glob = MetasploitDataModels.root.join(
'lib',
'tasks',
'**',
'*.rake'
).to_s
# include tasks from metasplioit_data_models, such as `rake yard`.
# metasploit-framework specific yard options are in .yardopts
Dir.glob(metasploit_data_models_task_glob) do |path|
load path
end
end
begin
require 'yard'
rescue LoadError
@ -45,18 +67,6 @@ rescue LoadError
print_without = true
end
metasploit_data_models_task_glob = MetasploitDataModels.root.join(
'lib',
'tasks',
'**',
'*.rake'
).to_s
# include tasks from metasplioit_data_models, such as `rake yard`.
# metasploit-framework specific yard options are in .yardopts
Dir.glob(metasploit_data_models_task_glob) do |path|
load path
end
if print_without
puts "Bundle currently installed " \

View File

@ -1,6 +1,6 @@
require 'rubygems'
require 'bundler'
Bundler.require(:default, :test)
Bundler.require(:default, :test, :db)
# add project lib directory to load path
spec_pathname = Pathname.new(__FILE__).dirname