Class: Fastlane::Actions::SetPodKeyAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/set_pod_key.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, 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



18
19
20
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 18

def self.author
  "marcelofabri"
end

.available_optionsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 34

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                 env_name: "FL_SET_POD_KEY_USE_BUNDLE_EXEC",
                                 description: "Use bundle exec when there is a Gemfile presented",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :key,
                                 env_name: "FL_SET_POD_KEY_ITEM_KEY",
                                 description: "The key to be saved with cocoapods-keys",
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :value,
                                 env_name: "FL_SET_POD_KEY_ITEM_VALUE",
                                 description: "The value to be saved with cocoapods-keys",
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :project,
                                 env_name: "FL_SET_POD_KEY_PROJECT",
                                 description: "The project name",
                                 is_string: true,
                                 optional: true)
  ]
end

.categoryObject



73
74
75
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 73

def self.category
  :project
end

.descriptionObject



26
27
28
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 26

def self.description
  "Sets a value for a key with cocoapods-keys"
end

.detailsObject



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

def self.details
  "Adds a key to [cocoapods-keys](https://github.com/orta/cocoapods-keys)"
end

.example_codeObject



63
64
65
66
67
68
69
70
71
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 63

def self.example_code
  [
    'set_pod_key(
      key: "APIToken",
      value: "1234",
      project: "MyProject"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



59
60
61
# File 'fastlane/lib/fastlane/actions/set_pod_key.rb', line 59

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

.run(params) ⇒ Object



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

def self.run(params)
  Actions.verify_gem!('cocoapods-keys')
  cmd = []

  cmd << ['bundle exec'] if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
  cmd << ['pod keys set']

  cmd << ["\"#{params[:key]}\""]
  cmd << ["\"#{params[:value]}\""]
  cmd << ["\"#{params[:project]}\""] if params[:project]

  Actions.sh(cmd.join(' '))
end