Skip to content

Commit dee02fc

Browse files
committed
Automatically clear previous log/metasploit/framework/spec/constants/each.log
MSP-11130 Have a task, 'metasploit:framework:spec:constants:each:clean' run before `rake spec` that removes the previous `log/metasploit/framework/spec/constants/each.log` so that the user doesn't have to manually remove the load when removing `Metasploit::Framework::Spec::Constants::Each.configure!` from `spec/spec_helper.rb`.
1 parent 313d869 commit dee02fc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/metasploit/framework/spec/constants/each.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def self.configure!
7474
LOG_PATHNAME.open('w') { |f|
7575
f.puts "No leaks were cleaned by `Metasploit::Framework::Spec::Constants::Each.configured!`. Remove " \
7676
"it from `spec/spec_helper.rb` so it does not interfere with contexts that persist loaded " \
77-
"modules for entire context and clean up modules in `after(:all)` and then `rm log/remove-cleaner`"
77+
"modules for entire context and clean up modules in `after(:all)`"
7878
}
7979
end
8080
end
@@ -96,6 +96,14 @@ def self.configured?
9696
#
9797
# @return [void]
9898
def self.define_task
99+
Rake::Task.define_task('metasploit:framework:spec:constant:each:clean') do
100+
if LOG_PATHNAME.exist?
101+
LOG_PATHNAME.delete
102+
end
103+
end
104+
105+
Rake::Task.define_task(spec: 'metasploit:framework:spec:constant:each:clean')
106+
99107
Rake::Task.define_task(:spec) do
100108
if LOG_PATHNAME.exist?
101109
LOG_PATHNAME.open { |f|

spec/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@
5656
config.use_transactional_fixtures = true
5757
end
5858

59-
Metasploit::Framework::Spec::Constants::Each.configure!
6059
Metasploit::Framework::Spec::Constants::Suite.configure!

0 commit comments

Comments
 (0)