Class: StackedConfig::Layers::GenericLayer

Inherits:
SuperStack::Layer
  • Object
show all
Includes:
SourceHelper
Defined in:
lib/stacked_config/layers/generic_layer.rb

Direct Known Subclasses

ExecutableGemLayer, GemLayer, SystemLayer, UserLayer

Constant Summary

Constants included from SourceHelper

SourceHelper::DEFAULT_OS_FLAVOUR, SourceHelper::EXTENSIONS, SourceHelper::OS_FLAVOURS

Instance Method Summary collapse

Methods included from SourceHelper

included, os_flavour, #os_flavour, supported_oses, #supported_oses

Constructor Details

#initializeGenericLayer

Returns a new instance of GenericLayer.


12
13
14
# File 'lib/stacked_config/layers/generic_layer.rb', line 12

def initialize
  rescan
end

Instance Method Details

#possible_config_files(places = possible_sources) ⇒ Object


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/stacked_config/layers/generic_layer.rb', line 16

def possible_config_files(places=possible_sources)
  result = {}
  already_found = false
  browse_files(places) do |file|
    exists = File.readable?(file)
    used = false
    already_found = used = true if exists and not already_found
    result[file] = {
        exists: exists,
        used: used,
        layer: [name]
    }
  end
  result
end

#rescanObject


8
9
10
# File 'lib/stacked_config/layers/generic_layer.rb', line 8

def rescan
  set_config_file possible_sources
end