Module: Nanoc::DataSources::Filesystem
- Included in:
- FilesystemUnified, FilesystemVerbose
- Defined in:
- lib/nanoc/data_sources/filesystem.rb
Overview
Provides functionality common across all filesystem data sources.
Instance Attribute Summary (collapse)
-
- (Nanoc::Extra::VCS?) vcs
The VCS that will be called when adding, deleting and moving files.
Instance Method Summary (collapse)
-
- (Object) content_dir_name
- - (Object) create_item(content, attributes, identifier, params = {})
- - (Object) create_layout(content, attributes, identifier, params = {})
- - (Object) down
- - (Object) items
- - (Object) layouts
-
- (Object) layouts_dir_name
- - (Object) setup
-
- (Object) up
See Nanoc::DataSource#up.
Instance Attribute Details
- (Nanoc::Extra::VCS?) vcs
The VCS that will be called when adding, deleting and moving files. If
no VCS has been set, or if the VCS has been set to nil
, a dummy VCS
will be returned.
11 12 13 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 11 def vcs @vcs ||= Nanoc::Extra::VCSes::Dummy.new end |
Instance Method Details
- (Object) content_dir_name
24 25 26 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 24 def content_dir_name config.fetch(:content_dir, 'content') end |
- (Object) create_item(content, attributes, identifier, params = {})
52 53 54 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 52 def create_item(content, attributes, identifier, params = {}) create_object(content_dir_name, content, attributes, identifier, params) end |
- (Object) create_layout(content, attributes, identifier, params = {})
57 58 59 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 57 def create_layout(content, attributes, identifier, params = {}) create_object(layouts_dir_name, content, attributes, identifier, params) end |
- (Object) down
21 22 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 21 def down end |
- (Object) items
42 43 44 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 42 def items load_objects(content_dir_name, 'item', Nanoc::Item) end |
- (Object) layouts
47 48 49 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 47 def layouts load_objects(layouts_dir_name, 'layout', Nanoc::Layout) end |
- (Object) layouts_dir_name
28 29 30 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 28 def layouts_dir_name config.fetch(:layouts_dir, 'layouts') end |
- (Object) setup
33 34 35 36 37 38 39 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 33 def setup # Create directories [content_dir_name, layouts_dir_name].each do |dir| FileUtils.mkdir_p(dir) vcs.add(dir) end end |
- (Object) up
See Nanoc::DataSource#up.
17 18 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 17 def up end |