Sha256: c0cf10d1f5bc852ac03d3e01124b978b5738e3838b9a65b07aee7086385760e1

Contents?: true

Size: 1.66 KB

Versions: 35

Compression:

Stored size: 1.66 KB

Contents

require 'json'

module Fastlane
  class Argument
    def initialize(json: nil)
      @name = json['name']
      @value = json['value']
      @value_type = json['value_type']
    end

    def is_named
      return @name.to_s.length > 0
    end

    def inspect
      if is_named
        return "named argument: #{name}, value: #{value}, type: #{value_type}"
      else
        return "unnamed argument value: #{value}, type: #{value_type}"
      end
    end

    attr_reader :name
    attr_reader :value
    attr_reader :value_type
  end

  class Command
    def initialize(json: nil)
      command_json = JSON.parse(json)
      @method_name = command_json['methodName']
      @class_name = command_json['className']
      @command_id = command_json['commandID']

      args_json = command_json['args'] ||= []
      @args = args_json.map do |arg|
        Argument.new(json: arg)
      end
    end

    def target_class
      unless class_name
        return nil
      end

      return Fastlane::Actions.const_get(class_name)
    end

    def is_class_method_command
      return class_name.to_s.length > 0
    end

    attr_reader :command_id # always present
    attr_reader :args # always present
    attr_reader :method_name # always present
    attr_reader :class_name # only present when executing a class-method
  end

  class CommandReturn
    attr_reader :return_value
    attr_reader :return_value_type
    attr_reader :closure_argument_value

    def initialize(return_value: nil, return_value_type: nil, closure_argument_value: nil)
      @return_value = return_value
      @closure_argument_value = closure_argument_value
      @return_value_type = return_value_type
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
fastlane-2.73.0 fastlane/lib/fastlane/server/command.rb
fastlane-2.73.0.beta.20180105010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.73.0.beta.20180104010004 fastlane/lib/fastlane/server/command.rb
fastlane-2.73.0.beta.20180103010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20180102010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20180101010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20171231010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.1 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20171230010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20171229010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.72.0.beta.20171228010004 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171227010004 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171226010004 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171225010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171224010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171223010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.71.0.beta.20171222010003 fastlane/lib/fastlane/server/command.rb
fastlane-2.70.3 fastlane/lib/fastlane/server/command.rb