Sha256: a72d3f41160f7577c77d09eb92c3f73d0c60d102becb5eb1d3ceebc1b5e8965b

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

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)
          UI.user_error!("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

      UI.crash!("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
        UI.crash!("Action '#{class_name}' not found")
      end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fastlane-1.84.0 lib/fastlane/one_off.rb
fastlane-1.83.0 lib/fastlane/one_off.rb
fastlane-1.82.0 lib/fastlane/one_off.rb
fastlane-1.81.0 lib/fastlane/one_off.rb
fastlane-1.80.0 lib/fastlane/one_off.rb
fastlane-1.70.0 lib/fastlane/one_off.rb
fastlane-1.69.0 lib/fastlane/one_off.rb