Class: Fastlane::Helper::DebugFileHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb

Class Method Summary collapse

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

.store_shard_value(key, value) ⇒ Object



38
39
40
41
# File 'lib/fastlane/plugin/debug_file/helper/debug_file_helper.rb', line 38

def self.store_shard_value(key, value)
  Actions.lane_context[key] = value
  ENV[key.to_s] = value
end