Sha256: 2870d7eb3573331cd3d0e7bdc2f1737deb7e0b339b49fa2033ed1bb5492364a9
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module Bunto class Theme extend Forwardable attr_reader :name def_delegator :gemspec, :version, :version def initialize(name) @name = name.downcase.strip configure_sass end def root # Must use File.realpath to resolve symlinks created by rbenv # Otherwise, Bunto.sanitized path with prepend the unresolved root @root ||= File.realpath(gemspec.full_gem_path) rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP nil end def includes_path path_for :includes end def layouts_path path_for :layouts end def sass_path path_for :sass end def configure_sass return unless sass_path require "sass" Sass.load_paths << sass_path end private def path_for(folder) path = realpath_for(folder) path if path && File.directory?(path) end def realpath_for(folder) File.realpath(Bunto.sanitized_path(root, "_#{folder}")) rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP nil end def gemspec @gemspec ||= Gem::Specification.find_by_name(name) rescue Gem::LoadError raise Bunto::Errors::MissingDependencyException, "The #{name} theme could not be found." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bunto-3.2.1 | lib/bunto/theme.rb |