Sha256: 8bf0609bfdfaf3d21adf02cc230690ca8d7c5a7ea037261d39061957dbf6ad2b

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

module Fastlane
  # Call actions without triggering a full lane
  class OneOff
    def self.execute(args: nil)
      action_parameters = {}
      action_name = nil

      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 = CommandLineHandler.convert_value(value)
          UI.verbose("Using #{key}: #{value}")
          action_parameters[key.to_sym] = value
        else
          action_name ||= current
        end
      end

      raise "invalid syntax" unless action_name

      class_name = action_name.fastlane_class + 'Action'
      class_ref = nil
      begin
        class_ref = Fastlane::Actions.const_get(class_name)
      rescue NameError
        raise "Action not found"
      end

      r = Runner.new
      r.execute_action(action_name, class_ref, [action_parameters], custom_dir: '.')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fastlane-1.68.0 lib/fastlane/one_off.rb
fastlane-1.67.0 lib/fastlane/one_off.rb