Class: Fastlane::Actions::FileHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/gs_deliver/actions/gs_execute_command.rb

Class Method Summary collapse

Class Method Details

.read(path) ⇒ Object



4
5
6
7
8
9
# File 'lib/fastlane/plugin/gs_deliver/actions/gs_execute_command.rb', line 4

def self.read(path)
  file = File.open(path, "r+")
  res = file.read
  file.close
  res
end

.write(path, str) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/gs_deliver/actions/gs_execute_command.rb', line 10

def self.write(path, str)
  if not path.include? "."
    raise "Filepath has incorrect format. You must provide file extension"
  end
  require 'fileutils.rb'
  FileUtils.makedirs(File.dirname(path))
  file = File.open(path, "w+")
  file.write(str)
  file.close
end