Module: Elastics::Tasks

Extended by:
Tasks
Includes:
ActiveRecord::TasksConfig, Config, Indices, Mappings, Migrations
Included in:
Tasks
Defined in:
lib/elastics/tasks.rb,
lib/elastics/tasks/config.rb,
lib/elastics/tasks/indices.rb,
lib/elastics/tasks/mappings.rb,
lib/elastics/tasks/migrations.rb

Defined Under Namespace

Modules: Config, Indices, Mappings, Migrations

Instance Attribute Summary collapse

Attributes included from Mappings

#mappings_path

Attributes included from Indices

#indices_path

Attributes included from Config

#base_paths

Instance Method Summary collapse

Methods included from ActiveRecord::TasksConfig

#base_paths, #client, #config, #version_manager

Methods included from Migrations

#migrate, #migrate!, #models_to_reindex, #reindex

Methods included from Mappings

#fix_mapping, #index_for_type, #indices, #mappings, #mappings_from_dirs, #mappings_from_files, #mappings_paths, #put_mappings, #types

Methods included from Indices

#alias_action, #create_indices, #drop_indices, #forward_aliases, #indices, #indices_from_dirs, #indices_from_files, #indices_paths, #indices_settings, #manage_aliases, #post_aliases, #purge, #versioned_index_name

Methods included from Config

#client, #client=, #config, #config=, #version_manager

Instance Attribute Details

#verboseObject

Returns the value of attribute verbose.



32
33
34
# File 'lib/elastics/tasks.rb', line 32

def verbose
  @verbose
end

Instance Method Details

#load_yaml(file) ⇒ Object



41
42
43
# File 'lib/elastics/tasks.rb', line 41

def load_yaml(file)
  YAML.load(ERB.new(File.read(file)).result)
end

#log(*args) ⇒ Object



27
28
29
30
# File 'lib/elastics/tasks.rb', line 27

def log(*args)
  puts(*args) if verbose
  Rails.logger.info { "Elastics: #{args.join ' '}" } if defined?(Rails)
end

#suppress_messagesObject



34
35
36
37
38
39
# File 'lib/elastics/tasks.rb', line 34

def suppress_messages
  verbose_was, self.verbose = verbose, false
  yield
ensure
  self.verbose = verbose_was
end