Skip to content

Commit 7ca33c1

Browse files
committed
Update Gemfile to metasploit_data_models 0.6.1
[#45771305] MetasploitDataModels 0.6.1 adds a re-usable yard.rake so that all Metasploit project don't have to define their own. It also adds guards so that the YARD tasks aren't defined (and don't cause errors) if YARD is not available. This also adds support for making the Rakefile work with `bundle install --without development test` so it still functions in the bundle building environment for Pro.
1 parent fac941a commit 7ca33c1

File tree

5 files changed

+53
-59
lines changed

5 files changed

+53
-59
lines changed

.yardopts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--protected
2+
--files CONTRIBUTING.md,COPYING,HACKING,LICENSE
3+
lib/msf/**/*.rb
4+
lib/rex/**/*.rb

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gem 'activerecord'
77
# Needed for some admin modules (scrutinizer_add_user.rb)
88
gem 'json'
99
# Database models shared between framework and Pro.
10-
gem 'metasploit_data_models', :git => 'git://github.com/rapid7/metasploit_data_models.git', :tag => '0.6.0'
10+
gem 'metasploit_data_models', :git => 'git://github.com/rapid7/metasploit_data_models.git', :tag => '0.6.1'
1111
# Needed by msfgui and other rpc components
1212
gem 'msgpack'
1313
# Needed by anemone crawler

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
GIT
22
remote: git://github.com/rapid7/metasploit_data_models.git
3-
revision: 0285d6e199f125b33214100dcb0f4eeb12ee765f
4-
tag: 0.6.0
3+
revision: 01f6a1eb2ac1acc069feac58e4d09a4555389096
4+
tag: 0.6.1
55
specs:
6-
metasploit_data_models (0.6.0)
6+
metasploit_data_models (0.6.1)
77
activerecord (>= 3.2.10)
88
activesupport
99
pg

Rakefile

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,49 @@
11
require 'bundler/setup'
22

3-
require 'rspec/core/rake_task'
4-
require 'yard'
5-
6-
RSpec::Core::RakeTask.new(:spec)
7-
8-
task :default => :spec
9-
10-
namespace :yard do
11-
yard_files = [
12-
# Ruby source files first
13-
'lib/msf/**/*.rb',
14-
'lib/rex/**/*.rb',
15-
# Anything after '-' is a normal documentation, not source
16-
'-',
17-
'COPYING',
18-
'HACKING',
19-
'THIRD-PARTY.md'
20-
]
21-
yard_options = [
22-
# include documentation for protected methods for developers extending the code.
23-
'--protected'
24-
]
25-
26-
YARD::Rake::YardocTask.new(:doc) do |t|
27-
t.files = yard_files
28-
# --no-stats here as 'stats' task called after will print fuller stats
29-
t.options = yard_options + ['--no-stats']
30-
31-
t.after = Proc.new {
32-
Rake::Task['yard:stats'].execute
33-
}
34-
end
35-
36-
desc "Shows stats for YARD Documentation including listing undocumented modules, classes, constants, and methods"
37-
task :stats => :environment do
38-
stats = YARD::CLI::Stats.new
39-
yard_arguments = yard_options + ['--compact', '--list-undoc'] + yard_files
40-
stats.run(*yard_arguments)
41-
end
3+
require 'metasploit_data_models'
4+
5+
print_without = false
6+
7+
begin
8+
require 'rspec/core/rake_task'
9+
rescue LoadError
10+
puts "rspec not in bundle, so can't set up spec tasks. " \
11+
"To run specs ensure to install the development and test groups."
12+
13+
print_without = true
14+
else
15+
RSpec::Core::RakeTask.new(:spec)
16+
17+
task :default => :spec
18+
end
19+
20+
begin
21+
require 'yard'
22+
rescue LoadError
23+
puts "yard not in bundle, so can't set up yard tasks. " \
24+
"To generate documentation ensure to install the development group."
25+
26+
print_without = true
4227
end
4328

44-
# @todo Figure out how to just clone description from yard:doc
45-
desc "Generate YARD documentation"
46-
# allow calling namespace to as a task that goes to default task for namespace
47-
task :yard => ['yard:doc']
29+
metasploit_data_models_task_glob = MetasploitDataModels.root.join(
30+
'lib',
31+
'tasks',
32+
'**',
33+
'*.rake'
34+
).to_s
35+
36+
# include tasks from metasplioit_data_models, such as `rake yard`.
37+
# metasploit-framework specific yard options are in .yardopts
38+
Dir.glob(metasploit_data_models_task_glob) do |path|
39+
load path
40+
end
41+
42+
if print_without
43+
puts "Bundle currently installed " \
44+
"'--without #{Bundler.settings.without.join(' ')}'."
45+
puts "To clear the without option do `bundle install --without ''` " \
46+
"(the --without flag with an empty string) or " \
47+
"`rm -rf .bundle` to remove the .bundle/config manually and " \
48+
"then `bundle install`"
49+
end

documentation/Gemfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)