Class: Fastlane::Actions::VerifyPodKeysAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, available_options, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject



36
37
38
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 36

def self.author
  "ashfurrow"
end

.categoryObject



62
63
64
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 62

def self.category
  :building
end

.descriptionObject



44
45
46
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 44

def self.description
  "Verifies all keys referenced from the Podfile are non-empty"
end

.detailsObject



48
49
50
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 48

def self.details
  "Runs a check against all keys specified in your Podfile to make sure they're more than a single character long. This is to ensure you don't deploy with stubbed keys."
end

.example_codeObject



56
57
58
59
60
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 56

def self.example_code
  [
    'verify_pod_keys'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



52
53
54
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 52

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.plugin_optionsObject



16
17
18
19
20
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 16

def self.plugin_options
  require 'cocoapods-core'
  podfile = Pod::Podfile.from_file("Podfile")
  podfile.plugins["cocoapods-keys"]
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 4

def self.run(params)
  UI.message("Validating CocoaPods Keys")

  options = plugin_options
  target = options["target"] || ""

  options["keys"].each do |key|
    UI.message(" - #{key}")
    validate(key, target)
  end
end

.validate(key, target) ⇒ Object



22
23
24
25
26
27
28
29
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 22

def self.validate(key, target)
  if value(key, target).length < 2
    message = "Did not pass validation for key #{key}. " \
      "Run `[bundle exec] pod keys get #{key} #{target}` to see what it is. " \
      "It's likely this is running with empty/OSS keys."
    raise message
  end
end

.value(key, target) ⇒ Object



31
32
33
34
# File 'fastlane/lib/fastlane/actions/verify_pod_keys.rb', line 31

def self.value(key, target)
  value = `pod keys get #{key} #{target}`
  value.split("]").last.strip
end