Class: XCKnife::TestDumper
- Inherits:
-
Object
- Object
- XCKnife::TestDumper
- Defined in:
- lib/xcknife/test_dumper.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args, logger: Logger.new($stdout, progname: 'xcknife test dumper')) ⇒ TestDumper
constructor
A new instance of TestDumper.
- #run ⇒ Object
Constructor Details
#initialize(args, logger: Logger.new($stdout, progname: 'xcknife test dumper')) ⇒ TestDumper
Returns a new instance of TestDumper.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/xcknife/test_dumper.rb', line 20 def initialize(args, logger: Logger.new($stdout, progname: 'xcknife test dumper')) @debug = false @max_retry_count = 150 @temporary_output_folder = nil @xcscheme_file = nil @parser = build_parser @naive_dump_bundle_names = [] @skip_dump_bundle_names = [] parse_arguments(args) @device_id ||= "booted" @logger = logger @logger.level = @debug ? Logger::DEBUG : Logger::FATAL @parser = nil end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
18 19 20 |
# File 'lib/xcknife/test_dumper.rb', line 18 def logger @logger end |
Class Method Details
.invoke ⇒ Object
14 15 16 |
# File 'lib/xcknife/test_dumper.rb', line 14 def self.invoke new(ARGV).run end |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/xcknife/test_dumper.rb', line 35 def run helper = TestDumperHelper.new(@device_id, @max_retry_count, @debug, @logger, @dylib_logfile_path, naive_dump_bundle_names: @naive_dump_bundle_names, skip_dump_bundle_names: @skip_dump_bundle_names) extra_environment_variables = parse_scheme_file logger.info { "Environment variables from xcscheme: #{extra_environment_variables.pretty_inspect}" } output_fd = File.open(@output_file, "w") if @temporary_output_folder.nil? Dir.mktmpdir("xctestdumper_") do |outfolder| list_tests(extra_environment_variables, helper, outfolder, output_fd) end else unless File.directory?(@temporary_output_folder) raise TestDumpError, "Error no such directory: #{@temporary_output_folder}" end if Dir.entries(@temporary_output_folder).any? { |f| File.file?(File.join(@temporary_output_folder,f)) } puts "Warning: #{@temporary_output_folder} is not empty! Files can be overwritten." end list_tests(extra_environment_variables, helper, File.absolute_path(@temporary_output_folder), output_fd) end output_fd.close puts "Done listing test methods" end |