Class: Jekyll::Theme

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ngage/jekyll/theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Theme

Returns a new instance of Theme.



9
10
11
12
13
14
# File 'lib/ngage/jekyll/theme.rb', line 9

def initialize(name)
  @name = name.downcase.strip
  Jekyll.logger.debug "Theme:", name
  Jekyll.logger.debug "Theme source:", root
  configure_sass
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ngage/jekyll/theme.rb', line 6

def name
  @name
end

Instance Method Details

#assets_pathObject



37
38
39
# File 'lib/ngage/jekyll/theme.rb', line 37

def assets_path
  @assets_path ||= path_for "assets"
end

#configure_sassObject



41
42
43
44
45
46
# File 'lib/ngage/jekyll/theme.rb', line 41

def configure_sass
  return unless sass_path

  External.require_with_graceful_fail("sass") unless defined?(Sass)
  Sass.load_paths << sass_path
end

#includes_pathObject



25
26
27
# File 'lib/ngage/jekyll/theme.rb', line 25

def includes_path
  @includes_path ||= path_for "_includes"
end

#layouts_pathObject



29
30
31
# File 'lib/ngage/jekyll/theme.rb', line 29

def layouts_path
  @layouts_path ||= path_for "_layouts"
end

#rootObject



16
17
18
19
20
21
22
23
# File 'lib/ngage/jekyll/theme.rb', line 16

def root
  # Must use File.realpath to resolve symlinks created by rbenv
  # Otherwise, Jekyll.sanitized path with prepend the unresolved root
  @root ||= File.realpath(gemspec.full_gem_path)
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
  raise "Path #{gemspec.full_gem_path} does not exist, is not accessible "\
    "or includes a symbolic link loop"
end

#runtime_dependenciesObject



48
49
50
# File 'lib/ngage/jekyll/theme.rb', line 48

def runtime_dependencies
  gemspec.runtime_dependencies
end

#sass_pathObject



33
34
35
# File 'lib/ngage/jekyll/theme.rb', line 33

def sass_path
  @sass_path ||= path_for "_sass"
end