Sha256: 1e80aa656a590224c6e8b0866b3eca5683a97e450a40ffb1229e9f2473b0fc21

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

module Fastlane
  # Represents a lane
  class Lane
    attr_accessor :platform

    attr_accessor :name

    # @return [Array] An array containing the description of this lane
    #   Each item of the array is one line
    attr_accessor :description

    attr_accessor :block

    # @return [Boolean] Is that a private lane that can't be called from the CLI?
    attr_accessor :is_private

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

      if self.class.black_list.include?(name.to_s)
        Helper.log.error "Lane Name '#{name}' can not be one of the followings: #{self.class.black_list}".red
        raise "Name '#{name}' is already taken"
      end
      
      self.platform = platform
      self.name = name
      self.description = description
      self.block = block
      self.is_private = is_private
    end

    # Execute this lane
    def call(parameters)
      block.call(parameters || {})
    end

    # @return [String] The lane + name of the lane. If there is no platform, it will only be the lane name
    def pretty_name
      [platform, name].reject(&:nil?).join(' ')
    end

    class << self
      def black_list
        %w{run init new_action lanes list docs action actions help}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-1.20.0 lib/fastlane/lane.rb
fastlane-1.19.0 lib/fastlane/lane.rb
fastlane-1.18.0 lib/fastlane/lane.rb
fastlane-1.17.1 lib/fastlane/lane.rb
fastlane-1.17.0 lib/fastlane/lane.rb