Rakefile in dawnscanner-1.3.5 vs Rakefile in dawnscanner-1.4.0

- old
+ new

@@ -17,11 +17,11 @@ RSpec::Core::RakeTask.new do |t| t.rspec_opts = ["--color"] end -task :default => [ :spec, :features, :kb ] +task :default => [ :spec, :features, :'kb:create', :'kb:lint' ] task :test => :spec task :prepare => [:build, :'checksum:calculate', :'checksum:commit'] task :release => [:prepare] namespace :version do @@ -114,12 +114,12 @@ file.puts "\tit \"is reported when...\"" file.puts "end" end puts "#{spec_filename} created" - puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN spec/lib/dawn/knowledgebase_spec.rb in order to reflect changes" - puts "*** PLEASE ADD THIS CODE IN lib/dawn/knowledge_base.rb in order to reflect changes" + puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN ./spec/lib/dawn/codesake_knowledgebase_spec.rb in order to reflect changes" + puts "*** PLEASE ADD THIS CODE IN ./lib/dawn/knowledge_base.rb in order to reflect changes" puts "require \"dawn/kb/#{class_name.downcase}\"" puts "it \"must have test for #{name}\" do" puts " sc = kb.find(\"#{name}\")" puts " sc.should_not be_nil" puts " sc.class.should == Dawn::Kb::#{class_name}" @@ -177,12 +177,12 @@ file.puts "end" end puts "#{spec_filename} created" - puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN spec/lib/dawn/codesake_knowledgebase_spec.rb in order to reflect changes" - puts "*** PLEASE ADD THIS CODE IN lib/dawn/knowledge_base.rb in order to reflect changes" + puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN ./spec/lib/dawn/codesake_knowledgebase_spec.rb in order to reflect changes" + puts "*** PLEASE ADD THIS CODE IN ./lib/dawn/knowledge_base.rb in order to reflect changes" puts "require \"dawn/kb/#{class_name.downcase}\"" puts "it \"must have test for #{name}\" do" puts " sc = kb.find(\"#{name}\")" puts " sc.should_not be_nil" puts " sc.class.should == Dawn::Kb::#{class_name}" @@ -238,12 +238,12 @@ file.puts "end" end puts "#{spec_filename} created" - puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN spec/lib/dawn/knowledgebase_spec.rb in order to reflect changes" - puts "*** PLEASE ADD THIS CODE IN lib/dawn/knowledge_base.rb in order to reflect changes" + puts "*** PLEASE IMPLEMENT TEST FOR #{name} IN ./spec/lib/dawn/codesake_knowledgebase_spec.rb in order to reflect changes" + puts "*** PLEASE ADD THIS CODE IN ./lib/dawn/knowledge_base.rb in order to reflect changes" puts "require \"dawn/kb/#{class_name.downcase}\"" puts "it \"must have test for #{name}\" do" puts " sc = kb.find(\"#{name}\")" puts " sc.should_not be_nil" puts " sc.class.should == Dawn::Kb::#{class_name}" @@ -259,29 +259,30 @@ l = check.lint puts "check #{check.name} has this attribute(s) with a nil value: #{l.to_s}" unless l.size == 0 end end -desc 'Creates a KnowledgeBase.md file' -task :create do - checks = Dawn::KnowledgeBase.new.all - open("KnowledgeBase.md", "w") do |file| - file.puts "# Dawn Knowledge base" - file.puts "\nThe knowledge base library for Dawn version #{Dawn::VERSION} contains #{checks.count} security checks." - file.puts "---" - checks.each do |c| - file.puts "* [#{c.name}](#{c.cve_link}): #{c.message}" if c.name.start_with?('CVE') - file.puts "* [#{c.name}](#{c.osvdb_link}): #{c.message}" if c.name.start_with?('OSVDB') - file.puts "* #{c.name}: #{c.message}" unless c.name.start_with?('CVE') + + desc 'Creates a KnowledgeBase.md file' + task :create do + checks = Dawn::KnowledgeBase.new.all + open("KnowledgeBase.md", "w") do |file| + file.puts "# Dawn Knowledge base" + file.puts "\nThe knowledge base library for Dawn version #{Dawn::VERSION} contains #{checks.count} security checks." + file.puts "---" + checks.each do |c| + file.puts "* [#{c.name}](#{c.cve_link}): #{c.message}" if c.name.start_with?('CVE') + file.puts "* [#{c.name}](#{c.osvdb_link}): #{c.message}" if c.name.start_with?('OSVDB') + file.puts "* #{c.name}: #{c.message}" unless c.name.start_with?('CVE') + end + + file.puts "\n\n_Last updated: #{Time.now.strftime("%a %d %b %T %Z %Y")}_" end + puts "KnowledgeBase.md file successfully generated" - file.puts "\n\n_Last updated: #{Time.now.strftime("%a %d %b %T %Z %Y")}_" end - puts "KnowledgeBase.md file successfully generated" - end -end require 'digest/sha1' namespace :checksum do desc 'Calculate gem checksum' @@ -323,10 +324,10 @@ # Exclusion # CVE-2007-6183 is a vulnerability in gnome2 ruby binding. Not a gem, I don't care # CVE-2013-1878 is a duplicate of CVE-2013-2617 that is in knowledge base # CVE-2013-1876 is a duplicate of CVE-2013-2615 that is in knowledge base exclusion = ["CVE-2007-6183", "CVE-2013-1876", "CVE-2013-1878"] - if exclusion.include?(cve) + if exclusion.include?(cve) puts "#{cve} is in the exclusion list" else found = Dawn::KnowledgeBase.find(nil, cve) puts "#{cve} NOT in dawn v#{Dawn::VERSION} knowledge base" unless found list << cve unless found