Class: Match::Utils
- Inherits:
-
Object
- Object
- Match::Utils
- Defined in:
- lib/match/utils.rb
Class Method Summary collapse
- .base_environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name_profile_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name_team_id(app_identifier: nil, type: nil) ⇒ Object
-
.fill_environment(key, value) ⇒ Object
Fill in an environment variable, ready to be used in xcodebuild.
- .import(item_path, keychain) ⇒ Object
Class Method Details
.base_environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
53 54 55 |
# File 'lib/match/utils.rb', line 53 def self.base_environment_variable_name(app_identifier: nil, type: nil) ["sigh", app_identifier, type] end |
.environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
41 42 43 |
# File 'lib/match/utils.rb', line 41 def self.environment_variable_name(app_identifier: nil, type: nil) base_environment_variable_name(app_identifier: app_identifier, type: type).join("_") end |
.environment_variable_name_profile_name(app_identifier: nil, type: nil) ⇒ Object
49 50 51 |
# File 'lib/match/utils.rb', line 49 def self.environment_variable_name_profile_name(app_identifier: nil, type: nil) (base_environment_variable_name(app_identifier: app_identifier, type: type) + ["profile-name"]).join("_") end |
.environment_variable_name_team_id(app_identifier: nil, type: nil) ⇒ Object
45 46 47 |
# File 'lib/match/utils.rb', line 45 def self.environment_variable_name_team_id(app_identifier: nil, type: nil) (base_environment_variable_name(app_identifier: app_identifier, type: type) + ["team-id"]).join("_") end |
.fill_environment(key, value) ⇒ Object
Fill in an environment variable, ready to be used in xcodebuild
36 37 38 39 |
# File 'lib/match/utils.rb', line 36 def self.fill_environment(key, value) UI.important "Setting environment variable '#{key}' to '#{value}'" if $verbose ENV[key] = value end |
.import(item_path, keychain) ⇒ Object
3 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 33 |
# File 'lib/match/utils.rb', line 3 def self.import(item_path, keychain) # Existing code expects that a keychain name will be expanded into a default path to Libary/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 # keychain_paths = [ File.join(Dir.home, 'Library', 'Keychains', keychain), File.join(Dir.home, 'Library', 'Keychains', "#{keychain}-db"), keychain, "#{keychain}-db" ].map { |path| File.(path) } keychain_path = keychain_paths.find { |path| File.exist?(path) } UI.user_error!("Could not locate the provided keychain. Tried:\n\t#{keychain_paths.join("\n\t")}") unless keychain_path command = "security import #{item_path.shellescape} -k #{keychain_path.shellescape}" command << " -T /usr/bin/codesign" # to not be asked for permission when running a tool like `gym` command << " -T /usr/bin/security" command << " &> /dev/null" unless $verbose Helper.backticks(command, print: $verbose) end |