Sha256: 30910f19987201e07e3c7f6d1008a1b04fcd2140be21d0c2a012916451a7a4aa

Contents?: true

Size: 1.6 KB

Versions: 40

Compression:

Stored size: 1.6 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)
          UI.user_error!("Please pass values like this: key:value") unless key.length > 0
          value = convert_value(value)
          UI.verbose("Using #{key}: #{value}")
          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

      if FastlaneCore::FastlaneFolder.swift?
        Fastlane::SwiftLaneManager.cruise_lane(lane, lane_parameters, dot_env)
      else
        Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters, dot_env)
      end
    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

40 entries across 40 versions & 1 rubygems

Version Path
fastlane-2.74.1 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.74.0 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.74.0.beta.20180108010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.74.0.beta.20180107010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.74.0.beta.20180106010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.73.0 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.73.0.beta.20180105010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.73.0.beta.20180104010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.73.0.beta.20180103010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20180102010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20180101010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20171231010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.71.1 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20171230010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20171229010003 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.72.0.beta.20171228010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.71.0 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.71.0.beta.20171227010004 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.71.0.beta.20171226010004 fastlane/lib/fastlane/command_line_handler.rb