Module: FastlaneCore::Helper
- Defined in:
- fastlane_core/lib/fastlane_core/helper.rb
Class Method Summary collapse
- .ask_password(message: "Passphrase: ", confirm: nil, confirmation_message: "Type passphrase again: ") ⇒ Object
-
.backticks(command, print: true) ⇒ Object
Runs a given command using backticks (`) and prints them out using the UI.command method.
-
.buildlog_path ⇒ Object
Logs base directory.
-
.bundler? ⇒ boolean
True if executing with bundler (like 'bundle exec fastlane [action]').
-
.ci? ⇒ boolean
True if building in a known CI environment.
-
.colors_disabled? ⇒ Boolean
Do we want to disable the colored output?.
-
.contained_fastlane? ⇒ Boolean
Do we run from a bundled fastlane, which contains Ruby and OpenSSL? Usually this means the fastlane directory is ~/.fastlane/bin/ We set this value via the environment variable
FASTLANE_SELF_CONTAINED. -
.executable?(cmd_path) ⇒ Boolean
checks if a given path is an executable file.
-
.fastlane_enabled? ⇒ Boolean
fastlane.
-
.fastlane_enabled_folder_path ⇒ Object
Checks if fastlane is enabled for this project and returns the folder where the configuration lives.
-
.gem_path(gem_name) ⇒ Object
DEPRECATED: Use the
ROOTconstant from the appropriate tool module instead e.g. -
.get_executable_path(cmd_path) ⇒ Object
returns the path of the executable with the correct extension on Windows.
- .hide_loading_indicator ⇒ Object
-
.homebrew? ⇒ Boolean
returns true if fastlane was installed via Homebrew.
- .is_ci? ⇒ Boolean
- .is_circle_ci? ⇒ Boolean
-
.is_codebuild? ⇒ boolean
True if environment variable CODEBUILD_BUILD_ARN is set.
- .is_mac? ⇒ Boolean
-
.is_test? ⇒ Boolean
Use Helper.test?, Helper.ci?, Helper.mac? or Helper.windows? instead (legacy calls).
- .is_windows? ⇒ Boolean
-
.itms_path ⇒ Object
The full path to the iTMSTransporter executable.
-
.json_file?(filename) ⇒ Boolean
checks if given file is a valid json file base taken from: http://stackoverflow.com/a/26235831/1945875.
-
.keychain_path(keychain_name) ⇒ Object
keychain.
- .linux? ⇒ Boolean
-
.localize_file_path(path) ⇒ Object
returns the path with the platform-specific path separator (
/on UNIX,\on Windows). -
.log ⇒ Object
This method is deprecated, use the
UIclass https://docs.fastlane.tools/advanced/#user-input-and-output. -
.mac? ⇒ Boolean
Is the currently running computer a Mac?.
-
.mac_app? ⇒ Boolean
returns true if fastlane was installed from the Fabric Mac app.
-
.mac_stock_terminal? ⇒ Boolean
Does the user use the Mac stock terminal.
- .operating_system ⇒ Object
-
.rubygems? ⇒ Boolean
returns true if fastlane was installed via RubyGems.
-
.sh_enabled? ⇒ Boolean
True if it is enabled to execute external commands.
-
.should_show_loading_indicator? ⇒ Boolean
loading indicator.
-
.show_loading_indicator(text = nil) ⇒ Object
Show/Hide loading indicator.
-
.strip_ansi_colors(str) ⇒ Object
removes ANSI colors from string.
-
.swift_version ⇒ Object
Swift version.
-
.test? ⇒ Boolean
True if the currently running program is a unit test.
-
.transporter_java_executable_path ⇒ Object
iTMSTransporter.
- .transporter_java_ext_dir ⇒ Object
- .transporter_java_jar_path ⇒ Object
- .transporter_java_path ⇒ Object
-
.transporter_path ⇒ Object
The full path to the iTMSTransporter executable.
- .transporter_user_dir ⇒ Object
- .user_defined_itms_path ⇒ Object
- .user_defined_itms_path? ⇒ Boolean
-
.which(cmd) ⇒ Object
Cross-platform way of finding an executable in the $PATH.
- .windows? ⇒ Boolean
-
.with_env_values(hash, &block) ⇒ Object
Executes the provided block after adjusting the ENV to have the provided keys and values set as defined in hash.
-
.xcode_at_least?(version) ⇒ Boolean
True if installed Xcode version is 'greater than or equal to' the input parameter version.
-
.xcode_path ⇒ Object
The full path to the Xcode developer tools of the currently running system.
- .xcode_server? ⇒ Boolean
-
.xcode_version ⇒ Object
The version of the currently used Xcode installation (e.g. "7.0").
-
.zip_directory(path, output_path, contents_only: false, overwrite: false, print: true) ⇒ Object
Zips directory.
Class Method Details
.ask_password(message: "Passphrase: ", confirm: nil, confirmation_message: "Type passphrase again: ") ⇒ Object
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 488 def self.ask_password(message: "Passphrase: ", confirm: nil, confirmation_message: "Type passphrase again: ") raise "This code should only run in interactive mode" unless UI.interactive? loop do password = UI.password() if confirm password2 = UI.password() if password == password2 return password end else return password end UI.error("Your entries do not match. Please try again") end end |
.backticks(command, print: true) ⇒ Object
Runs a given command using backticks (`) and prints them out using the UI.command method
320 321 322 323 324 325 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 320 def self.backticks(command, print: true) UI.command(command) if print result = `#{command}` UI.command_output(result) if print return result end |
.buildlog_path ⇒ Object
Logs base directory
126 127 128 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 126 def self.buildlog_path return ENV["FL_BUILDLOG_PATH"] || "~/Library/Logs" end |
.bundler? ⇒ boolean
Returns true if executing with bundler (like 'bundle exec fastlane [action]').
30 31 32 33 34 35 36 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 30 def self.bundler? # Bundler environment variable ['BUNDLE_BIN_PATH', 'BUNDLE_GEMFILE'].each do |current| return true if ENV.key?(current) end return false end |
.ci? ⇒ boolean
Returns true if building in a known CI environment.
74 75 76 77 78 79 80 81 82 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 74 def self.ci? return true if self.is_circle_ci? # Check for Jenkins, Travis CI, ... environment variables ['JENKINS_HOME', 'JENKINS_URL', 'TRAVIS', 'CI', 'APPCENTER_BUILD_ID', 'TEAMCITY_VERSION', 'GO_PIPELINE_NAME', 'bamboo_buildKey', 'GITLAB_CI', 'XCS', 'TF_BUILD', 'GITHUB_ACTION', 'GITHUB_ACTIONS', 'BITRISE_IO', 'BUDDY', 'CODEBUILD_BUILD_ARN'].each do |current| return true if FastlaneCore::Env.truthy?(current) end return false end |
.colors_disabled? ⇒ Boolean
Do we want to disable the colored output?
116 117 118 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 116 def self.colors_disabled? FastlaneCore::Env.truthy?("FASTLANE_DISABLE_COLORS") || ENV.key?("NO_COLOR") end |
.contained_fastlane? ⇒ Boolean
Do we run from a bundled fastlane, which contains Ruby and OpenSSL?
Usually this means the fastlane directory is ~/.fastlane/bin/
We set this value via the environment variable FASTLANE_SELF_CONTAINED
41 42 43 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 41 def self.contained_fastlane? ENV["FASTLANE_SELF_CONTAINED"].to_s == "true" && !self.homebrew? end |
.executable?(cmd_path) ⇒ Boolean
checks if a given path is an executable file
401 402 403 404 405 406 407 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 401 def self.executable?(cmd_path) if !cmd_path || File.directory?(cmd_path) return false end return File.exist?(get_executable_path(cmd_path)) end |
.fastlane_enabled? ⇒ Boolean
fastlane
16 17 18 19 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 16 def self.fastlane_enabled? # This is called from the root context on the first start !FastlaneCore::FastlaneFolder.path.nil? end |
.fastlane_enabled_folder_path ⇒ Object
Checks if fastlane is enabled for this project and returns the folder where the configuration lives
22 23 24 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 22 def self.fastlane_enabled_folder_path fastlane_enabled? ? FastlaneCore::FastlaneFolder.path : '.' end |
.gem_path(gem_name) ⇒ Object
DEPRECATED: Use the ROOT constant from the appropriate tool module instead
e.g. File.join(Sigh::ROOT, 'lib', 'assets', 'resign.sh')
Path to the installed gem to load resources (e.g. resign.sh)
471 472 473 474 475 476 477 478 479 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 471 def self.gem_path(gem_name) UI.deprecated('`Helper.gem_path` is deprecated. Use the `ROOT` constant from the appropriate tool module instead.') if !Helper.test? && Gem::Specification.find_all_by_name(gem_name).any? return Gem::Specification.find_by_name(gem_name).gem_dir else return './' end end |
.get_executable_path(cmd_path) ⇒ Object
returns the path of the executable with the correct extension on Windows
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 410 def self.get_executable_path(cmd_path) cmd_path = localize_file_path(cmd_path) if self.windows? # PATHEXT contains the list of file extensions that Windows considers executable, semicolon separated. # e.g. ".COM;.EXE;.BAT;.CMD" exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [] # no executable files on Windows, so existing is enough there # also check if command + ext is present exts.each do |ext| executable_path = "#{cmd_path}#{ext.downcase}" return executable_path if File.exist?(executable_path) end end return cmd_path end |
.hide_loading_indicator ⇒ Object
391 392 393 394 395 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 391 def self.hide_loading_indicator if self.should_show_loading_indicator? && @require_fastlane_spinner @require_fastlane_spinner.success end end |
.homebrew? ⇒ Boolean
returns true if fastlane was installed via Homebrew
51 52 53 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 51 def self.homebrew? ENV["FASTLANE_INSTALLED_VIA_HOMEBREW"].to_s == "true" end |
.is_ci? ⇒ Boolean
455 456 457 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 455 def self.is_ci? ci? end |
.is_circle_ci? ⇒ Boolean
84 85 86 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 84 def self.is_circle_ci? return ENV.key?('CIRCLECI') end |
.is_codebuild? ⇒ boolean
Returns true if environment variable CODEBUILD_BUILD_ARN is set.
89 90 91 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 89 def self.is_codebuild? return ENV.key?('CODEBUILD_BUILD_ARN') end |
.is_mac? ⇒ Boolean
459 460 461 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 459 def self.is_mac? self.mac? end |
.is_test? ⇒ Boolean
Use Helper.test?, Helper.ci?, Helper.mac? or Helper.windows? instead (legacy calls)
451 452 453 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 451 def self.is_test? self.test? end |
.is_windows? ⇒ Boolean
463 464 465 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 463 def self.is_windows? self.windows? end |
.itms_path ⇒ Object
Returns the full path to the iTMSTransporter executable.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 234 def self.itms_path return self.user_defined_itms_path if FastlaneCore::Env.truthy?("FASTLANE_ITUNES_TRANSPORTER_PATH") if self.mac? # First check for manually install iTMSTransporter user_local_itms_path = "/usr/local/itms" return user_local_itms_path if File.exist?(user_local_itms_path) # Then check for iTMSTransporter in the Xcode path [ "../Applications/Application Loader.app/Contents/MacOS/itms", "../Applications/Application Loader.app/Contents/itms", "../SharedFrameworks/ContentDeliveryServices.framework/Versions/A/itms" # For Xcode 11 ].each do |path| result = File.(File.join(self.xcode_path, path)) return result if File.exist?(result) end UI.user_error!("Could not find transporter at #{self.xcode_path}. Please make sure you set the correct path to your Xcode installation.") elsif self.windows? [ "C:/Program Files (x86)/itms" ].each do |path| return path if File.exist?(path) end UI.user_error!("Could not find transporter at usual locations. Please use environment variable `FASTLANE_ITUNES_TRANSPORTER_PATH` to specify your installation path.") else # not Mac or Windows return '' end end |
.json_file?(filename) ⇒ Boolean
checks if given file is a valid json file base taken from: http://stackoverflow.com/a/26235831/1945875
437 438 439 440 441 442 443 444 445 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 437 def self.json_file?(filename) return false unless File.exist?(filename) begin JSON.parse(File.read(filename)) return true rescue JSON::ParserError return false end end |
.keychain_path(keychain_name) ⇒ Object
keychain
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 268 def self.keychain_path(keychain_name) # Existing code expects that a keychain name will be expanded into a default path to Library/Keychains # in the user's home directory. However, this will not allow the user to pass an absolute path # for the keychain value # # So, if the passed value can't be resolved as a file in Library/Keychains, just use it as-is # as the keychain path. # # We need to expand each path because File.exist? won't handle directories including ~ properly # # We also try to append `-db` at the end of the file path, as with Sierra the default Keychain name # has changed for some users: https://github.com/fastlane/fastlane/issues/5649 # Remove the ".keychain" at the end of the keychain name name = keychain_name.sub(/\.keychain$/, "") possible_locations = [ File.join(Dir.home, 'Library', 'Keychains', name), name ].map { |path| File.(path) } # Transforms ["thing"] to ["thing-db", "thing.keychain-db", "thing", "thing.keychain"] keychain_paths = [] possible_locations.each do |location| keychain_paths << "#{location}-db" keychain_paths << "#{location}.keychain-db" keychain_paths << location keychain_paths << "#{location}.keychain" end keychain_path = keychain_paths.find { |path| File.file?(path) } UI.user_error!("Could not locate the provided keychain. Tried:\n\t#{keychain_paths.join("\n\t")}") unless keychain_path keychain_path end |
.linux? ⇒ Boolean
106 107 108 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 106 def self.linux? (/linux/ =~ RUBY_PLATFORM) != nil end |
.localize_file_path(path) ⇒ Object
returns the path with the platform-specific path separator (/ on UNIX, \ on Windows)
430 431 432 433 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 430 def self.localize_file_path(path) # change `/` to `\` on Windows return self.windows? ? path.gsub('/', '\\') : path end |
.log ⇒ Object
This method is deprecated, use the UI class
https://docs.fastlane.tools/advanced/#user-input-and-output
483 484 485 486 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 483 def self.log UI.deprecated("Helper.log is deprecated. Use `UI` class instead") UI.current.log end |
.mac? ⇒ Boolean
Is the currently running computer a Mac?
111 112 113 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 111 def self.mac? (/darwin/ =~ RUBY_PLATFORM) != nil end |
.mac_app? ⇒ Boolean
returns true if fastlane was installed from the Fabric Mac app
46 47 48 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 46 def self.mac_app? ENV["FASTLANE_SELF_CONTAINED"].to_s == "false" end |
.mac_stock_terminal? ⇒ Boolean
Does the user use the Mac stock terminal
121 122 123 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 121 def self.mac_stock_terminal? FastlaneCore::Env.truthy?("TERM_PROGRAM_VERSION") end |
.operating_system ⇒ Object
93 94 95 96 97 98 99 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 93 def self. return "macOS" if self.mac? return "Windows" if self.windows? return "Linux" if self.linux? return "Java" if RUBY_PLATFORM =~ /java/ return "Unknown" end |
.rubygems? ⇒ Boolean
returns true if fastlane was installed via RubyGems
56 57 58 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 56 def self.rubygems? !self.bundler? && !self.contained_fastlane? && !self.homebrew? && !self.mac_app? end |
.sh_enabled? ⇒ Boolean
Returns true if it is enabled to execute external commands.
69 70 71 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 69 def self.sh_enabled? !self.test? || ENV["FORCE_SH_DURING_TESTS"] end |
.should_show_loading_indicator? ⇒ Boolean
loading indicator
372 373 374 375 376 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 372 def self.should_show_loading_indicator? return false if FastlaneCore::Env.truthy?("FASTLANE_DISABLE_ANIMATION") return false if Helper.ci? return true end |
.show_loading_indicator(text = nil) ⇒ Object
Show/Hide loading indicator
379 380 381 382 383 384 385 386 387 388 389 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 379 def self.show_loading_indicator(text = nil) if self.should_show_loading_indicator? # we set the default here, instead of at the parameters # as we don't want to `UI.message` a rocket that's just there for the loading indicator text ||= "🚀" @require_fastlane_spinner = TTY::Spinner.new("[:spinner] #{text} ", format: :dots) @require_fastlane_spinner.auto_spin else UI.(text) if text end end |
.strip_ansi_colors(str) ⇒ Object
removes ANSI colors from string
328 329 330 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 328 def self.strip_ansi_colors(str) str.gsub(/\e\[([;\d]+)?m/, '') end |
.swift_version ⇒ Object
Returns Swift version.
188 189 190 191 192 193 194 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 188 def self.swift_version if self.which('swift') output = `swift --version 2> /dev/null` return output.split("\n").first.match(/version ([0-9.]+)/).captures.first end return nil end |
.test? ⇒ Boolean
Returns true if the currently running program is a unit test.
64 65 66 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 64 def self.test? Object.const_defined?("SpecHelper") end |
.transporter_java_executable_path ⇒ Object
iTMSTransporter
199 200 201 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 199 def self.transporter_java_executable_path return File.join(self.transporter_java_path, 'bin', 'java') end |
.transporter_java_ext_dir ⇒ Object
203 204 205 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 203 def self.transporter_java_ext_dir return File.join(self.transporter_java_path, 'lib', 'ext') end |
.transporter_java_jar_path ⇒ Object
207 208 209 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 207 def self.transporter_java_jar_path return File.join(self.itms_path, 'lib', 'itmstransporter-launcher.jar') end |
.transporter_java_path ⇒ Object
215 216 217 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 215 def self.transporter_java_path return File.join(self.itms_path, 'java') end |
.transporter_path ⇒ Object
Returns the full path to the iTMSTransporter executable.
220 221 222 223 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 220 def self.transporter_path return File.join(self.itms_path, 'bin', 'iTMSTransporter') unless Helper.windows? return File.join(self.itms_path, 'iTMSTransporter') end |
.transporter_user_dir ⇒ Object
211 212 213 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 211 def self.transporter_user_dir return File.join(self.itms_path, 'bin') end |
.user_defined_itms_path ⇒ Object
229 230 231 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 229 def self.user_defined_itms_path return ENV["FASTLANE_ITUNES_TRANSPORTER_PATH"] if self.user_defined_itms_path? end |
.user_defined_itms_path? ⇒ Boolean
225 226 227 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 225 def self.user_defined_itms_path? return FastlaneCore::Env.truthy?("FASTLANE_ITUNES_TRANSPORTER_PATH") end |
.which(cmd) ⇒ Object
314 315 316 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 314 def self.which(cmd) FastlaneCore::CommandExecutor.which(cmd) end |
.windows? ⇒ Boolean
101 102 103 104 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 101 def self.windows? # taken from: https://stackoverflow.com/a/171011/1945875 (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil end |
.with_env_values(hash, &block) ⇒ Object
Executes the provided block after adjusting the ENV to have the provided keys and values set as defined in hash. After the block completes, restores the ENV to its previous state.
356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 356 def self.with_env_values(hash, &block) old_vals = ENV.select { |k, v| hash.include?(k) } hash.each do |k, v| ENV[k] = hash[k] end yield ensure hash.each do |k, v| ENV.delete(k) unless old_vals.include?(k) ENV[k] = old_vals[k] end end |
.xcode_at_least?(version) ⇒ Boolean
Returns true if installed Xcode version is 'greater than or equal to' the input parameter version.
178 179 180 181 182 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 178 def self.xcode_at_least?(version) installed_xcode_version = xcode_version UI.user_error!("Unable to locate Xcode. Please make sure to have Xcode installed on your machine") if installed_xcode_version.nil? Gem::Version.new(installed_xcode_version) >= Gem::Version.new(version) end |
.xcode_path ⇒ Object
Returns the full path to the Xcode developer tools of the currently running system.
135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 135 def self.xcode_path return "" unless self.mac? if self.xcode_server? # Xcode server always creates a link here xcode_server_xcode_path = "/Library/Developer/XcodeServer/CurrentXcodeSymlink/Contents/Developer" UI.verbose("We're running as XcodeServer, setting path to #{xcode_server_xcode_path}") return xcode_server_xcode_path end return `xcode-select -p`.delete("\n") + "/" end |
.xcode_server? ⇒ Boolean
148 149 150 151 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 148 def self.xcode_server? # XCS is set by Xcode Server return ENV["XCS"].to_i == 1 end |
.xcode_version ⇒ Object
Returns The version of the currently used Xcode installation (e.g. "7.0").
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 154 def self.xcode_version return nil unless self.mac? return @xcode_version if @xcode_version && @developer_dir == ENV['DEVELOPER_DIR'] xcodebuild_path = "#{xcode_path}/usr/bin/xcodebuild" xcode_build_installed = File.exist?(xcodebuild_path) unless xcode_build_installed UI.verbose("Couldn't find xcodebuild at #{xcodebuild_path}, check that it exists") return nil end begin output = `DEVELOPER_DIR='' "#{xcodebuild_path}" -version` @xcode_version = output.split("\n").first.split(' ')[1] @developer_dir = ENV['DEVELOPER_DIR'] rescue => ex UI.error(ex) UI.user_error!("Error detecting currently used Xcode installation, please ensure that you have Xcode installed and set it using `sudo xcode-select -s [path]`") end @xcode_version end |
.zip_directory(path, output_path, contents_only: false, overwrite: false, print: true) ⇒ Object
Zips directory
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'fastlane_core/lib/fastlane_core/helper.rb', line 333 def self.zip_directory(path, output_path, contents_only: false, overwrite: false, print: true) if overwrite overwrite_command = " && rm -f '#{output_path}'" else overwrite_command = "" end if contents_only command = "cd '#{path}'#{overwrite_command} && zip -r '#{output_path}' *" else containing_path = File.("..", path) contents_path = File.basename(path) command = "cd '#{containing_path}'#{overwrite_command} && zip -r '#{output_path}' '#{contents_path}'" end UI.command(command) unless print Helper.backticks(command, print: print) end |