Sha256: 2958e7a9def988502a1b25bd3a57d90c7064708ac306f7bd956ca4269f97b0e0

Contents?: true

Size: 1.84 KB

Versions: 7

Compression:

Stored size: 1.84 KB

Contents

module Fastlane
  module Actions
    class ZipAction < Action
      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

      #####################################################
      # @!group Documentation
      #####################################################

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

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

      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

      def self.output
        []
      end

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

      def self.authors
        ["KrauseFx"]
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fastlane-1.84.0 lib/fastlane/actions/zip.rb
fastlane-1.83.0 lib/fastlane/actions/zip.rb
fastlane-1.82.0 lib/fastlane/actions/zip.rb
fastlane-1.81.0 lib/fastlane/actions/zip.rb
fastlane-1.80.0 lib/fastlane/actions/zip.rb
fastlane-1.70.0 lib/fastlane/actions/zip.rb
fastlane-1.69.0 lib/fastlane/actions/zip.rb