Class: Flex::Tasks
- Inherits:
-
Object
- Object
- Flex::Tasks
- Defined in:
- lib/flex/tasks.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #config_hash ⇒ Object
- #create_indices ⇒ Object
- #default_options ⇒ Object
- #delete_indices ⇒ Object
-
#initialize(overrides = {}) ⇒ Tasks
constructor
A new instance of Tasks.
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/flex/tasks.rb', line 4 def @options end |
Instance Method Details
#config_hash ⇒ Object
31 32 33 34 |
# File 'lib/flex/tasks.rb', line 31 def config_hash @config_hash ||= ( hash = YAML.load(Utils.erb_process(config_path)) Utils.delete_allcaps_keys(hash) ) end |
#create_indices ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/flex/tasks.rb', line 18 def create_indices indices.each do |index| delete_index(index) if [:force] raise ExistingIndexError, "#{index.inspect} already exists. Please use FORCE=1 if you want to delete it first." \ if exist?(index) create(index) end end |
#default_options ⇒ Object
12 13 14 15 16 |
# File 'lib/flex/tasks.rb', line 12 def @default_options ||= { :force => false, :index => Conf.variables[:index], :config_file => Conf.config_file } end |
#delete_indices ⇒ Object
27 28 29 |
# File 'lib/flex/tasks.rb', line 27 def delete_indices indices.each { |index| delete_index(index) } end |