Class: Nesta::Config

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

Defined Under Namespace

Classes: NotDefined

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) author_settings

Returns the value of attribute author_settings



21
22
23
# File 'lib/nesta/config.rb', line 21

def author_settings
  @author_settings
end

+ (Object) settings

Returns the value of attribute settings



21
22
23
# File 'lib/nesta/config.rb', line 21

def settings
  @settings
end

+ (Object) yaml_conf

Returns the value of attribute yaml_conf



21
22
23
# File 'lib/nesta/config.rb', line 21

def yaml_conf
  @yaml_conf
end

Class Method Details

+ (Object) attachment_path(basename = nil)



66
67
68
# File 'lib/nesta/config.rb', line 66

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

+ (Object) author



42
43
44
45
46
47
48
49
50
51
# File 'lib/nesta/config.rb', line 42

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
rescue NotDefined
  nil
end

+ (Object) cache



53
54
55
56
# File 'lib/nesta/config.rb', line 53

def self.cache
  Nesta.deprecated('Nesta::Config.cache',
                   'see http://nestacms.com/docs/deployment/page-caching')
end

+ (Object) content_path(basename = nil)



58
59
60
# File 'lib/nesta/config.rb', line 58

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

+ (Object) fetch(key, *default)



24
25
26
27
28
29
30
31
32
# File 'lib/nesta/config.rb', line 24

def self.fetch(key, *default)
  from_environment(key.to_s)
rescue NotDefined
  begin
    from_yaml(key.to_s)
  rescue NotDefined
    default.empty? && raise || (return default.first)
  end
end

+ (Object) method_missing(method, *args)



34
35
36
37
38
39
40
# File 'lib/nesta/config.rb', line 34

def self.method_missing(method, *args)
  if settings.include?(method.to_s)
    fetch(method, nil)
  else
    super
  end
end

+ (Object) page_path(basename = nil)



62
63
64
# File 'lib/nesta/config.rb', line 62

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

+ (Object) read_more



74
75
76
# File 'lib/nesta/config.rb', line 74

def self.read_more
  fetch('read_more', 'Continue reading')
end

+ (Object) yaml_path



70
71
72
# File 'lib/nesta/config.rb', line 70

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