Exception: Fastlane::Helper::SyncDevicesHelper::InvalidDevicesFile

Inherits:
StandardError
  • Object
show all
Defined in:
lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb

Overview

Generic error that is raised if device file is not in the valid format.

Constant Summary collapse

SAMPLE_FILE_URL =

URL of example devices files.

'https://developer.apple.com/account/resources/downloads/Multiple-Upload-Samples.zip'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, path, line_number: nil, entry: nil) ⇒ InvalidDevicesFile

Returns a new instance of InvalidDevicesFile.

Parameters:

  • message (String)
  • path (String)
  • line_number (String, nil) (defaults to: nil)
  • entry (String, nil) (defaults to: nil)


249
250
251
252
253
254
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 249

def initialize(message, path, line_number: nil, entry: nil)
  super(format(message, { location: [path, line_number].join(':'), url: SAMPLE_FILE_URL }))
  @path = path
  @line_number = line_number
  @entry = entry
end

Instance Attribute Details

#entryString? (readonly)

Returns:

  • (String, nil)


243
244
245
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 243

def entry
  @entry
end

#line_numberInteger (readonly)

Returns:

  • (Integer)


241
242
243
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 241

def line_number
  @line_number
end

#pathString (readonly)

Returns:

  • (String)


239
240
241
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 239

def path
  @path
end

Class Method Details

.columns_too_long(path, line_number) ⇒ InvalidDevicesFile

Parameters:

  • path (String)
  • line_number (Integer)

Returns:



277
278
279
280
281
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 277

def self.columns_too_long(path, line_number)
  message = 'Invalid device line at %<location>s, please provide a file according to ' \
            'the Apple Sample UDID file (%<url>s)'
  new(message, path, line_number: line_number)
end

.columns_too_short(path, line_number) ⇒ InvalidDevicesFile

Parameters:

  • path (String)
  • line_number (Integer)

Returns:



268
269
270
271
272
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 268

def self.columns_too_short(path, line_number)
  message = 'Invalid device line at %<location>s, ensure you are using tabs (NOT spaces). ' \
            "See Apple's sample/spec here: %<url>s"
  new(message, path, line_number: line_number)
end

.device_name_too_long(name, path) ⇒ InvalidDevicesFile

Parameters:

  • name (String)
  • path (String)

Returns:



310
311
312
313
314
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 310

def self.device_name_too_long(name, path)
  message = "Invalid device name '#{name}' at %<location>s, a device name " \
            "must be less than or equal to #{DevicesFile::MAX_DEVICE_NAME_LENGTH} characters long"
  new(message, path)
end

.invalid_headers(path, line_number) ⇒ InvalidDevicesFile

Parameters:

  • path (String)
  • line_number (Integer)

Returns:



259
260
261
262
263
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 259

def self.invalid_headers(path, line_number)
  message = 'Invalid header line at %<location>s, please provide a file according to ' \
            'the Apple Sample UDID file (%<url>s)'
  new(message, path, line_number: line_number)
end

.invalid_udid(udid, path) ⇒ InvalidDevicesFile

Parameters:

  • udid (String)
  • path (String)

Returns:



295
296
297
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 295

def self.invalid_udid(udid, path)
  new("Invalid UDID '#{udid}' at %<location>s, the UDID is not in the correct format", path)
end

.missing_key(entry, path) ⇒ InvalidDevicesFile

Parameters:

  • entry (String)
  • path (String)

Returns:



286
287
288
289
290
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 286

def self.missing_key(entry, path)
  message = "Invalid device file at %<location>s, each item must have a required key '#{entry}', " \
            "See Apple's sample/spec here: %<url>s"
  new(message, path, entry: entry)
end

.udid_not_unique(udid, path) ⇒ InvalidDevicesFile

Parameters:

  • udid (String)
  • path (String)

Returns:



302
303
304
305
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 302

def self.udid_not_unique(udid, path)
  message = "Invalid UDID '#{udid}' at %<location>s, there's another device with the same UDID is defined"
  new(message, path)
end

.unknown_platform(platform, path) ⇒ InvalidDevicesFile

Parameters:

  • platform (String)
  • path (String)

Returns:



319
320
321
# File 'lib/fastlane/plugin/sync_devices/helper/sync_devices_helper/devices_file.rb', line 319

def self.unknown_platform(platform, path)
  new("Unknown platform '#{platform}' at %<location>s", path)
end