Class: Fastlane::Actions::IpaAction
- Inherits:
-
Object
- Object
- Fastlane::Actions::IpaAction
- Defined in:
- lib/fastlane/actions/ipa.rb
Class Method Summary collapse
- .fill_in_default_values(params) ⇒ Object
- .find_dsym_file(dir) ⇒ Object
- .find_ipa_file(dir) ⇒ Object
- .params_to_build_args(params) ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.fill_in_default_values(params) ⇒ Object
110 111 112 113 114 |
# File 'lib/fastlane/actions/ipa.rb', line 110 def self.fill_in_default_values(params) = Actions.lane_context[Actions::SharedValues::SIGH_PROFILE_PATH] || ENV["SIGH_PROFILE_PATH"] params[:embed] ||= if params end |
.find_dsym_file(dir) ⇒ Object
121 122 123 124 |
# File 'lib/fastlane/actions/ipa.rb', line 121 def self.find_dsym_file(dir) # Finds last modified .dSYM.zip in the destination directory Dir[File.join(dir, '*.dSYM.zip')].sort { |a, b| File.mtime(b) <=> File.mtime(a) }.first end |
.find_ipa_file(dir) ⇒ Object
116 117 118 119 |
# File 'lib/fastlane/actions/ipa.rb', line 116 def self.find_ipa_file(dir) # Finds last modified .ipa in the destination directory Dir[File.join(dir, '*.ipa')].sort { |a, b| File.mtime(b) <=> File.mtime(a) }.first end |
.params_to_build_args(params) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/fastlane/actions/ipa.rb', line 90 def self.params_to_build_args(params) # Remove nil value params unless :clean or :archive or :verbose params = params.delete_if { |k, v| (k != :clean && k != :archive && k != :verbose) && v.nil? } params = fill_in_default_values(params) # Maps nice developer param names to Shenzhen's `ipa build` arguments params.collect do |k, v| v ||= '' if args = ARGS_MAP[k] if k == :clean v == true ? '--clean' : '--no-clean' else value = (v.to_s.length > 0 ? "\"#{v}\"" : '') "#{ARGS_MAP[k]} #{value}".strip end end end.compact end |
.run(params) ⇒ Object
39 40 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fastlane/actions/ipa.rb', line 39 def self.run(params) # The args we will build with build_args = nil # The output directory of the IPA and dSYM absolute_dest_directory = nil params[0] ||= {} # default to hash to fill in default values # Allows for a whole variety of configurations if params.first.is_a? Hash # Used to get the final path of the IPA and dSYM if dest = params.first[:destination] absolute_dest_directory = Dir.glob(dest).map(&File.method(:realpath)).first end # Maps nice developer build parameters to Shenzhen args build_args = params_to_build_args(params.first) else build_args = params end # If no dest directory given, default to current directory absolute_dest_directory ||= Dir.pwd if Helper.test? Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = File.join(absolute_dest_directory, 'test.ipa') Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = File.join(absolute_dest_directory, 'test.app.dSYM.zip') return build_args end # Joins args into space delimited string build_args = build_args.join(' ') command = "ipa build #{build_args}" Helper.log.debug command Actions.sh command # Finds absolute path of IPA and dSYM absolute_ipa_path = find_ipa_file(absolute_dest_directory) absolute_dsym_path = find_dsym_file(absolute_dest_directory) # Sets shared values to use after this action is performed Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path end |