Module: Nanoc3::DataSources::Filesystem
- Included in:
- FilesystemUnified, FilesystemVerbose
- Defined in:
- lib/nanoc3/data_sources/filesystem.rb
Overview
Provides functionality common across all filesystem data sources.
Instance Attribute Summary collapse
-
#vcs ⇒ Nanoc3::Extra::VCS?
The VCS that will be called when adding, deleting and moving files.
Instance Method Summary collapse
- #create_item(content, attributes, identifier, params = {}) ⇒ Object
- #create_layout(content, attributes, identifier, params = {}) ⇒ Object
- #down ⇒ Object
- #items ⇒ Object
- #layouts ⇒ Object
- #setup ⇒ Object
- #up ⇒ Object
Instance Attribute Details
#vcs ⇒ Nanoc3::Extra::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/nanoc3/data_sources/filesystem.rb', line 13 def vcs @vcs ||= Nanoc3::Extra::VCSes::Dummy.new end |
Instance Method Details
#create_item(content, attributes, identifier, params = {}) ⇒ Object
46 47 48 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 46 def create_item(content, attributes, identifier, params={}) create_object('content', content, attributes, identifier, params) end |
#create_layout(content, attributes, identifier, params = {}) ⇒ Object
51 52 53 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 51 def create_layout(content, attributes, identifier, params={}) create_object('layouts', content, attributes, identifier, params) end |
#down ⇒ Object
23 24 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 23 def down end |
#items ⇒ Object
36 37 38 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 36 def items load_objects('content', 'item', Nanoc3::Item) end |
#layouts ⇒ Object
41 42 43 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 41 def layouts load_objects('layouts', 'layout', Nanoc3::Layout) end |
#setup ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/nanoc3/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 |
#up ⇒ Object
19 20 |
# File 'lib/nanoc3/data_sources/filesystem.rb', line 19 def up end |