Class: Fastlane::Actions::AddAllDevicesToProvisioningProfilesAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



69
70
71
72
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 69

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ['Automattic']
end

.available_optionsObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 40

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :app_identifier,
      description: 'List of App Identifiers that should contain the new device identifier',
      type: Array,
      verify_block: proc do |value|
        UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :team_id,
      description: 'The team_id for the provisioning profiles',
      type: String,
      verify_block: proc do |value|
        UI.user_error!('You must provide a team ID in `team_id`') unless value && !value.empty?
      end
    ),
  ]
end

.descriptionObject



32
33
34
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 32

def self.description
  'Add devices to provisioning profiles'
end

.detailsObject



36
37
38
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 36

def self.details
  'Add all iOS devices to any profiles associated with the provided bundle identifiers'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 74

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



61
62
63
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 61

def self.output
  # This lane doesn't provide variables that other lanes can consume.
end

.return_valueObject



65
66
67
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 65

def self.return_value
  # If your method provides a return value, you can describe here what it does
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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb', line 4

def self.run(params)
  require 'spaceship'

  Spaceship.
  Spaceship.select_team(team_id: params[:team_id])

  devices = Spaceship.device.all_ios_profile_devices

  params[:app_identifier].each do |identifier|
    Spaceship.provisioning_profile.find_by_bundle_id(bundle_id: identifier)
             .select do |profile|
      profile.is_a? Spaceship::Portal::ProvisioningProfile::Development
    end
             .tap do |profiles|
      UI.important "Warning: Unable to find any profiles associated with #{identifier}" if profiles.empty?
    end
             .each do |profile|
      profile.devices = devices
      profile.update!
      UI.success "Applied #{devices.length} devices to #{profile.name}"
    end
  end
end