Class: Fastlane::Actions::ZipAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, details, lane_context, method_missing, other_action, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
98
99
100
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 98
def self.authors
["KrauseFx"]
end
|
.available_options ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 42
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),
FastlaneCore::ConfigItem.new(key: :verbose,
env_name: "FL_ZIP_VERBOSE",
description: "Enable verbose output of zipped file",
default_value: true,
type: Boolean,
optional: true),
FastlaneCore::ConfigItem.new(key: :password,
env_name: "FL_ZIP_PASSWORD",
description: "Encrypt the contents of the zip archive using a password",
optional: true)
]
end
|
.category ⇒ Object
82
83
84
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 82
def self.category
:misc
end
|
.description ⇒ Object
38
39
40
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 38
def self.description
"Compress a file or folder to a zip"
end
|
.example_code ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 67
def self.example_code
[
'zip',
'zip(
path: "MyApp.app",
output_path: "Latest.app.zip"
)',
'zip(
path: "MyApp.app",
output_path: "Latest.app.zip",
verbose: false
)'
]
end
|
.is_supported?(platform) ⇒ Boolean
102
103
104
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 102
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
86
87
88
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 86
def self.output
[]
end
|
.return_type ⇒ Object
94
95
96
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 94
def self.return_type
:string
end
|
.return_value ⇒ Object
90
91
92
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 90
def self.return_value
"The path to the output zip file"
end
|
.run(params) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'fastlane/lib/fastlane/actions/zip.rb', line 4
def self.run(params)
UI.message("Compressing #{params[:path]}...")
params[:output_path] ||= params[:path]
absolute_output_path = File.expand_path(params[:output_path])
unless absolute_output_path.end_with?(".zip")
absolute_output_path += ".zip"
end
absolute_output_dir = File.expand_path("..", absolute_output_path)
FileUtils.mkdir_p(absolute_output_dir)
Dir.chdir(File.expand_path("..", params[:path])) do zip_options = params[:verbose] ? "r" : "rq"
if params[:password]
password_option = "-P '#{params[:password]}'"
Actions.sh("zip -#{zip_options} #{password_option} #{absolute_output_path.shellescape} #{File.basename(params[:path]).shellescape}")
else
Actions.sh("zip -#{zip_options} #{absolute_output_path.shellescape} #{File.basename(params[:path]).shellescape}")
end
end
UI.success("Successfully generated zip file at path '#{File.expand_path(absolute_output_path)}'")
return File.expand_path(absolute_output_path)
end
|