class Fastlane::Actions::ZipAction::Runner
Attributes
exclude[R]
include[R]
output_path[R]
password[R]
path[R]
symlinks[R]
verbose[R]
Public Class Methods
new(params)
click to toggle source
# File fastlane/lib/fastlane/actions/zip.rb, line 7 def initialize(params) @output_path = File.expand_path(params[:output_path] || params[:path]) @path = params[:path] @verbose = params[:verbose] @password = params[:password] @symlinks = params[:symlinks] @include = params[:include] || [] @exclude = params[:exclude] || [] @output_path += ".zip" unless @output_path.end_with?(".zip") end
Public Instance Methods
create_output_dir()
click to toggle source
# File fastlane/lib/fastlane/actions/zip.rb, line 29 def create_output_dir output_dir = File.expand_path("..", output_path) FileUtils.mkdir_p(output_dir) end
run()
click to toggle source
# File fastlane/lib/fastlane/actions/zip.rb, line 19 def run UI.message("Compressing #{path}...") create_output_dir run_zip_command UI.success("Successfully generated zip file at path '#{output_path}'") output_path end
run_zip_command()
click to toggle source
# File fastlane/lib/fastlane/actions/zip.rb, line 34 def run_zip_command # The 'zip' command archives relative to the working directory, chdir to produce expected results relative to `path` Dir.chdir(File.expand_path("..", path)) do Actions.sh(*zip_command) end end
zip_command()
click to toggle source
# File fastlane/lib/fastlane/actions/zip.rb, line 41 def zip_command zip_options = verbose ? "r" : "rq" zip_options += "y" if symlinks command = ["zip", "-#{zip_options}"] if password command << "-P" command << password end # The zip command is executed from the paths **parent** directory, as a result we use just the basename, which is the file or folder within basename = File.basename(path) command << output_path command << basename unless include.empty? command << "-i" command += include.map { |path| File.join(basename, path) } end unless exclude.empty? command << "-x" command += exclude.map { |path| File.join(basename, path) } end command end