Sha256: 4cab0efe3d2390292f0de99daea76c8c1c7ec45c4f3055f2741a79e83607f8d1

Contents?: true

Size: 1.98 KB

Versions: 16

Compression:

Stored size: 1.98 KB

Contents

require 'shellwords'

module Fastlane
  module Actions
    class DeleteKeychainAction < Action
      def self.run(params)
        original = Actions.lane_context[Actions::SharedValues::ORIGINAL_DEFAULT_KEYCHAIN]

        if params[:name]
          keychain_path = File.expand_path(File.join("~", "Library", "Keychains", params[:name]))
        else
          keychain_path = params[:keychain_path]
        end

        if keychain_path.nil?
          UI.user_error!("You either have to set :name or :path")
        end

        Fastlane::Actions.sh("security default-keychain -s #{original}", log: false) unless original.nil?
        Fastlane::Actions.sh "security delete-keychain #{keychain_path.shellescape}", log: false
      end

      def self.details
        "Keychains can be deleted after being creating with `create_keychain`"
      end

      def self.description
        "Delete keychains and remove them from the search list"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :name,
                                       env_name: "KEYCHAIN_NAME",
                                       description: "Keychain name",
                                       conflicting_options: [:keychain_path],
                                       optional: true),
          FastlaneCore::ConfigItem.new(key: :keychain_path,
                                       env_name: "KEYCHAIN_PATH",
                                       description: "Keychain path",
                                       conflicting_options: [:name],
                                       optional: true)
        ]
      end

      def self.example_code
        [
          'delete_keychain(name: "KeychainName")',
          'delete_keychain(keychain_path: "/keychains/project.keychain")'
        ]
      end

      def self.category
        :misc
      end

      def self.authors
        ["gin0606", "koenpunt"]
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fastlane-2.19.3 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170307010029 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.2 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170306010752 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170305010057 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170304010023 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170303010054 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.20.0.beta.20170302010029 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.1 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170301010932 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170228010016 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170227010016 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170226010028 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170225010031 fastlane/lib/fastlane/actions/delete_keychain.rb
fastlane-2.19.0.beta.20170224010025 fastlane/lib/fastlane/actions/delete_keychain.rb