Class: SolrMakr::Commands::Execute Private

Inherits:
ActiveInteraction::Base
  • Object
show all
Includes:
BufferInteraction, Utility
Defined in:
lib/solr_makr/commands/execute.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Execute an application command based on its configuration.

Constant Summary

Constants included from Utility

Utility::REQUIRED_SOLR_NODES

Instance Attribute Summary

Attributes included from BufferInteraction

#buffer

Instance Method Summary collapse

Methods included from Utility

default_table, default_table_options!, hash_to_table, looks_like_a_valid_configset?, path_to_configset

Methods included from BufferInteraction

#build_buffer, #compose_buffer

Instance Method Details

#executeSolrMakr::Commands::Buffer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/solr_makr/commands/execute.rb', line 17

def execute
  set_global_options!

  set_default_options!

  validate_options!

  unless errors.any?
    compose_buffer action.interaction_klass, **raw_options
  end

  return buffer
end

#raw_optionsHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash)


62
63
64
# File 'lib/solr_makr/commands/execute.rb', line 62

def raw_options
  command_options.__hash__.symbolize_keys
end

#set_default_options!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Inherit default options for the action if any.



47
48
49
# File 'lib/solr_makr/commands/execute.rb', line 47

def set_default_options!
  action.set_default_options!(command_args, command_options)
end

#set_global_options!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Set global options for the environment.



40
41
42
# File 'lib/solr_makr/commands/execute.rb', line 40

def set_global_options!
  compose SolrMakr::SetGlobalOptions, raw_options
end

#validate_options!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



52
53
54
55
56
57
58
# File 'lib/solr_makr/commands/execute.rb', line 52

def validate_options!
  action.option_mapping.each do |option|
    unless option.valid_in?(command_options)
      errors.add :base, "Missing required argument: #{option.long_name}"
    end
  end
end