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
# 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

  self.class.verify_lane_name(name)

  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



57
58
59
# File 'lib/fastlane/lane.rb', line 57

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

.gray_listObject



61
62
63
# File 'lib/fastlane/lane.rb', line 61

def gray_list
  Fastlane::TOOLS
end

.verify_lane_name(name) ⇒ Object

Makes sure the lane name is valid



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fastlane/lane.rb', line 43

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

  if self.gray_list.include?(name.to_sym)
    UI.error "Lane name '#{name}' should not be used because it is the name of a fastlane tool"
    UI.error "It is recommended to not use '#{name}' as the name of your lane"
    # We still allow it, because we're nice
    # Otherwise we might break existing setups
  end
end

Instance Method Details

#call(parameters) ⇒ Object

Execute this lane



32
33
34
# File 'lib/fastlane/lane.rb', line 32

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



37
38
39
# File 'lib/fastlane/lane.rb', line 37

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