Sha256: 973dd35a2af96a999ac071b50b3d94b0022d8f187d4aaf11087dffbd5ad1bf2f

Contents?: true

Size: 1.81 KB

Versions: 482

Compression:

Stored size: 1.81 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.test? ? nil : options.env

      if FastlaneCore::FastlaneFolder.swift?
        disable_runner_upgrades = options.disable_runner_upgrades || false
        swift_server_port = options.swift_server_port
        Fastlane::SwiftLaneManager.cruise_lane(lane, lane_parameters, dot_env, disable_runner_upgrades: disable_runner_upgrades, swift_server_port: swift_server_port)
      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

482 entries across 482 versions & 5 rubygems

Version Path
fastlane-2.118.0.beta.20190313200029 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190312200018 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190311200036 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190310200100 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190309200014 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190308200057 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190307200117 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190306200052 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190305200056 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190304200015 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190303200015 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190302200102 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.118.0.beta.20190301200031 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.1 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0.beta.20190228200006 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0.beta.20190227200038 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0.beta.20190226200042 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0.beta.20190225200103 fastlane/lib/fastlane/command_line_handler.rb
fastlane-2.117.0.beta.20190224200023 fastlane/lib/fastlane/command_line_handler.rb