Sha256: 3e9cf3ae1b4356fb6c1181d2e453055559a65d0773187a71bc0f8937a31cab63

Contents?: true

Size: 1.89 KB

Versions: 76

Compression:

Stored size: 1.89 KB

Contents

module Fastlane
  module Actions
    class PemAction < Action
      def self.run(params)
        require 'pem'
        require 'pem/options'
        require 'pem/manager'

        begin
          FastlaneCore::UpdateChecker.start_looking_for_update('pem') unless Helper.is_test?

          success_block = params[:new_profile]

          PEM.config = params

          if Helper.is_test?
            profile_path = './test.pem'
          else
            profile_path = PEM::Manager.start
          end

          if success_block and profile_path
            success_block.call(File.expand_path(profile_path)) if success_block
          end
        ensure
          FastlaneCore::UpdateChecker.show_update_status('pem', PEM::VERSION)
        end
      end

      def self.description
        "Makes sure a valid push profile is active and creates a new one if needed"
      end

      def self.author
        "KrauseFx"
      end

      def self.details
        [
          "Additionally to the available options, you can also specify a block that only gets executed if a new",
          "profile was created. You can use it to upload the new profile to your server.",
          "Use it like this: ",
          "pem(",
          "  new_profile: proc do ",
          "    # your upload code",
          "  end",
          ")"
        ].join("\n")
      end

      def self.available_options
        require 'pem'
        require 'pem/options'

        unless @options
          @options = PEM::Options.available_options
          @options << FastlaneCore::ConfigItem.new(key: :new_profile,
                                       description: "Block that is called if there is a new profile",
                                       optional: true,
                                       is_string: false)
        end
        @options
      end

      def self.is_supported?(platform)
        platform == :ios
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
fastlane-1.104.0 lib/fastlane/actions/pem.rb
fastlane-1.103.0 lib/fastlane/actions/pem.rb
fastlane-1.102.0 lib/fastlane/actions/pem.rb
fastlane-1.101.0 lib/fastlane/actions/pem.rb
fastlane-1.100.0 lib/fastlane/actions/pem.rb
fastlane-1.99.0 lib/fastlane/actions/pem.rb
fastlane-1.98.0 lib/fastlane/actions/pem.rb
fastlane-1.97.2 lib/fastlane/actions/pem.rb
fastlane-1.97.1 lib/fastlane/actions/pem.rb
fastlane-1.97.0 lib/fastlane/actions/pem.rb
fastlane-1.96.0 lib/fastlane/actions/pem.rb
fastlane-1.95.0 lib/fastlane/actions/pem.rb
fastlane-1.94.1 lib/fastlane/actions/pem.rb
fastlane-1.94.0 lib/fastlane/actions/pem.rb
fastlane-1.93.1 lib/fastlane/actions/pem.rb
fastlane-1.93.0 lib/fastlane/actions/pem.rb
fastlane-1.92.0 lib/fastlane/actions/pem.rb
fastlane-1.92.0.beta2 lib/fastlane/actions/pem.rb
fastlane-1.92.0.beta1 lib/fastlane/actions/pem.rb
fastlane-1.91.0 lib/fastlane/actions/pem.rb