Class: Fastlane::Lane

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/lane.rb

Overview

Represents a lane

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false) ⇒ Lane

Returns a new instance of Lane.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastlane/lane.rb', line 17

def initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false)
  UI.user_error!("description must be an array") unless description.kind_of? Array
  UI.user_error!("lane name must not contain any spaces") if name.to_s.include? " "
  UI.user_error!("lane name must start with :") unless name.kind_of? Symbol

  if self.class.black_list.include?(name.to_s)
    UI.error "Lane Name '#{name}' can not be one of the followings: #{self.class.black_list}".red
    UI.user_error!("Name '#{name}' is already taken")
  end

  self.platform = platform
  self.name = name
  self.description = description
  self.block = block
  self.is_private = is_private
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



12
13
14
# File 'lib/fastlane/lane.rb', line 12

def block
  @block
end

#descriptionArray

Returns An array containing the description of this lane Each item of the array is one line.

Returns:

  • (Array)

    An array containing the description of this lane Each item of the array is one line



10
11
12
# File 'lib/fastlane/lane.rb', line 10

def description
  @description
end

#is_privateBoolean

Returns Is that a private lane that can’t be called from the CLI?.

Returns:

  • (Boolean)

    Is that a private lane that can’t be called from the CLI?



15
16
17
# File 'lib/fastlane/lane.rb', line 15

def is_private
  @is_private
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/fastlane/lane.rb', line 6

def name
  @name
end

#platformObject

Returns the value of attribute platform.



4
5
6
# File 'lib/fastlane/lane.rb', line 4

def platform
  @platform
end

Class Method Details

.black_listObject



45
46
47
# File 'lib/fastlane/lane.rb', line 45

def black_list
  %w(run init new_action lanes list docs action actions help)
end

Instance Method Details

#call(parameters) ⇒ Object

Execute this lane



35
36
37
# File 'lib/fastlane/lane.rb', line 35

def call(parameters)
  block.call(parameters || {})
end

#pretty_nameString

Returns The lane + name of the lane. If there is no platform, it will only be the lane name.

Returns:

  • (String)

    The lane + name of the lane. If there is no platform, it will only be the lane name



40
41
42
# File 'lib/fastlane/lane.rb', line 40

def pretty_name
  [platform, name].reject(&:nil?).join(' ')
end