Class: Fastlane::Actions::UpdateProjectTeamAction

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

Constant Summary

Constants inherited from Fastlane::Action

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

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



49
50
51
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 49

def self.author
  "lgaches"
end

.available_optionsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 30

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "FL_PROJECT_SIGNING_PROJECT_PATH",
                                 description: "Path to your Xcode project",
                                 default_value: Dir['*.xcodeproj'].first,
                                 default_value_dynamic: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("Path is invalid") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :teamid,
                                 env_name: "FL_PROJECT_TEAM_ID",
                                 description: "The Team ID you want to use",
                                 code_gen_sensitive: true,
                                 default_value: ENV["TEAM_ID"] || CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
                                 default_value_dynamic: true)
  ]
end

.categoryObject



67
68
69
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 67

def self.category
  :project
end

.descriptionObject



22
23
24
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 22

def self.description
  "Update Xcode Development Team ID"
end

.detailsObject



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

def self.details
  "This action updates the Developer Team ID of your Xcode project."
end

.example_codeObject



57
58
59
60
61
62
63
64
65
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 57

def self.example_code
  [
    'update_project_team',
    'update_project_team(
      path: "Example.xcodeproj",
      teamid: "A3ZZVJ7CNY"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



53
54
55
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 53

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

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'fastlane/lib/fastlane/actions/update_project_team.rb', line 7

def self.run(params)
  path = params[:path]
  path = File.join(path, "project.pbxproj")
  UI.user_error!("Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!") unless File.exist?(path)

  UI.message("Updating development team (#{params[:teamid]}) for the given project '#{path}'")

  p = File.read(path)
  p.gsub!(/DevelopmentTeam = .*;/, "DevelopmentTeam = #{params[:teamid]};")
  p.gsub!(/DEVELOPMENT_TEAM = .*;/, "DEVELOPMENT_TEAM = #{params[:teamid]};")
  File.write(path, p)

  UI.success("Successfully updated project settings to use Developer Team ID '#{params[:teamid]}'")
end