Sha256: 5bcb9265e731866d682f7aa08d290abacba3b24c64204fd7e303a8a8559c0806

Contents?: true

Size: 1.46 KB

Versions: 30

Compression:

Stored size: 1.46 KB

Contents

module Fastlane
  class CommandLineHandler
    # This method handles command line inputs and properly transforms them to a usable format
    # @param [Array] args An array of all arguments (not options)
    # @param [Array] args A hash of all options (e.g. --env NAME)
    def self.handle(args, options)
      lane_parameters = {} # the parameters we'll pass to the lane
      platform_lane_info = [] # the part that's responsible for the lane/platform definition
      args.each do |current|
        if current.include? ":" # that's a key/value which we want to pass to the lane
          key, value = current.split(":", 2)
          raise "Please pass values like this: key:value" unless key.length > 0
          value = convert_value(value)
          Helper.log.debug "Using #{key}: #{value}".yellow
          lane_parameters[key.to_sym] = value
        else
          platform_lane_info << current
        end
      end

      platform = nil
      lane = platform_lane_info[1]
      if lane
        platform = platform_lane_info[0]
      else
        lane = platform_lane_info[0]
      end

      dot_env = Helper.is_test? ? nil : options.env

      Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters, dot_env)
    end

    # Helper to convert into the right data type
    def self.convert_value(value)
      return true if value == 'true' || value == 'yes'
      return false if value == 'false' || value == 'no'

      # Default case:
      return value
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fastlane-1.44.0 lib/fastlane/command_line_handler.rb
fastlane-1.43.0 lib/fastlane/command_line_handler.rb
fastlane-1.42.0 lib/fastlane/command_line_handler.rb
fastlane-1.41.1 lib/fastlane/command_line_handler.rb
fastlane-1.41.0 lib/fastlane/command_line_handler.rb
fastlane-1.40.0 lib/fastlane/command_line_handler.rb
fastlane-1.39.0 lib/fastlane/command_line_handler.rb
fastlane-1.38.1 lib/fastlane/command_line_handler.rb
fastlane-1.38.0 lib/fastlane/command_line_handler.rb
fastlane-1.37.0 lib/fastlane/command_line_handler.rb
fastlane-1.36.4 lib/fastlane/command_line_handler.rb
fastlane-1.36.3 lib/fastlane/command_line_handler.rb
fastlane-1.36.2 lib/fastlane/command_line_handler.rb
fastlane-1.36.1 lib/fastlane/command_line_handler.rb
fastlane-1.36.0 lib/fastlane/command_line_handler.rb
fastlane-1.35.0 lib/fastlane/command_line_handler.rb
fastlane-1.34.0 lib/fastlane/command_line_handler.rb
fastlane-1.33.6 lib/fastlane/command_line_handler.rb
fastlane-1.33.5 lib/fastlane/command_line_handler.rb
fastlane-1.33.4 lib/fastlane/command_line_handler.rb