Module: FileUtils
- Included in:
- Fastlane::Saucectl::Espresso, Fastlane::Saucectl::Installer, Fastlane::Saucectl::Runner, Fastlane::Saucectl::Suites, Fastlane::Saucectl::XCTest
- Defined in:
- lib/fastlane/plugin/saucectl/helper/file_utils.rb
Overview
utility module for helper functions
Constant Summary collapse
- CLASS_NAME_REGEX =
/(Spec|Specs|Test|Tests)/.freeze
- FILE_TYPE_REGEX =
/(.swift|.kt|.java)/.freeze
Instance Method Summary collapse
- #find(class_name, regex) ⇒ Object
- #read_file(name) ⇒ Object
- #search_retrieve_test_classes(path) ⇒ Object
- #syscall(*cmd) ⇒ Object
Instance Method Details
#find(class_name, regex) ⇒ Object
20 21 22 |
# File 'lib/fastlane/plugin/saucectl/helper/file_utils.rb', line 20 def find(class_name, regex) syscall("find '#{class_name}' -type f -exec grep -h -C2 '#{regex}' {} +") end |
#read_file(name) ⇒ Object
8 9 10 11 12 |
# File 'lib/fastlane/plugin/saucectl/helper/file_utils.rb', line 8 def read_file(name) raise "File not found: #{name}" unless File.exist?(name) File.read(name).split end |
#search_retrieve_test_classes(path) ⇒ Object
14 15 16 17 18 |
# File 'lib/fastlane/plugin/saucectl/helper/file_utils.rb', line 14 def search_retrieve_test_classes(path) Find.find(path).select do |f| File.file?(f) if File.basename(f) =~ CLASS_NAME_REGEX end end |
#syscall(*cmd) ⇒ Object
24 25 26 |
# File 'lib/fastlane/plugin/saucectl/helper/file_utils.rb', line 24 def syscall(*cmd) Open3.capture3(*cmd) end |