Class: Nanoc::DataSources::FilesystemI18n

Inherits:
Nanoc::DataSource
  • Object
show all
Defined in:
lib/nanoc/data_sources/filesystem_i18n.rb

Overview

The filesystem_i18n data source is a localized data source for a nanoc site. It stores all data as files on the hard disk and is fully compatible with FilesystemUnified and FilesystemVerbose.

None of the public api methods are documented in this file. See Nanoc::DataSource for documentation on the overridden methods instead.

For more information about this data source specifications and configuration, please read the Readme file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#vcsNanoc::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.



30
31
32
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 30

def vcs
  @vcs ||= Nanoc::Extra::VCSes::Dummy.new
end

Instance Method Details

#create_item(content, attributes, identifier, params = {}) ⇒ Object

See Nanoc::DataSource#create_item.



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

def create_item(content, attributes, identifier, params={})
  create_object('content', content, attributes, identifier, params)
end

#create_layout(content, attributes, identifier, params = {}) ⇒ Object

See Nanoc::DataSource#create_layout.



70
71
72
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 70

def create_layout(content, attributes, identifier, params={})
  create_object('layouts', content, attributes, identifier, params)
end

#downObject

See Nanoc::DataSource#down.



41
42
43
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 41

def down
  @config_loaded = false
end

#itemsObject

See Nanoc::DataSource#items.



55
56
57
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 55

def items
  load_objects('content', 'item', Nanoc::Item)
end

#layoutsObject

See Nanoc::DataSource#layouts.



60
61
62
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 60

def layouts
  load_objects('layouts', 'layout', Nanoc::Layout)
end

#setupObject

See Nanoc::DataSource#setup.



46
47
48
49
50
51
52
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 46

def setup
  # Create directories
  %w( content layouts lib ).each do |dir|
    FileUtils.mkdir_p(dir)
    vcs.add(dir)
  end
end

#upObject

See Nanoc::DataSource#up.



36
37
38
# File 'lib/nanoc/data_sources/filesystem_i18n.rb', line 36

def up
  load_config(@config)
end