Class: Nesta::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/nesta/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.author_settingsObject

Returns the value of attribute author_settings.



15
16
17
# File 'lib/nesta/config.rb', line 15

def author_settings
  @author_settings
end

.settingsObject

Returns the value of attribute settings.



15
16
17
# File 'lib/nesta/config.rb', line 15

def settings
  @settings
end

.yaml_confObject

Returns the value of attribute yaml_conf.



15
16
17
# File 'lib/nesta/config.rb', line 15

def yaml_conf
  @yaml_conf
end

Class Method Details

.attachment_path(basename = nil) ⇒ Object



44
45
46
# File 'lib/nesta/config.rb', line 44

def self.attachment_path(basename = nil)
  get_path(File.join(content_path, "attachments"), basename)
end

.authorObject



27
28
29
30
31
32
33
34
# File 'lib/nesta/config.rb', line 27

def self.author
  environment_config = {}
  %w[name uri email].each do |setting|
    variable = "NESTA_AUTHOR__#{setting.upcase}"
    ENV[variable] && environment_config[setting] = ENV[variable]
  end
  environment_config.empty? ? from_yaml("author") : environment_config
end

.content_path(basename = nil) ⇒ Object



36
37
38
# File 'lib/nesta/config.rb', line 36

def self.content_path(basename = nil)
  get_path(content, basename)
end

.method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/nesta/config.rb', line 18

def self.method_missing(method, *args)
  setting = method.to_s
  if settings.include?(setting)
    from_environment(setting) || from_yaml(setting)
  else
    super
  end
end

.page_path(basename = nil) ⇒ Object



40
41
42
# File 'lib/nesta/config.rb', line 40

def self.page_path(basename = nil)
  get_path(File.join(content_path, "pages"), basename)
end

.yaml_pathObject



48
49
50
# File 'lib/nesta/config.rb', line 48

def self.yaml_path
  File.expand_path('config/config.yml', Nesta::App.root)
end