Class: Fastlane::Actions::ZipAction::Runner
- Inherits:
-
Object
- Object
- Fastlane::Actions::ZipAction::Runner
- Defined in:
- fastlane/lib/fastlane/actions/zip.rb
Instance Attribute Summary collapse
-
#exclude ⇒ Object
readonly
Returns the value of attribute exclude.
-
#include ⇒ Object
readonly
Returns the value of attribute include.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#symlinks ⇒ Object
readonly
Returns the value of attribute symlinks.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
- #create_output_dir ⇒ Object
-
#initialize(params) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
- #run_zip_command ⇒ Object
- #zip_command ⇒ Object
Constructor Details
#initialize(params) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 7 def initialize(params) @output_path = File.(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 |
Instance Attribute Details
#exclude ⇒ Object (readonly)
Returns the value of attribute exclude.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def exclude @exclude end |
#include ⇒ Object (readonly)
Returns the value of attribute include.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def include @include end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def output_path @output_path end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def password @password end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def path @path end |
#symlinks ⇒ Object (readonly)
Returns the value of attribute symlinks.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def symlinks @symlinks end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
5 6 7 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 5 def verbose @verbose end |
Instance Method Details
#create_output_dir ⇒ Object
29 30 31 32 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 29 def create_output_dir output_dir = File.("..", output_path) FileUtils.mkdir_p(output_dir) end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 19 def run UI.("Compressing #{path}...") create_output_dir run_zip_command UI.success("Successfully generated zip file at path '#{output_path}'") output_path end |
#run_zip_command ⇒ Object
34 35 36 37 38 39 |
# 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.("..", path)) do Actions.sh(*zip_command) end end |
#zip_command ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'fastlane/lib/fastlane/actions/zip.rb', line 41 def zip_command = verbose ? "r" : "rq" += "y" if symlinks command = ["zip", "-#{}"] 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 |