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.3".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject



67
68
69
# File 'lib/jekyll-github-metadata.rb', line 67

def client
  @client ||= Client.new
end

.loggerObject



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

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.



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

def repository_finder
  @repository_finder
end

Class Method Details

.environmentObject



47
48
49
# File 'lib/jekyll-github-metadata.rb', line 47

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

.log(severity, message) ⇒ Object



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

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



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

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

.reset!Object



82
83
84
# File 'lib/jekyll-github-metadata.rb', line 82

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

.siteObject



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

def site
  repository_finder.site
end

.site=(new_site) ⇒ Object



77
78
79
80
# File 'lib/jekyll-github-metadata.rb', line 77

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