Class: Fastlane::Lane
- Inherits:
-
Object
- Object
- Fastlane::Lane
- Defined in:
- fastlane/lib/fastlane/lane.rb
Overview
Represents a lane
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#description ⇒ Array
An array containing the description of this lane Each item of the array is one line.
-
#is_private ⇒ Boolean
Is that a private lane that can’t be called from the CLI?.
-
#name ⇒ Object
Returns the value of attribute name.
-
#platform ⇒ Object
Returns the value of attribute platform.
Class Method Summary collapse
- .black_list ⇒ Object
- .ensure_name_not_conflicts(name) ⇒ Object
- .gray_list ⇒ Object
-
.verify_lane_name(name) ⇒ Object
Makes sure the lane name is valid.
Instance Method Summary collapse
-
#call(parameters) ⇒ Object
Execute this lane.
-
#initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false) ⇒ Lane
constructor
A new instance of Lane.
-
#pretty_name ⇒ String
The lane + name of the lane.
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 'fastlane/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
#block ⇒ Object
Returns the value of attribute block.
12 13 14 |
# File 'fastlane/lib/fastlane/lane.rb', line 12 def block @block end |
#description ⇒ Array
Returns An array containing the description of this lane Each item of the array is one line.
10 11 12 |
# File 'fastlane/lib/fastlane/lane.rb', line 10 def description @description end |
#is_private ⇒ Boolean
Returns Is that a private lane that can’t be called from the CLI?.
15 16 17 |
# File 'fastlane/lib/fastlane/lane.rb', line 15 def is_private @is_private end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'fastlane/lib/fastlane/lane.rb', line 6 def name @name end |
#platform ⇒ Object
Returns the value of attribute platform.
4 5 6 |
# File 'fastlane/lib/fastlane/lane.rb', line 4 def platform @platform end |
Class Method Details
.black_list ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'fastlane/lib/fastlane/lane.rb', line 62 def black_list %w( run init new_action lanes list docs action actions enable_auto_complete new_plugin add_plugin install_plugins update_plugins search_plugins help env update_fastlane ) end |
.ensure_name_not_conflicts(name) ⇒ Object
88 89 90 91 92 93 94 |
# File 'fastlane/lib/fastlane/lane.rb', line 88 def ensure_name_not_conflicts(name) # First, check if there is a predefined method in the actions folder return unless Actions.action_class_ref(name) UI.error("------------------------------------------------") UI.error("Name of the lane '#{name}' is already taken by the action named '#{name}'") UI.error("------------------------------------------------") end |
.gray_list ⇒ Object
84 85 86 |
# File 'fastlane/lib/fastlane/lane.rb', line 84 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 56 57 58 59 60 |
# File 'fastlane/lib/fastlane/lane.rb', line 43 def verify_lane_name(name) if self.black_list.include?(name.to_s) UI.error("Lane name '#{name}' is invalid! Invalid names are #{self.black_list.join(', ')}.") UI.user_error!("Lane name '#{name}' is invalid") end if self.gray_list.include?(name.to_sym) UI.error("------------------------------------------------") 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") UI.error("------------------------------------------------") # We still allow it, because we're nice # Otherwise we might break existing setups return end self.ensure_name_not_conflicts(name.to_s) end |
Instance Method Details
#call(parameters) ⇒ Object
Execute this lane
32 33 34 |
# File 'fastlane/lib/fastlane/lane.rb', line 32 def call(parameters) block.call(parameters || {}) end |
#pretty_name ⇒ String
Returns The lane + name of the lane. If there is no platform, it will only be the lane name.
37 38 39 |
# File 'fastlane/lib/fastlane/lane.rb', line 37 def pretty_name [platform, name].reject(&:nil?).join(' ') end |