Sha256: 9c73a5f80c6342d0849ef5bfc0d88f15add56ae0e1e42ce835f5d7d84fb6b867

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 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

      run(action: action_name,
          parameters: action_parameters)
    end

    def self.run(action: nil, parameters: nil)
      class_name = action.fastlane_class + 'Action'
      class_ref = nil
      begin
        class_ref = Fastlane::Actions.const_get(class_name)
      rescue NameError
        UI.user_error!("Action '#{action}' not available, run `fastlane actions` to get a full list")
      end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-1.92.0 lib/fastlane/one_off.rb
fastlane-1.91.0 lib/fastlane/one_off.rb
fastlane-1.90.0 lib/fastlane/one_off.rb
fastlane-1.89.0 lib/fastlane/one_off.rb
fastlane-1.88.0 lib/fastlane/one_off.rb