Class: Lifer::Brain

Inherits:
Object
  • Object
show all
Defined in:
lib/lifer/brain.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



2
3
4
# File 'lib/lifer/brain.rb', line 2

def root
  @root
end

Class Method Details

.init(root: Dir.pwd) ⇒ Object



5
6
7
# File 'lib/lifer/brain.rb', line 5

def init(root: Dir.pwd)
  new(root: root)
end

Instance Method Details

#build!Object



10
11
12
# File 'lib/lifer/brain.rb', line 10

def build!
  Lifer::Builder::HTML.execute(root: root)
end

#collectionsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lifer/brain.rb', line 14

def collections
  @collections ||=
    begin
      collection_map =
        config.collections.map { |collection_name|
          [collection_name, "#{root}/#{collection_name}"]
        }.to_h.merge!({root: root})

      collection_map.map { |name, dir|
        Lifer::Collection.generate(name: name, directory: dir)
      }
    end
end

#configObject



28
29
30
# File 'lib/lifer/brain.rb', line 28

def config
  @config ||= Lifer::Config.build(file: config_file_location)
end

#manifestObject



32
33
34
# File 'lib/lifer/brain.rb', line 32

def manifest
  @manifest ||= Set.new
end