Class: Nesta::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/nesta-contentfocus-extensions/path.rb

Class Method Summary collapse

Class Method Details

.pre_contentfocus_themesObject



5
# File 'lib/nesta-contentfocus-extensions/path.rb', line 5

alias_method :pre_contentfocus_themes, :themes

.resolve_theme_path(theme) ⇒ Object



18
19
20
# File 'lib/nesta-contentfocus-extensions/path.rb', line 18

def self.resolve_theme_path(theme)
  theme_gemified?(theme).first if theme_gemified?(theme)
end

.theme_gemified?(theme) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/nesta-contentfocus-extensions/path.rb', line 22

def self.theme_gemified?(theme)
  $LOADED_FEATURES.grep(/nesta-theme-#{theme}\.rb/)
end

.theme_loaded?(theme) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/nesta-contentfocus-extensions/path.rb', line 26

def self.theme_loaded?(theme)
  Nesta::Config.theme && Nesta::Theme.const_defined?(theme.capitalize)
end

.themes(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/nesta-contentfocus-extensions/path.rb', line 8

def self.themes(*args)
  theme = args[0]
  if theme_loaded?(theme) && theme_gemified?(theme)
    theme_dir = resolve_theme_path(theme)
    File.expand_path(File.join(*args[1..-1]), theme_dir + '/../..')
  else
    pre_contentfocus_themes(*args)
  end
end