replaced File.exists? with File.exist? (#2511)

This commit is contained in:
Alton Johnson, OSCP, OSCE
2023-08-15 18:53:26 -04:00
committed by GitHub
parent ca7374abdb
commit e2474f6e12
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -78,7 +78,7 @@ class AtomicRedTeam
yaml_file = "#{ATOMICS_DIRECTORY}/#{technique_identifier}/#{technique_identifier}.yaml"
markdown_file = "#{ATOMICS_DIRECTORY}/#{technique_identifier}/#{technique_identifier}.md"
if atomic_yaml_has_test_for_platform(yaml_file, only_platform) && (File.exists? markdown_file)
if atomic_yaml_has_test_for_platform(yaml_file, only_platform) && (File.exist? markdown_file)
# we have a file for this technique, so link to it's Markdown file
"[#{link_display}](../../#{technique_identifier}/#{technique_identifier}.md)"
else
@@ -89,7 +89,7 @@ class AtomicRedTeam
def atomic_yaml_has_test_for_platform(yaml_file, only_platform)
has_test_for_platform = false
if File.exists? yaml_file
if File.exist? yaml_file
yaml = YAML.load_file(yaml_file)
yaml['atomic_tests'].each_with_index do |atomic, i|
if atomic["supported_platforms"].any? {|platform| platform.downcase =~ only_platform}
+1 -1
View File
@@ -107,7 +107,7 @@ class Attack
@attack_stix ||= begin
# load the full attack library
local_attack_json_to_try = "#{File.dirname(__FILE__)}/enterprise-attack.json"
if File.exists? local_attack_json_to_try
if File.exist? local_attack_json_to_try
JSON.parse File.read(local_attack_json_to_try)
else
JSON.parse open('https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json').read
+1 -1
View File
@@ -25,7 +25,7 @@ usage! if technique_id.nil?
technique_id = technique_id.upcase
technique_atomic_test_file = "#{File.dirname(File.dirname(__FILE__))}/atomics/#{technique_id}/#{technique_id}.yaml"
if File.exists? technique_atomic_test_file
if File.exist? technique_atomic_test_file
puts "Atomic tests for #{technique_id} already exist - adding a new atomic test to the end"
File.open(technique_atomic_test_file, 'a') { |f| f.write("\n#{template_technique_atomic_test}") }