Module: Fastlane::Helper::FirebaseAppDistributionHelper

Included in:
Actions::FirebaseAppDistributionAction
Defined in:
lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb

Instance Method Summary collapse

Instance Method Details

#cleanup_tempfilesObject



31
32
33
34
35
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 31

def cleanup_tempfiles
  @tempfiles.each do |f|
    f.unlink
  end
end

#file_for_contents(parameter_name, from: nil, contents: nil) ⇒ Object

always return a file for a given content TODO: explain this more.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 11

def file_for_contents(parameter_name, from: nil, contents: nil)
  if parameter_name.to_s.end_with?("_file")
    return parameter_name
  end

  if @tempfiles == nil
    @tempfiles = []
  end

  contents ||= from[parameter_name]
  return nil if contents.nil?

  file = Tempfile.new(parameter_name.to_s)
  file.write(contents)
  file.close
  @tempfiles << file
  
  file.path
end