Class: Fastlane::Actions::ZipAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/zip.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, sh, step_text

Class Method Details

.authorsObject



49
50
51
# File 'lib/fastlane/actions/zip.rb', line 49

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fastlane/actions/zip.rb', line 26

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "FL_ZIP_PATH",
                                 description: "Path to the directory or file to be zipped",
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find file/folder at path '#{File.expand_path(value)}'") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :output_path,
                                 env_name: "FL_ZIP_OUTPUT_NAME",
                                 description: "The name of the resulting zip file",
                                 optional: true)
  ]
end

.descriptionObject



18
19
20
# File 'lib/fastlane/actions/zip.rb', line 18

def self.description
  "Compress a file or folder to a zip"
end

.detailsObject



22
23
24
# File 'lib/fastlane/actions/zip.rb', line 22

def self.details
  "This zips everything in a weird way if you're not in the directory of the file to zip"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/fastlane/actions/zip.rb', line 53

def self.is_supported?(platform)
  true
end

.outputObject



41
42
43
# File 'lib/fastlane/actions/zip.rb', line 41

def self.output
  []
end

.return_valueObject



45
46
47
# File 'lib/fastlane/actions/zip.rb', line 45

def self.return_value
  "The path to the output zip file"
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/fastlane/actions/zip.rb', line 4

def self.run(params)
  UI.message "Compressing #{params[:path]}..."

  params[:output_path] ||= "#{params[:path]}.zip"
  sh "zip -r #{params[:output_path]} #{params[:path].shellescape}"

  UI.success "Successfully generated zip file at path '#{File.expand_path(params[:output_path])}'"
  return File.expand_path(params[:output_path])
end