Class: Fastlane::Helper::DebugFileHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::DebugFileHelper
- Defined in:
- lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb
Class Method Summary collapse
- .compress(src_files, desc_file) ⇒ Object
- .determine_output_file(output_file, overwrite) ⇒ Object
- .fetch_key(plist, *keys) ⇒ Object
- .macho_metadata(file) ⇒ Object
- .store_shard_value(key, value) ⇒ Object
- .xcarchive_metadata(path) ⇒ Object
Class Method Details
.compress(src_files, desc_file) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 8 def self.compress(src_files, desc_file) require 'zip' output_path = File.dirname(desc_file) FileUtils.mkdir_p output_path unless Dir.exist?(output_path) ::Zip::File.open(desc_file, ::Zip::File::CREATE) do |zipfile| src_files.each do |file| if File.file?(file) zipfile.add File.basename(file), file else root_path = "#{File.dirname(file)}/" Dir[File.join(file, '**', '*')].each do |path| zip_path = path.sub(root_path, '') zipfile.add(zip_path, path) end end end end end |
.determine_output_file(output_file, overwrite) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 28 def self.determine_output_file(output_file, overwrite) if File.exist?(output_file) if overwrite FileUtils.rm_f output_file else UI.user_error! "Compressed file was existed: #{output_file}" end end end |
.fetch_key(plist, *keys) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 76 def self.fetch_key(plist, *keys) UI.crash! 'Missing keys' if keys.empty? if keys.size == 1 plist[keys[0]] else plist.dig(*keys) end end |
.macho_metadata(file) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 38 def self.(file) require 'macho' macho_type = MachO.open(file) case macho_type when ::MachO::MachOFile [macho_type] else size = macho_type.fat_archs.each_with_object([]) do |arch, obj| obj << arch.size end machos = [] macho_type.machos.each do |file| machos << file end machos end end |
.store_shard_value(key, value) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 58 def self.store_shard_value(key, value) Actions.lane_context[key] = value ENV[key.to_s] = case value when String value else JSON.dump(value) end end |
.xcarchive_metadata(path) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 68 def self.(path) file = File.directory?(path) ? File.join(path, 'Info.plist') : path UI.user_error! "Can not read Info.plist in #{file}" unless File.file?(file) require 'plist' Plist.parse_xml(file) end |