Class: Nanoc::DataSources::Filesystem Private

Inherits:
Nanoc::DataSource
  • Object
show all
Defined in:
lib/nanoc/data_sources/filesystem.rb,
lib/nanoc/data_sources/filesystem/tools.rb,
lib/nanoc/data_sources/filesystem/errors.rb,
lib/nanoc/data_sources/filesystem/parser.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.

API:

  • private

Defined Under Namespace

Modules: Errors, Tools Classes: AmbiguousMetadataAssociationError, Parser, ProtoDocument

Instance Method Summary collapse

Instance Method Details

#changes_for_dir(dir) ⇒ Object

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.

API:

  • private



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/nanoc/data_sources/filesystem.rb', line 91

def changes_for_dir(dir)
  require 'listen'

  Nanoc::Core::ChangesStream.new do |cl|
    full_dir = dir ? File.expand_path(dir) : nil

    if full_dir && File.directory?(full_dir)
      listener =
        Listen.to(full_dir) do |_modifieds, _addeds, _deleteds|
          cl.unknown
        end

      listener.start

      cl.to_stop { listener.stop }
    end

    sleep
  end
end

#content_dir_nameObject

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.

API:

  • private



65
66
67
# File 'lib/nanoc/data_sources/filesystem.rb', line 65

def content_dir_name
  config.fetch(:content_dir, 'content')
end

#downObject

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.

See Core::DataSource.down.

API:

  • private



63
# File 'lib/nanoc/data_sources/filesystem.rb', line 63

def down; end

#item_changesObject

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.

API:

  • private



83
84
85
# File 'lib/nanoc/data_sources/filesystem.rb', line 83

def item_changes
  changes_for_dir(content_dir_name)
end

#itemsObject

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.

See Core::DataSource.items.

API:

  • private



74
75
76
# File 'lib/nanoc/data_sources/filesystem.rb', line 74

def items
  load_objects(content_dir_name, Nanoc::Core::Item)
end

#layout_changesObject

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.

API:

  • private



87
88
89
# File 'lib/nanoc/data_sources/filesystem.rb', line 87

def layout_changes
  changes_for_dir(layouts_dir_name)
end

#layoutsObject

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.

See Core::DataSource.layouts.

API:

  • private



79
80
81
# File 'lib/nanoc/data_sources/filesystem.rb', line 79

def layouts
  load_objects(layouts_dir_name, Nanoc::Core::Layout)
end

#layouts_dir_nameObject

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.

API:

  • private



69
70
71
# File 'lib/nanoc/data_sources/filesystem.rb', line 69

def layouts_dir_name
  config.fetch(:layouts_dir, 'layouts')
end

#upObject

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.

See Core::DataSource.up.

API:

  • private



60
# File 'lib/nanoc/data_sources/filesystem.rb', line 60

def up; end