Module: FastlaneCore::Helper
- Defined in:
- lib/fastlane_core/helper.rb
Class Method Summary collapse
-
.backticks(command, print: true) ⇒ Object
Runs a given command using backticks (‘) and prints them out using the UI.command method.
-
.ci? ⇒ boolean
True if building in a known CI environment.
-
.colors_disabled? ⇒ Boolean
Do we want to disable the colored output?.
- .fastlane_enabled? ⇒ Boolean
-
.gem_path(gem_name) ⇒ Object
Path to the installed gem to load resources (e.g. resign.sh).
- .is_ci? ⇒ Boolean
- .is_mac? ⇒ Boolean
-
.is_test? ⇒ Boolean
Use Helper.test? and Helper.ci? instead (legacy calls).
-
.iterm? ⇒ Boolean
Does the user use iTerm?.
-
.itms_path ⇒ Object
The full path to the iTMSTransporter executable.
-
.log ⇒ Object
This method is deprecated, use the ‘UI` class github.com/fastlane/fastlane/blob/master/fastlane/docs/UI.md.
-
.mac? ⇒ Boolean
Is the currently running computer a Mac?.
-
.mac_stock_terminal? ⇒ Boolean
Does the user use the Mac stock terminal.
-
.test? ⇒ Boolean
True if the currently running program is a unit test.
- .transporter_java_executable_path ⇒ Object
- .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
-
.xcode_path ⇒ Object
The full path to the Xcode developer tools of the currently running system.
-
.xcode_version ⇒ Object
The version of the currently used Xcode installation (e.g. “7.0”).
Class Method Details
.backticks(command, print: true) ⇒ Object
Runs a given command using backticks (‘) and prints them out using the UI.command method
15 16 17 18 19 20 |
# File 'lib/fastlane_core/helper.rb', line 15 def self.backticks(command, print: true) UI.command(command) if print result = `#{command}` UI.command_output(result) if print return result end |
.ci? ⇒ boolean
Returns true if building in a known CI environment.
28 29 30 31 32 33 34 |
# File 'lib/fastlane_core/helper.rb', line 28 def self.ci? # Check for Jenkins, Travis CI, ... environment variables ['JENKINS_HOME', 'JENKINS_URL', 'TRAVIS', 'CIRCLECI', 'CI', 'TEAMCITY_VERSION', 'GO_PIPELINE_NAME', 'bamboo_buildKey', 'GITLAB_CI', 'XCS'].each do |current| return true if ENV.key?(current) end return false end |
.colors_disabled? ⇒ Boolean
Do we want to disable the colored output?
55 56 57 |
# File 'lib/fastlane_core/helper.rb', line 55 def self.colors_disabled? ENV["FASTLANE_DISABLE_COLORS"] end |
.fastlane_enabled? ⇒ Boolean
133 134 135 136 |
# File 'lib/fastlane_core/helper.rb', line 133 def self.fastlane_enabled? # This is called from the root context on the first start @enabled ||= (File.directory?("./fastlane") || File.directory?("./.fastlane")) end |
.gem_path(gem_name) ⇒ Object
Path to the installed gem to load resources (e.g. resign.sh)
139 140 141 142 143 144 145 |
# File 'lib/fastlane_core/helper.rb', line 139 def self.gem_path(gem_name) if !Helper.is_test? and Gem::Specification.find_all_by_name(gem_name).any? return Gem::Specification.find_by_name(gem_name).gem_dir else return './' end end |
.is_ci? ⇒ Boolean
46 47 48 |
# File 'lib/fastlane_core/helper.rb', line 46 def self.is_ci? ci? end |
.is_mac? ⇒ Boolean
50 51 52 |
# File 'lib/fastlane_core/helper.rb', line 50 def self.is_mac? self.mac? end |
.is_test? ⇒ Boolean
Use Helper.test? and Helper.ci? instead (legacy calls)
42 43 44 |
# File 'lib/fastlane_core/helper.rb', line 42 def self.is_test? self.test? end |
.iterm? ⇒ Boolean
Does the user use iTerm?
65 66 67 |
# File 'lib/fastlane_core/helper.rb', line 65 def self.iterm? !!ENV["ITERM_SESSION_ID"] end |
.itms_path ⇒ Object
Returns the full path to the iTMSTransporter executable.
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fastlane_core/helper.rb', line 119 def self.itms_path return ENV["FASTLANE_ITUNES_TRANSPORTER_PATH"] if ENV["FASTLANE_ITUNES_TRANSPORTER_PATH"] return '' unless self.is_mac? # so tests work on Linx too [ "../Applications/Application Loader.app/Contents/MacOS/itms", "../Applications/Application Loader.app/Contents/itms" ].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.") end |
.log ⇒ Object
This method is deprecated, use the ‘UI` class github.com/fastlane/fastlane/blob/master/fastlane/docs/UI.md
8 9 10 11 |
# File 'lib/fastlane_core/helper.rb', line 8 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?
37 38 39 |
# File 'lib/fastlane_core/helper.rb', line 37 def self.mac? (/darwin/ =~ RUBY_PLATFORM) != nil end |
.mac_stock_terminal? ⇒ Boolean
Does the user use the Mac stock terminal
60 61 62 |
# File 'lib/fastlane_core/helper.rb', line 60 def self.mac_stock_terminal? !!ENV["TERM_PROGRAM_VERSION"] end |
.test? ⇒ Boolean
Returns true if the currently running program is a unit test.
23 24 25 |
# File 'lib/fastlane_core/helper.rb', line 23 def self.test? defined? SpecHelper end |
.transporter_java_executable_path ⇒ Object
93 94 95 |
# File 'lib/fastlane_core/helper.rb', line 93 def self.transporter_java_executable_path return File.join(self.transporter_java_path, 'bin', 'java') end |
.transporter_java_ext_dir ⇒ Object
97 98 99 |
# File 'lib/fastlane_core/helper.rb', line 97 def self.transporter_java_ext_dir return File.join(self.transporter_java_path, 'lib', 'ext') end |
.transporter_java_jar_path ⇒ Object
101 102 103 |
# File 'lib/fastlane_core/helper.rb', line 101 def self.transporter_java_jar_path return File.join(self.itms_path, 'lib', 'itmstransporter-launcher.jar') end |
.transporter_java_path ⇒ Object
109 110 111 |
# File 'lib/fastlane_core/helper.rb', line 109 def self.transporter_java_path return File.join(self.itms_path, 'java') end |
.transporter_path ⇒ Object
Returns the full path to the iTMSTransporter executable.
114 115 116 |
# File 'lib/fastlane_core/helper.rb', line 114 def self.transporter_path return File.join(self.itms_path, 'bin', 'iTMSTransporter') end |
.transporter_user_dir ⇒ Object
105 106 107 |
# File 'lib/fastlane_core/helper.rb', line 105 def self.transporter_user_dir return File.join(self.itms_path, 'bin') end |
.xcode_path ⇒ Object
Returns the full path to the Xcode developer tools of the currently running system.
74 75 76 77 |
# File 'lib/fastlane_core/helper.rb', line 74 def self.xcode_path return "" if self.is_test? and !self.is_mac? `xcode-select -p`.delete("\n") + "/" end |
.xcode_version ⇒ Object
Returns The version of the currently used Xcode installation (e.g. “7.0”).
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/fastlane_core/helper.rb', line 80 def self.xcode_version return @xcode_version if @xcode_version begin output = `DEVELOPER_DIR='' "#{xcode_path}/usr/bin/xcodebuild" -version` @xcode_version = output.split("\n").first.split(' ')[1] rescue => ex UI.error(ex) UI.error("Error detecting currently used Xcode installation") end @xcode_version end |