Class: Fastlane::Actions::CreateKeychainAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::CreateKeychainAction
- Defined in:
- lib/fastlane/actions/create_keychain.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, details, output, sh, step_text
Class Method Details
.authors ⇒ Object
71 72 73 |
# File 'lib/fastlane/actions/create_keychain.rb', line 71 def self. ["gin0606"] end |
.available_options ⇒ Object
38 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 |
# File 'lib/fastlane/actions/create_keychain.rb', line 38 def self. [ FastlaneCore::ConfigItem.new(key: :name, env_name: "KEYCHAIN_NAME", description: "Keychain name", optional: false), FastlaneCore::ConfigItem.new(key: :password, env_name: "KEYCHAIN_PASSWORD", description: "Password for the keychain", optional: false), FastlaneCore::ConfigItem.new(key: :default_keychain, description: 'Set the default keychain', is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :unlock, description: 'Unlock keychain after create', is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :timeout, description: 'timeout interval in seconds. Set `false` if you want to specify "no time-out"', is_string: false, default_value: 300), FastlaneCore::ConfigItem.new(key: :lock_when_sleeps, description: 'Lock keychain when the system sleeps', is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :lock_after_timeout, description: 'Lock keychain after timeout interval', is_string: false, default_value: false), ] end |
.description ⇒ Object
34 35 36 |
# File 'lib/fastlane/actions/create_keychain.rb', line 34 def self.description "Create a new Keychain" end |
.is_supported?(platform) ⇒ Boolean
75 76 77 |
# File 'lib/fastlane/actions/create_keychain.rb', line 75 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fastlane/actions/create_keychain.rb', line 10 def self.run(params) escaped_name = params[:name].shellescape escaped_password = params[:password].shellescape commands = [] commands << Fastlane::Actions.sh("security create-keychain -p #{escaped_password} #{escaped_name}", log:false) if params[:default_keychain] Actions.lane_context[Actions::SharedValues::ORIGINAL_DEFAULT_KEYCHAIN] = Fastlane::Actions.sh("security default-keychain", log:false).strip commands << Fastlane::Actions.sh("security default-keychain -s #{escaped_name}", log:false) end commands << Fastlane::Actions.sh("security unlock-keychain -p #{escaped_password} #{escaped_name}", log:false) if params[:unlock] command = "security set-keychain-settings" command << " -t #{params[:timeout]}" if params[:timeout] command << " -l" if params[:lock_when_sleeps] command << " -u" if params[:lock_after_timeout] command << " ~/Library/Keychains/#{escaped_name}" commands << Fastlane::Actions.sh(command, log:false) commands end |