class Jekyll::RemoteTheme::MockGemspec

Jekyll::Theme expects the theme's gemspec to tell it things like the path to the theme and runtime dependencies. MockGemspec serves as a stand in, since remote themes don't need Gemspecs

Constants

DEPENDENCY_PREFIX
DEPENDENCY_REGEX

Attributes

theme[R]

Public Class Methods

new(theme) click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 15
def initialize(theme)
  @theme = theme
end

Public Instance Methods

runtime_dependencies() click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 19
def runtime_dependencies
  @runtime_dependencies ||= dependency_names.map do |name|
    Gem::Dependency.new(name)
  end
end

Private Instance Methods

contents() click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 27
def contents
  @contents ||= File.read(path, :encoding => "utf-8") if path
end
dependency_names() click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 41
def dependency_names
  @dependency_names ||= if contents
                          contents.scan(DEPENDENCY_REGEX).flatten
                        else
                          []
                        end
end
path() click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 31
def path
  @path ||= potential_paths.find { |path| File.exist? path }
end
potential_paths() click to toggle source
# File lib/jekyll-remote-theme/mock_gemspec.rb, line 35
def potential_paths
  [theme.name, "jekyll-theme-#{theme.name}"].map do |filename|
    File.expand_path "#{filename}.gemspec", theme.root
  end
end