Module: Jekyll::GitHubMetadata

Defined in:
lib/jekyll-github-metadata.rb,
lib/jekyll-github-metadata/pages.rb,
lib/jekyll-github-metadata/value.rb,
lib/jekyll-github-metadata/client.rb,
lib/jekyll-github-metadata/version.rb,
lib/jekyll-github-metadata/sanitizer.rb,
lib/jekyll-github-metadata/repository.rb,
lib/jekyll-github-metadata/metadata_drop.rb,
lib/jekyll-github-metadata/repository_compat.rb,
lib/jekyll-github-metadata/repository_finder.rb,
lib/jekyll-github-metadata/site_github_munger.rb

Defined Under Namespace

Modules: Sanitizer Classes: Client, MetadataDrop, Pages, Repository, RepositoryCompat, RepositoryFinder, SiteGitHubMunger, Value

Constant Summary collapse

NoRepositoryError =
RepositoryFinder::NoRepositoryError
VERSION =
"2.8.0".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject



65
66
67
# File 'lib/jekyll-github-metadata.rb', line 65

def client
  @client ||= Client.new
end

.loggerObject



49
50
51
52
53
54
55
# File 'lib/jekyll-github-metadata.rb', line 49

def logger
  @logger ||= if Jekyll.respond_to?(:logger)
                Jekyll.logger
              else
                Logger.new($stdout)
              end
end

.repository_finderObject (readonly)

Returns the value of attribute repository_finder.



38
39
40
# File 'lib/jekyll-github-metadata.rb', line 38

def repository_finder
  @repository_finder
end

Class Method Details

.environmentObject



45
46
47
# File 'lib/jekyll-github-metadata.rb', line 45

def environment
  Jekyll.respond_to?(:env) ? Jekyll.env : (Pages.env || "development")
end

.log(severity, message) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/jekyll-github-metadata.rb', line 57

def log(severity, message)
  if logger.method(severity).arity.abs >= 2
    logger.public_send(severity, "GitHub Metadata:", message.to_s)
  else
    logger.public_send(severity, "GitHub Metadata: #{message}")
  end
end

.repositoryObject



69
70
71
72
73
# File 'lib/jekyll-github-metadata.rb', line 69

def repository
  @repository ||= GitHubMetadata::Repository.new(repository_finder.nwo).tap do |repo|
    Jekyll::GitHubMetadata.log :debug, "Generating for #{repo.nwo}"
  end
end

.reset!Object



80
81
82
# File 'lib/jekyll-github-metadata.rb', line 80

def reset!
  @logger = @client = @repository = @nwo = @site = nil
end

.siteObject



41
42
43
# File 'lib/jekyll-github-metadata.rb', line 41

def site
  repository_finder.site
end

.site=(new_site) ⇒ Object



75
76
77
78
# File 'lib/jekyll-github-metadata.rb', line 75

def site=(new_site)
  reset!
  @repository_finder = GitHubMetadata::RepositoryFinder.new(new_site)
end