Class: Fastlane::ConfigurationHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/configuration_helper.rb

Class Method Summary collapse

Class Method Details

.parse(action, params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fastlane/configuration_helper.rb', line 3

def self.parse(action, params)
  begin
    first_element = (action.available_options.first rescue nil) # might also be nil
    
    if first_element and first_element.kind_of?FastlaneCore::ConfigItem
      # default use case
      return FastlaneCore::Configuration.create(action.available_options, params)

    elsif first_element
      puts "Old configuration format for action '#{action}'".red if Helper.is_test?
      return params
    else

      # No parameters... we still need the configuration object array
      FastlaneCore::Configuration.create(action.available_options, {})

    end
  rescue => ex
    if action.respond_to?:action_name
      Helper.log.fatal "You passed invalid parameters to '#{action.action_name}'.".red
      Helper.log.fatal "Check out the error below and available options by running `fastlane action #{action.action_name}`".red
    end
    raise ex
  end
end