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

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.

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.



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

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.



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

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.



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

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.



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

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.



77
78
79
# File 'lib/nanoc/data_sources/filesystem.rb', line 77

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.



90
91
92
# File 'lib/nanoc/data_sources/filesystem.rb', line 90

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.



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

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.



72
73
74
# File 'lib/nanoc/data_sources/filesystem.rb', line 72

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.



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

def up; end