Module: Configuration
- Included in:
- Content, Haml::Helpers::WltExtensions, Renderer, Wst
- Defined in:
- lib/configuration.rb
Class Method Summary collapse
- .config ⇒ Object
- .defaultLinks ⇒ Object
- .links_file_path ⇒ Object
- .read_config(location, local) ⇒ Object
- .read_configuration(location, local) ⇒ Object
- .read_default_links ⇒ Object
- .valid_location?(location) ⇒ Boolean
Instance Method Summary collapse
Class Method Details
.config ⇒ Object
8 9 10 |
# File 'lib/configuration.rb', line 8 def self.config @config end |
.defaultLinks ⇒ Object
16 17 18 |
# File 'lib/configuration.rb', line 16 def self.defaultLinks @defaultLinks end |
.links_file_path ⇒ Object
45 46 47 |
# File 'lib/configuration.rb', line 45 def self.links_file_path File.join config['path'], "links.md" end |
.read_config(location, local) ⇒ Object
20 21 22 23 |
# File 'lib/configuration.rb', line 20 def self.read_config location, local Configuration.read_configuration location, local Configuration.read_default_links end |
.read_configuration(location, local) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/configuration.rb', line 25 def self.read_configuration location, local raise "Not a valid Web Log Today location" unless self.valid_location? location @config = YAML.load File.open(File.join(location, 'config.yaml'), 'r:utf-8').read @config["__site_url__"] = @config["site_url"] @config["site_url"] = "http://localhost:4000" if local @config["path"] = location end |
.read_default_links ⇒ Object
33 34 35 |
# File 'lib/configuration.rb', line 33 def self.read_default_links @defaultLinks = if File.exists? self.links_file_path then "\n" + File.open(self.links_file_path, "r:utf-8").read else "" end end |
.valid_location?(location) ⇒ Boolean
37 38 39 40 41 42 43 |
# File 'lib/configuration.rb', line 37 def self.valid_location? location return false unless File.exists? File.join location, "config.yaml" return false unless File.directory? File.join location, "_posts" return false unless File.directory? File.join location, "_pages" return false unless File.directory? File.join location, "_layouts" return true end |
Instance Method Details
#config ⇒ Object
4 5 6 |
# File 'lib/configuration.rb', line 4 def config Configuration.config end |
#defaultLinks ⇒ Object
12 13 14 |
# File 'lib/configuration.rb', line 12 def defaultLinks Configuration.defaultLinks end |