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) create_item(content, attributes, identifier, params = {})
- - (Object) create_layout(content, attributes, identifier, params = {})
- - (Object) down
- - (Object) items
- - (Object) layouts
- - (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.
13 14 15 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 13 def vcs @vcs ||= Nanoc::Extra::VCSes::Dummy.new end |
Instance Method Details
- (Object) create_item(content, attributes, identifier, params = {})
46 47 48 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 46 def create_item(content, attributes, identifier, params = {}) create_object('content', content, attributes, identifier, params) end |
- (Object) create_layout(content, attributes, identifier, params = {})
51 52 53 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 51 def create_layout(content, attributes, identifier, params = {}) create_object('layouts', content, attributes, identifier, params) end |
- (Object) down
23 24 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 23 def down end |
- (Object) items
36 37 38 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 36 def items load_objects('content', 'item', Nanoc::Item) end |
- (Object) layouts
41 42 43 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 41 def layouts load_objects('layouts', 'layout', Nanoc::Layout) end |
- (Object) setup
27 28 29 30 31 32 33 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 27 def setup # Create directories %w( content layouts ).each do |dir| FileUtils.mkdir_p(dir) vcs.add(dir) end end |
- (Object) up
See Nanoc::DataSource#up.
19 20 |
# File 'lib/nanoc/data_sources/filesystem.rb', line 19 def up end |