Class: Fastlane::Actions::GetEmtitlementsPlistFilePathAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



114
115
116
117
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 114

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["Your GitHub/Twitter Name"]
end

.available_optionsObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 57

def self.available_options
  # Define all options your action supports. 
  
  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_API_TOKEN", # The name of the environment variable
                                 description: "API Token for GetEmtitlementsPlistFilePathAction", # a short description of this parameter
                                 verify_block: proc do |value|
                                    UI.user_error!("No API token for GetEmtitlementsPlistFilePathAction given, pass using `api_token: 'token'`") unless (value and not value.empty?)
                                    # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :development,
                                 env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_DEVELOPMENT",
                                 description: "Create a development certificate instead of a distribution one",
                                 is_string: false, # true: verifies the input is a string, false: every kind of value
                                 default_value: false) # the default value if the user didn't provide one
  ]
end

.descriptionObject



47
48
49
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 47

def self.description
  "A short description with <= 80 characters of what this action does"
end

.detailsObject



51
52
53
54
55
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 51

def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
  "You can use this action to do cool things..."
end

.find_project(params) ⇒ Object



22
23
24
25
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 22

def self.find_project(params)
  project = Xcodeproj::Project.open(params[:xcodeproj])
  project
end

.find_target(params) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 27

def self.find_target(params)
  project = find_project(params)
  if params[:target]
    target = project.targets.detect { |t| t.name == params[:target] }
    target
  else
    # firstly we are trying to find modern application target
    target = project.targets.detect do |t|
      t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
        t.product_type == 'com.apple.product-type.application'
    end
    target = project.targets[0] if target.nil?
    target
  end
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 119

def self.is_supported?(platform)
  # you can do things like
  # 
  #  true
  # 
  #  platform == :ios
  # 
  #  [:ios, :mac].include?(platform)
  # 

  platform == :ios
end

.outputObject



102
103
104
105
106
107
108
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 102

def self.output
  # Define the shared values you are going to provide
  # Example
  [
    ['GET_EMTITLEMENTS_PLIST_FILE_PATH_CUSTOM_VALUE', 'A description of what this value contains']
  ]
end

.return_valueObject



110
111
112
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 110

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb', line 11

def self.run(params)
  project = find_project(params)
  target = find_target(params)
  buildConfiguration = target.build_settings("Release")
  filePath = buildConfiguration["CODE_SIGN_ENTITLEMENTS"]
  if params[:is_absolute] then
    filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
  end
  filePath
end