Class: Fastlane::Actions::PemAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/pem.rb

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, method_missing, other_action, output, return_value, sh, step_text

Class Method Details

.authorObject



34
35
36
# File 'lib/fastlane/actions/pem.rb', line 34

def self.author
  "KrauseFx"
end

.available_optionsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fastlane/actions/pem.rb', line 51

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

.descriptionObject



30
31
32
# File 'lib/fastlane/actions/pem.rb', line 30

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

.detailsObject



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fastlane/actions/pem.rb', line 38

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/fastlane/actions/pem.rb', line 65

def self.is_supported?(platform)
  platform == :ios
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
26
27
28
# File 'lib/fastlane/actions/pem.rb', line 4

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