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/edit-link-tag.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, EditLinkTag, MetadataDrop, Pages, Repository, RepositoryCompat, RepositoryFinder, SiteGitHubMunger, Value

Constant Summary collapse

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject



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

def client
  @client ||= Client.new
end

.loggerObject



53
54
55
56
57
58
59
# File 'lib/jekyll-github-metadata.rb', line 53

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.



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

def repository_finder
  @repository_finder
end

Class Method Details

.environmentObject



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

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

.log(severity, message) ⇒ Object



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

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



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

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

.reset!Object



84
85
86
# File 'lib/jekyll-github-metadata.rb', line 84

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

.siteObject



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

def site
  repository_finder.site
end

.site=(new_site) ⇒ Object



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

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