Class: Fastlane::Actions::UnlockKeychainAction
Class Method Summary
collapse
action_name, author, output, return_value, sh, step_text
Class Method Details
.add_keychain_to_search_list(keychain_path) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 27
def self.add_keychain_to_search_list(keychain_path)
keychains = Fastlane::Actions.sh("security list-keychains -d user", log: false).shellsplit
unless keychains.include?(keychain_path)
keychains << keychain_path
commands = []
commands << Fastlane::Actions.sh("security list-keychains -s #{keychains.shelljoin}", log: false)
commands
end
end
|
.authors ⇒ Object
87
88
89
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 87
def self.authors
["xfreebird"]
end
|
.available_options ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 68
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :path,
env_name: "FL_UNLOCK_KEYCHAIN_PATH",
description: "Path to the Keychain file",
optional: false),
FastlaneCore::ConfigItem.new(key: :password,
env_name: "FL_UNLOCK_KEYCHAIN_PASSWORD",
description: "Keychain password",
optional: false),
FastlaneCore::ConfigItem.new(key: :add_to_search_list,
env_name: "FL_UNLOCK_KEYCHAIN_ADD_TO_SEARCH_LIST",
description: "Add to keychain search list",
is_string: false,
default_value: true)
]
end
|
.description ⇒ Object
60
61
62
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 60
def self.description
"Unlock a keychain"
end
|
.details ⇒ Object
64
65
66
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 64
def self.details
"Unlocks the give keychain file and adds it to the keychain search list"
end
|
.expand_keychain_path(keychain_path) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 40
def self.expand_keychain_path(keychain_path)
possible_locations = []
possible_locations << keychain_path
possible_locations << "~/Library/Keychains/#{keychain_path}"
possible_locations << "~/Library/Keychains/#{keychain_path}.keychain"
possible_locations.each do |location|
expanded_location = File.expand_path(location)
if File.exist?(expanded_location)
return expanded_location
end
end
return ""
end
|
.is_supported?(platform) ⇒ Boolean
91
92
93
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 91
def self.is_supported?(platform)
true
end
|
.run(params) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fastlane/actions/unlock_keychain.rb', line 4
def self.run(params)
keychain_path = self.expand_keychain_path(params[:path])
add_to_search_list = params[:add_to_search_list]
if keychain_path.empty?
raise "Could not find the keychain file: #{keychain_path}".red
end
if add_to_search_list
add_keychain_to_search_list(keychain_path)
end
escaped_path = keychain_path.shellescape
escaped_password = params[:password].shellescape
commands = []
commands << Fastlane::Actions.sh("security unlock-keychain -p #{escaped_password} #{escaped_path}", log: false)
commands << Fastlane::Actions.sh("security set-keychain-settings #{escaped_path}", log: false)
commands
end
|