Fix specs with bundler groups
Also output warnings when running Rake when the db group isn't included.unstable
parent
fde119e889
commit
e3ab2e9747
38
Rakefile
38
Rakefile
|
@ -1,7 +1,5 @@
|
||||||
require 'bundler/setup'
|
require 'bundler/setup'
|
||||||
|
|
||||||
require 'metasploit_data_models'
|
|
||||||
|
|
||||||
pathname = Pathname.new(__FILE__)
|
pathname = Pathname.new(__FILE__)
|
||||||
root = pathname.parent
|
root = pathname.parent
|
||||||
|
|
||||||
|
@ -18,6 +16,8 @@ $LOAD_PATH.unshift(lib_pathname.to_s)
|
||||||
rakefile_glob = root.join('lib', 'tasks', '**', '*.rake').to_path
|
rakefile_glob = root.join('lib', 'tasks', '**', '*.rake').to_path
|
||||||
|
|
||||||
Dir.glob(rakefile_glob) do |rakefile|
|
Dir.glob(rakefile_glob) do |rakefile|
|
||||||
|
# Skip database tasks, will load them later if MDM is present
|
||||||
|
next if rakefile =~ /database\.rake$/
|
||||||
load rakefile
|
load rakefile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,6 +36,28 @@ else
|
||||||
task :default => :spec
|
task :default => :spec
|
||||||
end
|
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
|
begin
|
||||||
require 'yard'
|
require 'yard'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
@ -45,18 +67,6 @@ rescue LoadError
|
||||||
print_without = true
|
print_without = true
|
||||||
end
|
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
|
if print_without
|
||||||
puts "Bundle currently installed " \
|
puts "Bundle currently installed " \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
Bundler.require(:default, :test)
|
Bundler.require(:default, :test, :db)
|
||||||
|
|
||||||
# add project lib directory to load path
|
# add project lib directory to load path
|
||||||
spec_pathname = Pathname.new(__FILE__).dirname
|
spec_pathname = Pathname.new(__FILE__).dirname
|
||||||
|
|
Loading…
Reference in New Issue